Improving Generator::generate