Tree Sorting works