refactored esogenerator