replace SortByType with generic Sort that accepts a Less func