Added safe mode stuff to debug bar. Added missing docblocks.
Merged changes from laptop.