Fix output to show the total only once