Move pagination to class