Brian's preemption code