Adding pausing functionality