refactor set_task