method mode_name =
      match mode with
        None -> None
      | Some m -> Some m#name