Perhaps a Paginator would be a cleaner solution here.