added recursion flag