For nextPage and previousPage, changed "filename" to "path". When chaining, these variables may refer to a different folder.