A US bankruptcy judge on Thursday approved WeWork’s Chapter 11 bankruptcy plan, allowing the shared office space provider to eliminate $4 billion in debt and hand the company’s equity over to a group of lenders and real estate technology company Yardi Systems.

Flexible workspace provider WeWork expanded at breakneck speed butracked up steep losseson its over-extended real estate portfolio before filing for bankruptcy protection in November 2023.

US Bankruptcy Judge John Sherwood approved WeWork’s restructuring at a court hearing in Newark, NJ. With that approval secured, WeWork will be ready to exit from bankruptcy with no debt “in a matter of days,” WeWork attorney Steven Serajeddini said at the hearing.

WeWork used its bankruptcy to negotiate a significantreduction in future rent costsfrom its landlords and cancel leases at about one-third of its locations, ultimately reducing its future rent costs by more than $12 billion. WeWork expects to operate 337 shared office spaces after its bankruptcy, with more than 170 locations in the US and Canada.

“Due to the tireless efforts of our team, and the unwavering loyalty of so many of our members, we have completed our Chapter 11 proceedings with success well beyond our initial expectations,” WeWork CEO David Tolley said Thursday.

WeWorkrejected an alternate buyout proposal offered by its co-founder and ex-CEO Adam Neumann. The company said Neumann didn’t offer a high enough price to win overWeWork’s lenders, who preferred to take an equity stake as part of the bankruptcy deal.

WeWork’s restructuring will cancel existing equity shares, but top shareholder SoftBank will retain a minority equity stake on account of loans it provided to WeWork. The company, once valued at $47 billion, estimates that its post-bankruptcy equity is worth about $750 million.