can we not do case ((highestTs, sumSoFar), (ts, v)) here and get rid of the extra match? otherwise you could also do (_, _) match =>