I think it's done: it runs faster in all cases, with a hard-coded edge-case for empty sums