Refactor generator.