refactored using new generator