Made an overall change to the search algorithm