More work on totals

Code doesn't quite work yet. Shelving for tonight.