Nit: Want to just define the new generated code at the top so that we don't have to call replace twice?