Previously, we'd iterate over the extra elements in arbitrary order. We now sort the elements and store them in deterministic order. Without sorting, the included test fails half the time.