Change to range-based loops