added support for cancellation