As prime minister, Bethlen dominated Hungarian politics between 1921 and 1931. He fashioned a political machine by amending the electoral law, providing jobs in the expanding bureaucracy to his supporters, and manipulating elections in rural areas. Bethlen restored order to the country by giving the radical counterrevolutionaries payoffs and government jobs in exchange for ceasing their campaign of terror against Jews and leftists. In 1921, he made a deal with the Social Democrats and trade unions (called Bethlen-Peyer Pact), agreeing, among other things, to legalize their activities and free political prisoners in return for their pledge to refrain from spreading anti-Hungarian propaganda, calling political strikes, and organizing the peasantry. Bethlen brought Hungary into the League of Nations in 1922 and out of international isolation by signing a treaty of friendship with Italy in 1927. The revision of the Treaty of Trianon rose to the top of Hungary's political agenda and the strategy employed by Bethlen consisted by strengthening the economy and building relations with stronger nations. Revision of the treaty had such a broad backing in Hungary that Bethlen used it, at least in part, to deflect criticism of his economic, social, and political policies.