Added logging capabilities and improvements to the dispatcher