added code to print out total