basic working code for search functionality