remove usage of range-based for loops.