Implemented nameCheck() function.