added alternative way of form validation