adjusted search algorithm