adding validation for user inputs