modify search algorithm