added code to compute total