Add code generation fn