Updated the main loop to print words