Refactoring Paginator and Sorting