further work on code generation