UNTESTED generic search function