         condition: breakpoint.condition
       }, (err, res) ->
         log "BreakpointManager.attachBreakpoint - done"
-        return reject(err) if err
-        breakpoint.id = res.breakpoint
-        self.decorateBreakpoint breakpoint
-        resolve(breakpoint)
-
-  detachBreakpoint: (breakpoint, reason) ->
+        if err
+          breakpoint.clearId()
+          reject(err)
+        else
+          breakpoint.setId(res.breakpoint)
+          resolve(breakpoint)
+
+  detachBreakpoint: (breakpointId) ->
     log "BreakpointManager.detachBreakpoint"
     self = this
     new Promise (resolve, reject) ->
-      id = breakpoint.id
-      breakpoint.id = null
-      breakpoint.marker.destroy()
-      breakpoint.marker = null
       return resolve() unless self.client
-      return resolve() unless id
+      return resolve() unless breakpointId
       log "BreakpointManager.detachBreakpoint - client request"
       self.client.clearBreakpoint {
-        breakpoint: id
+        breakpoint: breakpointId
       }, (err) ->
-         self.decorateBreakpoint breakpoint unless reason is 'removed'
         resolve()
 
   tryFindBreakpoint: (script, line) ->
     return { breakpoint: breakpoint, index: i } for breakpoint, i in @breakpoints when breakpoint.script is script and breakpoint.line is line
-
-  decorateBreakpoint: (breakpoint) ->
-    log "BreakpointManager.decorateBreakpoint - #{breakpoint.marker is null}"
-    breakpoint.marker.destroy() if breakpoint.marker
-    breakpoint.marker = breakpoint.editor.markBufferPosition([breakpoint.line, 0], invalidate: 'never')
-    className = if breakpoint.id then 'node-debugger-attached-breakpoint' else 'node-debugger-detached-breakpoint'
-    breakpoint.editor.decorateMarker(breakpoint.marker, type: 'line-number', class: className)
 
 class Debugger extends EventEmitter
   constructor: (@atom)->

NodeDebuggerView = require './node-debugger-view'
jumpToBreakpoint = require './jump-to-breakpoint'

log = (msg) -> # console.log(msg)

class ProcessManager extends EventEmitter
  constructor: (@atom = atom)->

    log "BreakpointManager.removeBreakpoint #{index}"
    @breakpoints.splice index, 1
    @onRemoveBreakpointEvent.broadcast breakpoint
    @detachBreakpoint breakpoint.id
    breakpoint.dispose()

  addBreakpoint: (editor, script, line) ->
    log "BreakpointManager.addBreakpoint #{script}, #{line}"
    breakpoint = new Breakpoint(editor, script, line)
    log "BreakpointManager.addBreakpoint - adding to list"
    @breakpoints.push breakpoint
    log "BreakpointManager.addBreakpoint - publishing event, num breakpoints=#{@breakpoints.length}"
    @onAddBreakpointEvent.broadcast breakpoint
    log "BreakpointManager.addBreakpoint - attaching"
