search function updated