refactor State of task