added code for handling email case in the form