(maint) Fix pie chart displays and clean up code

wip