Slightly refactor count resorting
The bug fix 8f043b29 introduced a secondary code path to trigger a resort of items. However, the previous way to trigger it only required a small bug fix to work and gives us a couple of optimisations for free. This commit removes the secondary code path and fixes the primary one.
The test introduced in 8f043b29 still passes.