Refactors code and changes regex to account for double dots in email addresses.