Fixed output for recursive definitions
refactoring: some inlining