   addNode : (node) ->
 
     @nodesBuffer.push(node.pos)
-    @nodes.geometry.nodeIDs.push([node.id])
+    @nodeIDs.push([node.id])
 
     # Add any edge from smaller IDs to the node
     # ASSUMPTION: if this node is new, it should have a

      @[property].pushSubarray(otherTree[property].getAllElements())

    # merge IDs, nodes and edges
    @nodes.geometry.nodeIDs.pushSubarray(otherTree.nodes.geometry.nodeIDs.getAllElements())
    merge("nodesBuffer")
    merge("edgesBuffer")
    @edgesBuffer.push( @getEdgeArray(lastNode, activeNode) )


  deleteNode : (node) ->

    swapLast = (array, index) =>
      lastElement = array.pop()
      for i in [0..array.elementLength]
        @nodesBuffer.getAllElements()[index * array.elementLength + i] = lastElement[i]

    # Find index
    for i in [0...@nodeIDs.getLength()]
      if @nodeIDs.get(i) == node.id
        nodesIndex = i
        break

    # swap IDs and nodes
    swapLast( @nodeIDs, nodesIndex )
    swapLast( @nodesBuffer, nodesIndex )

    # Delete Edge by finding it in the array
