Applied comments from #436
Refactored checkName and checkUniqueId