Implemented first part of search.