enhanced search algorithm