Improving Generator::generate()