improved code optimization and corrected mutual recursion translation