added search algorithm