updated code for matching emails to accomodate for several matches