Use iterators instead of by hand for loops