Clean up some generator code