Added a main for actually making a graph and running stuff.
Many minor bugfixes.