improved form handling