Improved form handling