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