Lots of work and debugging on writer and generator