shortened some code

-updated the "for" loops to use C++11 conventions