Moved util package to codegen, returning CodeGenResult from write()