Added Dialog with email, refactored code