Pagination

Quick and dirty hack version.

Needs tests and must be refactored along with the
coming persistence changes.
@tommyp ?