add paging functionality to the index method