WASHINGTON - The Senate reached a surprise last-minute deal late Tuesday to extend the small-business Paycheck Protection Program through Aug. 8, passing it just hours before the lending program was set to shut down at midnight.

Prospects for the legislation in the House, however, were uncertain. Both chambers are set to adjourn for a two-week recess by week's end.

The short-term agreement came together in behind-the-scenes negotiations involving Senate Minority Leader Charles Schumer, D-N.Y., Sens. Marco Rubio, R-Fla., Susan Collins, R-Maine, Christopher Coons, D-Del., and others.

The Senate acted by unanimous consent to extend the Tuesday midnight deadline for when the PPP can accept applications for forgivable loans for an additional five weeks. It came as the program was poised to shut down to new users with more than $130 billion left untapped. Lawmakers were working on legislation to redirect the remaining funding to additional businesses, but no such deal was expected to be reached until late July, and meanwhile the money left in the program would be sitting unspent.

"We want to make sure the money gets out, and we also want to make sure those who really need it get the funds," Sen. Ben Cardin, D-Md., the top Democrat on the Senate Small Business Committee, said on the Senate floor.

Democrats had been planning all day to try to advance Paycheck Protection Program legislation on the floor by unanimous consent - but they were expecting Republicans to object. Instead a last-minute deal was struck and quickly passed.

Even if the House manages to pass the measure before adjourning this week, though, thorny questions still remain unresolved about how to repurpose the funds left in the program. Demand for the remaining money has slowed to a trickle, a dramatic change since the program was launched in April and immediately overwhelmed by demand.

At a hearing of the House Financial Services Committee on Tuesday, Treasury Secretary Steven Mnuchin said the Trump administration supports legislation to re-purpose the more than $130 billion left in the small-business fund.

"I've already had conversations with the [Small Business Administration] committee in the Senate about repurposing that $135 billion and think that should be done, and look forward to working with both the House and the Senate so we can pass legislation by the end of July," Mnuchin said.

The aim should be "extending it to businesses that are most hard-hit, that have requirements that their revenue have dropped significantly - things like restaurants and hotels and others where it is critical to get people back to work," Mnuchin said.

Rubio is working on legislation along the lines of what Mnuchin described. It would create new programs to expand uses for the funds, such as allowing chambers of commerce to apply and directing more money to certain businesses that prove they were affected by the pandemic.

According to a draft copy of the bill that was obtained by The Washington Post, the legislation would also set aside $25 billion for businesses with fewer than 10 employees and formally prevent hotel or restaurant chains from receiving more than $2 million total. Rubio would need to reach an agreement with Democrats before any deal could be signed into law, however, and they have been calling for a range of other economic responses to the coronavirus pandemic.

A separate bill proposed weeks ago by Cardin and Sen. Jeanne Shaheen, D-N.H., would extend Tuesday's deadline by six months to allow more businesses to access the remaining funds. But the Democratic-sponsored legislation contains more restrictions that would limit new loans to the smallest businesses and those in dire need.

The bill would restrict new lending to small businesses with 100 employees or fewer, significantly lower than the 500-employee cap that applies under current rules. And in a significant departure from current rules, businesses that had already received and spent a PPP loan would face restrictions requiring them to prove a revenue reduction of 50 percent or more.

The PPP disbursed hundreds of billions of dollars to small businesses, but it also faced criticism because of some of its recipients. Publicly traded chains early on reaped millions, prompting more than $38 billion to be returned to the government after the administration condemned well-capitalized companies for taking funds.

The idea behind the repurposing of leftover funds would be to better target money to businesses that need it and allow them to use more of it on capital expenditures as they move toward reopening. Restaurants, for instance, could use funding to build sidewalk seating or reconfigure their dining rooms for social distancing.

"Obviously we'll have to be more targeted at truly small businesses and, in addition to that, I'm also developing a program to provide financing for businesses in underserved communities or opportunity zones and other Zip codes that would fall in that category," Rubio told reporters Tuesday, describing his plans for longer-term legislation.

"W're talking to the White House about it," Rubio said. "They've expressed to us that they have no intent of repurposing that money for something else, but our hope is that we can use that as the sort of foundation for building a second round of assistance in a more targeted way."

Though the administration has not yet released detailed data on the PPP's effectiveness, the Treasury Department and the Small Business Administration, as well as many economists, credit it with saving millions of jobs. Borrowers snapped up the first $349 billion Congress approved just 13 days after the program's April 3 launch.

Two months after a second, $310 billion round launched, more than a third of that money remains available despite record-high unemployment, more than 100,000 small-business closures and growing projections that the ill economic effects of the pandemic will extend through next year. Interest in the program was tempered in recent weeks as many companies opted against taking on additional debt as the rules of the program kept changing.

Borrowing from the program has slowed to a trickle despite Congress and officials at the Treasury Department and the SBA repeatedly loosening the rules to allow more companies to receive funds and making it easier for borrowers to have the loans forgiven and turned into grants, as most are.

Jonathan Miller, an accountant in Tucson, Ariz., said he got a PPP loan to cover eight weeks of payroll while his company's five employees worked from home. He said the extra funding was critical to maintaining economic stability during a period when his clients - including doctors and other sole proprietors - were in a state of economic turmoil.

But now that his business is past the initial shock of the economic downturn, his biggest problem is that some of his clients are going out of business. He said he is worried about how to prepare for yet another downturn, with spiking coronavirus cases in his state potentially leading to more closures.

"I think they're going to have to do something else as far as economic stimulus, because there's still a lot of uncertainty as far as what happens next," Miller said. "We need to have the systems in place so that small businesses can continue to stay open."

A major change between the PPP and Rubio's new proposal would be a further expansion of allowable expenditures, something the hotel industry has been pushing for since early in the pandemic.

Because travel was one of the earliest industries hit by the pandemic and is expected to be one of the last to recover, the PPP's focus on bolstering payroll expenses for an initial eight-week period (a time frame that was later extended) is not likely to help hotel owners who are struggling to pay their mortgage and utilities. Many hotel owners do not know when they will be operating at full capacity again.

Of 2.3 million people who worked at hotels before the pandemic, an estimated 60 percent remain unemployed, Chip Rogers, president of the American Hotel and Lodging Association, said in a statement. He said a full recovery is not expected before 2023.

"We want to get them all back to work, but with travel not expected to recover quickly, additional stimulus is imperative to keep the majority of mom and pop small businesses afloat," he said.

Members of Congress plan to consider new coronavirus responses when they return to work from a two-week recess beginning next week, despite pleas from Democratic leaders that negotiations begin more quickly. Asked Monday how close he was to a deal with Democrats on creating the new programs, Rubio said: "I'd say we're close on a lot of the details, but like always the ones that are left open are probably the hardest ones to confront. But conceptually the answer is yes."