Tidy up.
Fixed a latent bug in some circular dependency code that would have
prevented very large module graphs from being handled, plus added some
circular dependency spec tests so that we now have coverage in this
area.