Completed function and printing to the console.