adjusted the search method