Improved for->foreach pattern.
Fixed formatting bug.