Implemented r4's new debug levels and changed some other minor nitpicks.