implement pause function