Added support for cancellation tokens.