Replaced C++11 for BOOST_FOREACH syntax