Node fixes with the iterator (thanks James)

And replaces some `std::for_each()` with `for()` to prevent another object in the stack.