moved form validation method