Cleanup code a bit, and fixed printing of types in code generator.