initial implementation for the search. minor bugfix