factor out TrimMeasurements