     console.log("updating objects")
     console.log(xs)
 
-    msg = { Elements: [] }
-
-    lnk_updates = {}
+    #build the update sets
+    link_updates = {}
+    node_updates = {}
 
     for x in xs
-      if x.shp?
-        x.props.position = x.shp.obj3d.position
+
+      if x.links? #x is a node if it has links
+        node_updates[JSON.stringify(x.id)] = x
+        for l in x.links
+          link_updates[JSON.stringify(l.id)] = l
+
+      if x instanceof BaseElements.Link
+        link_updates[JSON.stringify(x.id)] = x
+        node_updates[JSON.stringify(x.endpoint[0].id)] = x.endpoint[0]
+        node_updates[JSON.stringify(x.endpoint[1].id)] = x.endpoint[1]
+
+      true
+
+    #build the update messages
+    node_msg = { Elements: [] }
+    link_msg = { Elements: [] }
+
+    for _, n of node_updates
+      node_msg.Elements.push(
+        { OID: n.id, Type: n.constructor.name, Element: n.props }
+      )
+      true
+
+    for _, l of link_updates
+      link_msg.Elements.push(
+        { OID: l.id, Type: l.constructor.name, Element: l.props }
+      )
+      true
+
+    doLinkUpdate = () =>
+      console.log("link update")
+      console.log(link_msg)
+        
+      if link_msg.Elements.length > 0
+        $.post "/addie/"+dsg+"/design/update", JSON.stringify(link_msg), (data) =>
+          for _, l of link_updates
+            BaseElements.updateId(l)
+
+    doNodeUpdate = () =>
+      console.log("node update")
+      console.log(node_msg)
+
+      if node_msg.Elements.length > 0
+        $.post "/addie/"+dsg+"/design/update", JSON.stringify(node_msg), (data) =>
+          for _, n of node_updates
+            BaseElements.updateId(n)
+          for _, l of link_updates
+            l.setEndpointData()
+
+          doLinkUpdate()
+
+
+    #do the updates
+    if node_msg.Elements.length > 0
+      doNodeUpdate()
+    else if link_msg.Elements.length > 0
+      doLinkUpdate()
+
+
+    ###
+
+    for x in xs
 
       ido = { OID: x.id, Type: x.constructor.name, Element: x.props }
-      msg.Elements.push(ido)
-
+
+      #if node need to update links too
       if x.links?
         for l in x.links
-          l.setEndpointData()
-          ido = { OID: l.id, Type: l.constructor.name, Element: l.props }
-          #msg.Elements.push(ido)
-          lnk_updates[JSON.stringify(l.id)] = ido
-
-      if x.setEndpointData?
-        x.setEndpointData()
+          lido = { OID: l.id, Type: l.constructor.name, Element: l.props }
+          lnk_updates[JSON.stringify(l.id)] = lido
+
+        node_updates[JSON.stringify(x.id)] = ido
+        #msg.Elements.push(ido)
+
+      #if link need to update node too
+      if x instanceof BaseElements.Link
+        #x.setEndpointData()
         ep = x.endpoint[0]
-        msg.Elements.push(
-          { OID: ep.id, Type: ep.constructor.name, Element: ep.props })
+        nido = { OID: ep.id, Type: ep.constructor.name, Element: ep.props }
+        node_updates[JSON.stringify(ep.id)] = nido
 
         ep = x.endpoint[1]
-        msg.Elements.push(
-          { OID: ep.id, Type: ep.constructor.name, Element: ep.props })
+        nido = { OID: ep.id, Type: ep.constructor.name, Element: ep.props }
+        node_updates[JSON.stringify(ep.id)] = nido
+
+        lnk_updates[JSON.stringify(x.id)] = ido
+        ls.push(x)
 
 
       true
-
 
     console.log(msg)
     

      for x in xs
        x.id.name = x.props.name
        x.id.sys = x.props.sys
        msg = { Elements: [] }
        msg.Elements.push(lu) for _, lu of lnk_updates
        $.post "/addie/"+dsg+"/design/update", JSON.stringify(msg), (data) =>

  load: () =>
    ($.get "/addie/"+dsg+"/design/read", (data, status, jqXHR) =>

    @mh.ve.container.onmousemove = (eve) => @handleMove(eve)
  
  handleUp: (ixs) ->
    @mh.updateMouse(event)
    @end.copy(@mh.pos)
    if @mh.placingObject.shp?
      @mh.placingObject.props.position = @mh.placingObject.shp.obj3d.position
      if @start.distanceTo(@end) > 0
        @mh.ve.addie.update([@mh.placingObject])

    @mh.ve.container.onmousemove = null
    @mh.ve.container.onmousedown = (eve) => @mh.baseDown(eve)
