refactoring the keys and add NodeType