Restructured dispatcher to be static - state accessible from anywhere.
Error handling works better now in the dispatcher, with exceptions
thrown and caught with relevant debugging information.