Refactored the pagintor in the search service