added better validation for form