first working version of the search