added pagination and tests