Refactored Generator