Added the console.log to print total and function.