removed ranged based for loops