Pagination logic and file structure changes