Clean up typedef.
Add support for arrays as locals.
Fix code generation to work within a template.
Fix some warnings in the generated code.