     @subscriptions.dispose()
 
   disconnect: ->
+    # @pairingChannel.trigger 'client-disconnected', {colour: @markerColour}
     @pusher.disconnect()
-    @clearMarkers(@markerColour)
+    _.each @friendColours, (colour) => @clearMarkers(colour)
+    atom.views.getView(@editor).removeAttribute('id')
     @hidePanel()
 
   serialize: ->


  startPairing: ->
    @subscriptions.add atom.commands.add 'atom-workspace', 'pusht:disconnect': => @disconnect()
    triggerPush = true
    @editor = atom.workspace.getActiveEditor()

    atom.views.getView(@editor).setAttribute('id', 'pusht')

    buffer = @buffer = @editor.buffer

      @sendGrammar()
      @syncGrammars()
      @shareCurrentFile(buffer)
      @receiveFriendInfo(data)
      @pairingChannel.trigger 'client-broadcast-initial-marker', {colour: @markerColour}

    @pairingChannel.bind 'client-broadcast-initial-marker', (data) => @receiveFriendInfo(data)

    @pairingChannel.bind 'client-text-select', (data) =>
      @clearMarkers(data.colour)
