added paging functionality