Pie chart

- Fixed the pie chart
- fixed some of the common functions