Validate node names. See #1145.
Refactored validators.