Updated the debugging output and cleaned up code a little bit. Started the infrastructure for registering callbacks to handle the various commands.
First commit towards building a class for this, may end up scrapping it