method mode_to_display s =
      match mode with
        None -> s
      | Some m -> m#to_display s