Added pause and resume functionality