slight cleanup with the data structure creation code for pie chart