switched to using Iterators instead of Streams