Updated for form validation