refactored code
perfected generators