Refactored paging.