refactored the email invite dialog