Changed signature of nameMatches to make it easier to use.