Added checks for the user input