refactoring form errors