Add Task related classes, and fix minor bugs