added pause function