switching to c++11 for loops