While Charles won several decisive battles in the Commonwealth and ultimately secured the coronation of his ally Stanisław Leszczyński and the surrender of Saxony, the Russian Tsar Peter the Great embarked on a military reform plan that improved the Russian army, using the effectively organized Swedes and other European standards for role models. Russian forces managed to penetrate Ingria and established a new city, Saint Petersburg, there. Charles planned an invasion of the Russian heartland, allying himself with Ivan Mazepa, Hetman of the Ukrainian Cossacks. The size of the invading Swedish army was peeled off as Charles left Leszczyński with some 24,000 German and Polish troops, departing eastwards from Saxony in late 1707 with some 35,000 men, adding a further 12,500 under Adam Ludwig Lewenhaupt marching from Livonia. Charles left the homeland with a defense of approximately 28,800 men, with a further 14,000 in Swedish Finland as well as further garrisons in the Baltic and German provinces.