add recursive search logic