Add in debugging steps.

Previously, @matthewfl had added some logging stuff, this is a bit
heavier, but often useful.