Add some reference doc; cleanup whitespace
Move debugging functions
Move debug headers