add cancellation token checks