Implemented the search functionality