Replaced explicit iterator usage with enhanced for-loops.