           d._children = null
 
       # Function to center node when clicked/dropped so node doesn't get lost when collapsing/moving with large amount of children.
-      centerNode = (source)->
+      centerNode = (source)=>
         scale = zoomListener.scale()
         x = -1 * source.y0
         y = -1 * source.x0
-        x = x * scale + viewerWidth / 4
-        y = y * scale + viewerHeight / 2
+        x = x * scale + @viewerWidth / 4
+        y = y * scale + @viewerHeight / 2
         d3.select('g').transition()
-            .duration(duration)
+            .duration(NODE_TRANSITION_DURATION)
             .attr("transform", "translate(" + x + "," + y + ")scale(" + scale + ")")
         zoomListener.scale(scale)
         zoomListener.translate([x, y])


        # Transition exiting nodes to the parent's new position.
        nodeExit = node.exit().transition()
            .duration(duration)
            .attr("transform", (d)->
                "translate(" + source.y + "," + source.x + ")"
            )


        # Transition nodes to their new position.
        nodeUpdate = node.transition()
            .duration(NODE_TRANSITION_DURATION)
            .attr("transform", (d)->
                "translate(" + d.y + "," + d.x + ")"
            )
