It doesn't look like any of the vector type arguments are modified.
If they are supposed to stay unmodified, then these should be made const and the iterators below changed to const_iterators