Change some pass-by-value to pass-by-ref, very slight but measurable speedup