Added conditions for stopping the player