added formatEmail function