initial code generation
code gen changes, fixed errors