tighten up search function