Refactor edittask handler