Using search array function as a function