Implement DIDispatcher, and fix related code.