removed last of unnecessary mutability from codegen