Lots of changes to the debug system