After a frantic, extraordinary 22-hour legislative session, Republicans in the Wisconsin Assembly on Wednesday morning joined their Senate colleagues in passing a sweeping package of bills intended to curb the authority of incoming Democratic Gov. Tony Evers.

The legislation now goes to the desk of departing Republican Gov. Scott Walker, who has signaled he will sign off on it before he leaves office in early January.

The bill passed the Assembly, where Republicans hold a large majority, by 56-27, according to the Milwaukee Journal-Sentinel. That chamber’s vote came a few hours after the Senate, shortly after sunrise, voted 17-16 to pass the legislation. One Senate Republican defected, while all Democrats voted against it.

Reporters at the scene described chaotic all-night negotiations with lawmakers wandering the Capitol building in Madison unsure of the current state of bill they were rushing to move forward.

Defending the rushed process and content of the bill package, Assembly Speaker Robin Vos said that Democrats unfairly “whipped up people” and that he was sickened that they “so grossly” exaggerated its purpose, according to the New York Times.

The final version of the bill did strip out some of the most controversial provisions, like one granting the GOP-dominated legislature the power to rely on its own outside lawyers rather than the attorney general when state laws are handled in court.

But Republicans are correcting a balance of power of their own making. As Vos and others have said, they granted Walker an unprecedented degree of authority during his eight years in office. The new legislation will rescind much of that power from his Democratic successor.

Vos said Wednesday that the legislature has “allowed far too much authority to flow to the executive.”

“To you this is all about politics. To me, it’s about the institution,” he said, according to the Associated Press.

The final bill will weaken Evers’ ability to institute rules to enact laws and grant the legislature control of the state economic development board through September of next year, the AP reported. It also goes after the power of incoming Democratic Attorney General Josh Kaul, handicapping his ability to move forward with his campaign promise to withdraw Wisconsin from a federal lawsuit that aims to repeal Obamacare.

Democratic groups and voters packed the Capitol this week to voice their discontent, and some parts of the bill, like the provision to limit early voting to two weeks, are likely to face litigation. A similar limit was challenged in 2016 and ruled unconstitutional by a federal judge.

Walker, who lost reelection to a third term in a close but decisive vote, has said he thinks the proposed changes are appropriate. He has signaled his intention to sign the bill before he leaves office on January 7.