simplifying and consolidating error handling
and form validation