inner recursion does not need to be public