     name: 'tidy',
     action: (c, t) ->
       console.log('tidy trees')
-      if c.nodes.length == 1
-        n = c.nodes[0]
+      for n in c.nodes
         c.tidy(n, (x: n.x, y: n.y))
+  },
+  {
+    name: 'convert to code table'
+    action: (c, t) ->
+      console.log('convert to code table')
+      if c.nodes.length != 1
+        console.log('only can convert a single tree')
       else
-        console.log('not attempting to tidy multiple trees')
+        c.convertToCode()
   },
   {
     name: 'delete'


    @addAnimations([new CollectionAnimation(anims, -1)])


class WeightedNodeCollection extends NodeCollection
  constructor: (shape) ->


    @arrangeCodes(pos.x, pos.y)

  setNodes: (codes, pos) -> @addCodes(codes, pos)

  addCode: (symbol, code) ->
    oldval = @codes[symbol]
    newval = new CodeNode(symbol, code)
