improved form generation