added the pause functionality