add pause and resume functionality