extracted form validation into class