invert recursion logic control variable