let compare_max_min max min =
    match max, min with
    | None,_ -> 1
    | _,None -> 1
    | Some max, Some min -> Int.compare max min