fixed up search with functions