optimized search for names