partly working search function