Updated the code for form validation. It's cleaner