Fixed search functions to better suit requirements