More work on the search function