Lots of bug fixing.  Rewrote Graph into scala for easy fixups later on.