Refactored pause/resume semantics and added some JavaDoc.