reworked to enable preemptions