working code generation prototype