added pagination properly