Improve the logic for autosizing partitions.