Add implementation of flushing function
Add implementation of dispatching function (incomplete)