Added better support for pause/resume