add cancel method to Task class