Refactored some comprehensions into generators.