introduce TaskDef class to reduce duplication