Refactoring + paging added