added a debug function and modified the way I set the mode to make adding new
modes a bit easier.  added a few debug statements.