Changed match conditions to a regular expression so we don't have the issue with matching subsets of names, per suggestion from @pstadler.