Add onPause, onResume functions