Store program depth in endProgram action
Clean up indentation in templates