Determing primary email address correctly, closes #1