Added cancellation token functionality