Added user input validation and prompt.