implement pausing and unpausing.