Just cleaning up some C++ looping code