Updated search logic