Improve user input validation