WASHINGTON ― After days of marathon negotiations and a tense shouting match on the Senate floor, lawmakers reached a deal with the Trump administration early Wednesday morning on massive trillion-dollar emergency legislation aimed at propping up the U.S. economy and giving relief to workers hit hard by the coronavirus pandemic.

A vote on the bill, which has yet to be fully written, is expected later Wednesday. It would likely be the largest federal bailout package in U.S. history.

“The Senate has reached a bipartisan agreement on a historic relief package for this pandemic,” Senate Majority Leader Mitch McConnell (R-Ky.) said on the floor. “In effect, this is a wartime level of investment into our nation.”

The legislation, which would cost approximately $2 trillion, includes hundreds of billions in loans for small businesses, many of which have been forced to close to fight the spread of the virus. It also provides direct cash payments to the majority of Americans who are struggling to make ends meet or who have lost jobs during the crisis.

Democrats twice delayed passage of the measure to secure key priorities. The bill now includes more funding for hospitals and health care workers than Republicans proposed, as well as expanded unemployment benefits to cover individuals who are not currently covered by traditional unemployment assistance for four months. Republicans initially proposed three months.

“This is a great plan. What it says is if you lose your job in this crisis you can be furloughed by your employer,” Schumer said Tuesday of the new provisions, calling it “unemployment insurance on steroids.”

Democrats also succeeded in securing in some oversight over $400 billion in loans to distressed corporations, which some critics were calling a “slush fund.” The massive pot of money would be controlled by President Donald Trump’s administration and could include bailouts to affected industries like hotels, casinos, cruise lines, and the oil and gas industry. Under the terms of the deal, however, an independent inspector general and a congressional oversight board would be in charge of scrutinizing the lending decisions.

The bill includes restrictions on companies that accept aid from U.S. taxpayers from rewarding shareholders and their executives through stock buybacks, another Democratic priority.

Republicans excoriated Democrats over the days-long delay of the bill, accusing them of putting Americans’ health and safety at risk while job losses and deaths mounted.

“This body can’t get its act together, and the only reason it can’t get its act together is right over here on the other side of the aisle,” McConnell said on the floor Monday. “Are you kidding me?”

Tensions flared as members of both parties traded shots over the bill.

“This is unbelievable,” Sen. Susan Collins (R-Maine) yelled at one point after Senate Minority Leader Chuck Schumer (D-N.Y.) objected to her speaking on the floor.

During another heated exchange on the floor, Sen. Sherrod Brown (D-Ohio) responded to a question from Sen. Tom Cotton (R-Ark.) by saying, “I know you always want to do ... the president’s bidding.”

But the mood in the chamber turned significantly more upbeat on Tuesday as both sides expressed optimism about passing the bill early this week.

The legislation is the third and largest of the government’s responses to the coronavirus crisis. Last week, Trump signed House Democrats’ bill that makes coronavirus testing free, expands unemployment insurance benefits and provides paid leave to some displaced workers.

Much of the negotiations occurred behind closed doors on Sunday and Monday. Mnuchin was spotted walking back and forth between the offices of McConnell and Schumer. He also sat down for two hours with Brown, the top Democrat on the Senate Banking Committee.

House Speaker Nancy Pelosi (D-Calif.) unveiled her own massive rescue bill on Monday that would cost at least $2.5 trillion. The move seemed aimed at giving Schumer leverage in his talks with the administration ― in fact, some aspects of the legislation were included in the Senate bill.

Pelosi expressed hope Tuesday about getting unanimous agreement in the House to approve the Senate bill by voice vote rather than calling the entire lower chamber back to Washington, a process that could substantially delay getting the bill to the president’s desk.

Senate Democrats “have done a great job,” Pelosi said Tuesday in an interview on CNBC. “Overarchingly we’re getting to a good place.”

This is a developing story. Please check back for updates.