improved form validation, and small other things