minor change to add a reverse edge to each node.
cleaned up the chain class.