As prime minister, Bethlen dominated Hungarian politics between 1921 and 1931. He fashioned a political machine by amending the electoral law, eliminating peasants from the Party of Unity, providing jobs in the 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 Bethlen made a deal with the Social Democrats and trade unions, 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. In May 1922, the Party of Unity captured a large parliamentary majority. Karl IV's death, soon after he failed a second time to reclaim the throne [in Hungary] in October 1921, allowed the revision of the Treaty of Trianon to rise to the top of Hungary's political agenda.