working on solution, put searchCache into a function