created a prompt for user input and fixed the main loop