functional table with pie chart. now to add color
added a legend
added some comments for clarity