totals and formatting