code needed for the search