added validation for form input