Added a dispatching logic.