Added a bunch of debugging stuff.