Cleaner code for the name-checking.