Implemented task scheduler (#2).