Move pausing code back to the correct location