Relaxed constraints a little. Added some checks for cancelling.