Replace some unnecessary vector copies with references.