Updated the search function