Modified NodeState and added tests.