Refactor pagination

It also creates the initial integration tests for users.