Renamed and repositioned some debugging routines
Introducing a set mode command
A little reformatting