Calculate total and printout % per category

Also print the number of items in the category at the end.
Code cleanup