Changed some references to currentState to use node.getState() instead.