Added keyed allocation to split, cleaned up sort.