   #
   # Remove an IIP will emit a `removeInitial` event.
   removeInitial: (node, port) ->
+    @checkTransactionStart()
+
     for edge, index in @initializers
       continue unless edge
       if edge.to.node is node and edge.to.port is port
         @emit 'removeInitial', edge
         @initializers.splice index, 1
+
+    @checkTransactionEnd()
 
   toDOT: ->
     cleanID = (id) ->

exports.createGraph = (name) ->
  new Graph name

exports.loadJSON = (definition, success) ->
  definition.properties = {} unless definition.properties
  definition.processes = {} unless definition.processes
  definition.connections = [] unless definition.connections

  graph = new Graph definition.properties.name
  for property, value of definition.properties
    continue if property is 'name'
    graph.properties[property] = value

      metadata: metadata
    @nodes.push node
    @emit 'addNode', node

    @checkTransactionEnd()
    node

  # ## Removing a node from the graph
