move is_dirty() and mark_undirty() to Task class