added pause and resume control