Initial version of generator refactoring