A couple of fixes to the generated code, next I need to fix the indent level writing.