Fix recursion bug.
Add missing output variables.
Update output templates.