Add a few isCancelled checks to ensure we are not performing unnecessary work after being cancelled.