add pause and resume function