add email function and other form related changes