Completed implementation of code generator