almost fully working, need to sum totals