create helper functions for paging