Complete working search functionality