 
   activate: (state) ->
     @process = new GhcModiProcess
+    @disposables = null
 
   deactivate: ->
     @process?.destroy()
     @process = null
     @completionBackend = null
+    @disposables?.dispose?()
+    @disposables = null
 
   provideCompletionBackend: ->
     @completionBackend ?= new CompletionBackend @process
     @completionBackend
 
-  consumeUPI: (upi) ->
-    disposables = new CompositeDisposable
-    disposables.add upi.disposables
+  consumeUPI: (service) ->
+    upi = service.registerPlugin @disposables = new CompositeDisposable
 
     upi.setMessageTypes
       error: {}
       warning: {}
       lint: {}
 
-    disposables.add atom.commands.add 'atom-workspace',
+    @disposables.add atom.commands.add 'atom-workspace',
       'haskell-ghc-mod:shutdown-backend': =>
         @process?.killProcess?()
 

        else
          Promise.reject ignore: true #this won't set backend status

    disposables.add upi.onDidSaveBuffer (buffer) =>
      if atom.config.get('haskell-ghc-mod.onSaveCheck') and
         atom.config.get('haskell-ghc-mod.onSaveLint')
        upi.clearMessages ['error', 'warning', 'lint']

      {label: 'Stop Backend', command: 'haskell-ghc-mod:shutdown-backend'}
    ]

    @disposables.add atom.contextMenu.add
      'atom-text-editor[data-grammar~="haskell"]': [
        'label': 'Ghc-Mod'
        'submenu': [
