renamed sorted_pair to ordered_pair