 
 step = (current, val) ->
   next = {size: 0}
-  for own id, thing of current when id != "size"
-    state = thing[0]
-    state.arcs.forEach (arc) ->
+  for own key, thing of current when key != "size"
+    thing.state.arcs.forEach (arc) ->
       if arc.test(val)
-        leaf = new TreeNode(thing[1], val)
+        node = new TreeNode(thing.tree, val)
         if arc.nextState.final
-          leaf.final = true
+          node.final = true
         else
           null
-        next[arc.nextState.id] = [arc.nextState, leaf]
+        next[arc.nextState.id] = {state: arc.nextState, tree: node}
         next.size++
   next
 


  formatTest: (val) ->
    if typeof(val) == "function"
      "<function>"
    else if val == true
      return "<epsilon>"
    else

testMatch = (list, val) ->
  match = false
  for own id, thing of list
    state = thing.state
    if state && state.finalValue
      tip = thing.tree
      path = [tip.val]
      t = null
      while (tip = tip.parent)
