Cleaned up code generation a bit.