Creating generators and refactoring