add update function of task, refactor task