WriteGenerator Update

Generates code that works now