Pie charts refactoring