@@ -11,11 +11,11 @@
 
 from .NVD3Chart import NVD3Chart, TemplateMixin
 from jinja2 import Environment, FileSystemLoader
-# from jinja2 import DebugUndefined, Template
 import os
 
 
-class pieChart(NVD3Chart):
+class PieChart(TemplateMixin, NVD3Chart):
+
     """
     A pie chart (or a circle graph) is a circular chart divided into sectors,
     illustrating numerical proportion. In chart, the arc length of each sector
@@ -81,38 +81,6 @@ class pieChart(NVD3Chart):
         </script>
 
     """
-
-    CHART_FILENAME = "./pie.html"
-
-    template_environment = Environment(lstrip_blocks=True, trim_blocks=True)
-    template_environment.loader = FileSystemLoader(os.path.join(
-        os.path.dirname(__file__), 'templates'))
-    template_chart_nvd3 = template_environment.get_template(CHART_FILENAME)
-
-    def __init__(self, **kwargs):
-        NVD3Chart.__init__(self, **kwargs)
-        height = kwargs.get('height', 450)
-        width = kwargs.get('width', None)
-        self.donut = kwargs.get('donut', False)
-        self.donutRatio = kwargs.get('donutRatio', 0.35)
-        self.color_list = []
-        self.create_x_axis('xAxis', format=None)
-        self.create_y_axis('yAxis', format=None)
-        # must have a specified height, otherwise it superimposes both chars
-        if height:
-            self.set_graph_height(height)
-        if width:
-            self.set_graph_width(width)
-        self.donut = kwargs.get('donut', False)
-        self.donutRatio = kwargs.get('donutRatio', 0.35)
-
-    def buildjschart(self):
-        NVD3Chart.buildjschart(self)
-        self.jschart = self.template_chart_nvd3.render(chart=self)
-
-
-class PieChart(TemplateMixin, NVD3Chart):
-
     CHART_FILENAME = "./piechart.html"
 
     template_environment = Environment(lstrip_blocks=True, trim_blocks=True)
@@ -138,3 +106,4 @@ def __init__(self, **kwargs):
         self.donut = kwargs.get('donut', False)
         self.donutRatio = kwargs.get('donutRatio', 0.35)
 
+pieChart = PieChart