Can probably use `if (paused) {...; return}` first to decrease the level of indentation in the function.