Added handling of preemption.