added search logic