Refactoring to use iterators wherever possible