generator - refactoring