Add logic to merge results to calculate totals