Rafactoring code generation