Added optimised pagination

Fixed back button and pagination