Split the definition of the total from the function call, and added information about the type of total to the function.