put totals back, refactor