Refactored to separate graph/node classes