Improved performance by returning iterators instead of iterating over them.