Remove unnecessary use of slow vector in getUnits