That got me thinking we should really just store an array for the stats, and use the array's index as the partition index. It's fine for this pull request to leave it as in, but if it makes your code simpler, you should consider doing it as part of this PR too.