optimize the search function