Changed iterate functor parameter to const reference
* replaced ranged for loop with more appropriate std::for_each