Improved form reset function