added the search alogorithm