Refactor generator