added pagination and sorting