Adding search logic