Some improvements on form validation.