Simplify sort_seg_children