[Debug] Better integration of debugging code
[Cleanup] Misc cleanup