refactoring pagination classes