           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])

              #           .style("left", (d3.event.layerX) + "px")
              #           .style("top", (d3.event.layerY + 28) + "px")
              # )
              tooltipDiv.transition()
                  .duration(200)
                  .style("opacity", .9)
              tooltipDiv.html("<bold>#{d.name}</bold>")
                  .style("left", (d3.event.layerX) + "px")
                  .style("top", (d3.event.layerY + 28) + "px")
            )
            .on("mouseout", (d)->
              tooltipDiv.transition()
                  .duration(500)
                  .style("opacity", 0)
            )

      #   atom.notifications.addWarning "No data was captured for display", dismissable: true
      #   return

      # TODO identify and document all class variables
      @graphDiv = document.createElement("div")
      d3.select(@graphDiv).attr("class", "sayid-holder")
      @html $ @graphDiv

      @maxLabelLength = 0

      @root = null
      @nextNodeId = 0

      # size of the diagram
      @viewerWidth = $(@graphDiv).width()
      @viewerHeight = $(@graphDiv).height()
      @tree = d3.layout.tree().size([@viewerHeight, @viewerWidth])

      # Define the div for the tooltip
      @tooltipDiv = d3.select(@graphDiv).append("div")
          .attr("class", "sayid-tooltip")
          .style("opacity", 0);

      # define a d3 diagonal projection for use by the node paths later on.
      # TODO rename to something like d3Diagnol
      @diagonal = d3.svg.diagonal().projection((d)-> [d.y, d.x])

      # Call visit function to establish maxLabelLength
      visit(treeData, (d)=>
        @nextNodeId++
        @maxLabelLength = Math.max(d.name.length, @maxLabelLength)
      , (d)-> if d.children && d.children.length > 0 then d.children else null)

      # Define the zoom function for the zoomable tree
