Extract searchLocalFunction() method