Cleanup some of the generation code