use recursive search for elements