generator - refactorings + tests round 2