adding totals to output