     nodeMap = {}
 
     for topState in tree
-        walk topState, (state) ->
+        walk topState, (state, parent) ->
             node = {
                 name: state.name
-                radius: 20
+                width: 40
+                height: 40
+                children: []
             }
             nodes.push(node)
             nodeMap[state.name] = node
+            if parent?
+                parentNode = nodeMap[parent.name]
+                node.parent = parentNode
+                parentNode.children.push(node)
 
     r = 40
 


        svg.selectAll('.cell')
            .attr('transform', (node) -> "translate(#{node.x},#{node.y})")


collide = (node) ->

        .call(force.drag)

    force.on 'tick', ->
        for node in nodes
            if node.children.length > 0
                xMin = d3.min(node.children, (d) -> d.x - d.width / 2) - 5
                xMax = d3.max(node.children, (d) -> d.x + d.width / 2) + 5
                yMin = d3.min(node.children, (d) -> d.y - d.height / 2) - 5
                yMax = d3.max(node.children, (d) -> d.y + d.height / 2) + 5
                node.width = xMax - xMin
                node.height = yMax - yMin
                node.x = xMin + node.width / 2
                node.y = yMin + node.height / 2

        q = d3.geom.quadtree(nodes)

        for i in [0 .. nodes.length - 1]
