utilized std::for_each where I could