Refactoring of Generator