Implemented task cancellation in the client