user input validation

added user input validation