looping is recursion, with added tail