Refactor sim with a new Node class.