         labels = labelGroup.selectAll("text")
             .data(data
                 .sort((p1,p2) -> 
-                    return p1.startAngle - p2.startAngle;
+                    return p1.startAngle - p2.startAngle
                 ) 
-            );
+            )
         labels.enter()
             .append("text")
-            .attr("text-anchor", "middle");
+            .attr("text-anchor", "middle")
         labels.exit()
-            .remove();
+            .remove()
         
         labelLayout = d3.geom.quadtree()
             .extent([[-that.width,-that.height], [that.width, that.height] ])
-            .x((d) -> return d.x;)
-            .y((d) -> return d.y;)
-            ([]); #create an empty quadtree to hold label positions
-        maxLabelWidth = 0;
-        maxLabelHeight = 0;
+            .x((d) -> return d.x)
+            .y((d) -> return d.y)
+            ([]) #create an empty quadtree to hold label positions
+        maxLabelWidth = 0
+        maxLabelHeight = 0
         
         labels.text((d) ->
             # Set the text *first*, so we can query the size
             # of the label with .getBBox()
-            return d.value;
+            return d.value
         )
         .each((d, i) ->
             # Move all calculations into the each function.

            # so can be accessed later when drawing the line
            
            # calculate the position of the center marker
            a = (d.startAngle + d.endAngle) / 2 ;
            
            #trig functions adjusted to use the angle relative
            #to the "12 o'clock" vector:
            d.cx = Math.sin(a) * (that.radius - 75);
            d.cy = -Math.cos(a) * (that.radius - 75);
            
            # calculate the default position for the label,
            #   so that the middle of the label is centered in the arc
            bbox = d3.getBBox();
            #bbox.width and bbox.height will 
            #describe the size of the label text
            labelRadius = that.radius - 20;
            d.x =  Math.sin(a) * (labelRadius);
            d.l = d.x - bbox.width / 2 - 2;
            d.r = d.x + bbox.width / 2 + 2;
            d.y = -Math.cos(a) * (that.radius - 20);
            d.b = d.oy = d.y + 5;
            d.t = d.y - bbox.height - 5 ;
            
            # check whether the default position 
            #   overlaps any other labels
            conflicts = [];
            labelLayout.visit((node, x1, y1, x2, y2) -> 
                #recurse down the tree, adding any overlapping 
                #node is the node in the quadtree, 

            .append("circle")
            .attr("cx", 3)
            .attr("cy", 3)
            .attr("r", 3)
        }
        #Create/select <g> elements to hold the different types of graphics
        #and keep them in the correct drawing order
        pathGroup = d3.svg.select("g.piePaths")
        if (pathGroup.empty() ){
            pathGroup = d3.svg.append("g")
                       .attr("class", "piePaths")
        }
        pointerGroup = d3.svg.select("g.pointers")
        if (pointerGroup.empty() ) {
            pointerGroup = d3.svg.append("g")
                           .attr("class", "pointers")
        }
        labelGroup = d3.svg.select("g.labels")
        if (labelGroup.empty() ) {
            labelGroup = d3.svg.append("g")
                         .attr("class", "labels")
        }
        
        d3.path = pathGroup.selectAll("path.pie")
            .data(data)

        d3.path.enter().append("path")
            .attr("class", "pie")
            .attr("fill", (d, i) -> 
                return d3.color(i)
        );

#        this.path.transition()
