Adding code to deal with converting total preorders to total orders, needs cleanup