Replaced boost foreach with c++11 style for each loops.