Refactors to use consumer/dispatcher model.