implemented search functionality. it needs improving