sentences:  Peace was made with Denmark in the treaties of Fontainebleau (1679) and Lund, and with Brandenburg in the Treaty of Saint-Germain-en-Laye (1679).Charles devoted the rest of his life to avoiding further warfare by gaining larger independence in foreign affairs, while he also promoted economic stabilization and a reorganization of the military.His remaining 20 years on the throne were the longest peacetime of the Swedish Empire (1611–1718).