WeWork is set to become a smaller—and potentially rightsized—company. Following a final hearing on its bankruptcy plan Thursday morning, the coworking pioneer will have fewer locations, a new influx of capital, and $4 billion in debt wiped from its books.

In a packed courtroom in Newark, New Jersey, Judge John Sherwood approved WeWork’s restructuring plan. WeWork expects to finally exit bankruptcy in mid-June. The plan also staved off a bid by WeWork’s controversial founder Adam Neumann, who had sought to buy back the company he’d founded before he was infamously ousted.

WeWork’s clean slate will coincide with a new era of working, one in which office workers have pushed back against returning to offices full-time; as of late 2023, nearly 20 percent of office space in the US sat vacant. Yet workers are also experiencing more loneliness, a problem that coworking companies argue they can address by bringing people together. WeWork’s reboot is a test of the future of coworking itself.

“WeWork still believes that this is a viable business model,” says Sarah Foss, global head of legal and restructuring at Debtwire, a financial services company. “They’re exiting a much leaner company.”

WeWork filed for bankruptcy in November. Hammered by high interest rates and the Covid-19 pandemic, which started a work-from-home phenomenon, it was left with too many leases and too many hot desks and flexible office spaces it couldn’t fill. In 2023, lease costs made up two-thirds of its operating expenses.

WeWork had more than 500 global locations before it filed for bankruptcy, and will operate about 330 WeWorks going forward, about half of which will be in the US and Canada. That will save WeWork about $12 billion in rent obligations, cutting its rent costs in half, according to the company’s estimates. WeWork’s plan comes from amending or assuming many leases, and rejecting or negotiating to exit some 150 others. It prioritized reducing its footprint in areas where it had oversupply, either from occupying too many floors in the same building or having multiple locations in close proximity.

Many of these changes come as part of its Chapter 11 bankruptcy filings, but locations outside of the US and Canada are not part of that bundle. In other countries, WeWork has worked with landlords to renegotiate some of its leases, including those in Singapore, Kuala Lumpur, Bangkok, Ho Chi Minh City, Jakarta, Manila, and Paris.

WeWork went to hundreds of landlords during the process to negotiate new lease terms or exits from buildings. Bankruptcy allows companies to renegotiate and reject leases outright, but the market conditions that now plague office landlords primed WeWork with advantages to negotiate better terms to stay in place. “They have all the leverage, knowing that we’re in a terrible time for landlords,” says Eric Haber, counsel at Wharton Property Advisors, a New York City office-leasing advisory firm. Now, a slimmer WeWork has a “streamlined configuration where they hope they can make money, but they have very optimistic projections,” Haber says. “Even with this much better setup, they still have to execute.”

Part of WeWork’s restructuring also sought to convert dozens of its office leases to revenue-sharing agreements, which carry less risk for WeWork. These models are used by other coworking companies, like WeWork’s competitor, Industrious. “Some of the early criticism of WeWork was that it was taking all of the risk,” says Peter Greenspan, global head of real estate at WeWork. But going forward, “we may not be willing to take all that risk,” he says: That means WeWork will likely have a mix of leases, management agreements, and revenue sharing agreements at its locations.

The coworking giant rose to a $47 billion valuation by leasing and then subleasing office space at a rapid rate, but that valuation unraveled ahead of its infamous first push to go public. The bankruptcy plan involves $400 million in new financing, and will make Yardi Systems, a real estate software company, WeWork’s majority owner as it becomes a private company again.

Neumann had sought to buy WeWork after it declared bankruptcy, offering $650 million. Neumann has spent the past few years working on Flow, a residential real estate company that leases apartments in Florida with a focus on vertically integrating the building’s services and tech (in other words, using an app for residents to connect with one another and manage their living experiences). He has said that WeWork and Flow could join together as partners—or become competitors. Just two days before the final vote, Neumann dropped his bid to buy back WeWork, but called the company’s bankruptcy plan “unrealistic and unlikely to succeed.”

Greenspan says he doesn’t see WeWork’s numbers as unrealistic under its new rightsized model. Its brand will remain in 120 cities across 37 countries going forward. And despite the questionable future of commercial downtown offices, WeWork is arguing that its time to shine has arrived. “The need for flexible space—flexible conference rooms, enterprise flexible space, all the way down to single-member flexible space—will increase,” Greenspan says.

Uncertainties linger in the office rental market. But the new and slimmer WeWork may be the right testing ground to see whether flexibility really is the answer to the future of working.