Fixed an undefined variable and completed the code to print to the console