Sorted the list of categories and added a "total" row.