smarter form validation