Added onPause method