completed first draft of code generator