Remove unnecessary code
Update cancellation handling