some refactoring in CommandToNode