Added some functionality for accumulating tasks and scheduling them.