Support for paged results, minor refactors