Prune the registry to the soft and hard limits and accept a sort function.