Adding logging and using cancellation tokens