Modified js for form validation