Final version, uses global variables to print to terminal