added form validation logic