Drop usage of SortedDict. Closes #2027.