working pause function with Pause