Added totals functionality