Moves task validation to before retrieval of task_id