Refactored the search logic to initiate support for paginated results.