Getting closer to being able to merge with Master.

Hopefully this alleviates the rest of the debug stuff I've hidden around
the code structure.