let merge a b =
          if a == b
          then a
          else
            (let r =
               match ((a.ghost), (b.ghost)) with
               | (false, false) -> { (a) with stop = b.stop; }
               | (true, true) -> { (a) with stop = b.stop; }
               | (true, _) -> { (a) with stop = b.stop; }
               | (_, true) -> { (b) with start = a.start; }
             in r)