Added user input validation