Implemented better pagination