implemented pause function