method remaining =
    match remaining with
      | None -> -1
      | Some remaining -> remaining