Some changes to SortStack