added working search function