added validation

Validation for incorrect input values