figured out recursion, wrote test loop