added pause/resume functionality