The Spanish green energy giant Abengoa took another big step last week to avoid ending up as the country’s largest bankruptcy, but its fate remains precarious.

The company, which embarked on bankruptcy protection measures in November, says it has reached a tentative agreement with its lenders, giving up a 55% stake in exchange for up to $2 billion in loans.

Creditors would swap 70% of the company’s debt for a 35% equity share, according to the company. The deal—brokered by Abengoa advisers Alvarez & Marsal and Lazard and creditor advisers KPMG and Houlihan Lokey—was approved by Abengoa’s management, but it still needs the lenders’ support.

Last week, Abengoa presented its business plan and restructuring proposal to its lenders, according to a spokesperson at the firm.

The company will need the support of lenders representing at least 75% of the debt and then a confirmation by a commercial court to implement the restructuring plan, according to The Financial Times.

The company has said 40% of its creditors are already aboard, but the rating agency Moody’s has doubts Abengoa can convince the rest before the “very tight” deadline, according to the newspaper. The restructuring plan would almost halve Abengoa’s debt burden, to about $5.5 billion from around $10.5 billion, according to Moody’s.

The company also applied for a “standstill,” which would give it seven months of not having to make prepayments demanded by lenders, Reuters writes.

Meanwhile, the effects of Abengoa's bankruptcy proceedings are being felt at some of the more than 20 countries in which the company has renewable-energy and other power projects. In Nebraska, the company owes close to $20 million to 11 state entities for its Ravenna ethanol plants and has not yet paid close to $1 million in taxes, Kearney Hub reports.

Despite its U.S. bankruptcy court filing last month, Abengoa has not closed its Missouri-based bio-energy headquarters, it told the St. Louis Post-Dispatch.

Abengoa wants to re-focus on its core engineering and construction businesses through its Abeinsa unit, narrow its geographic footprint and divest non-core assets, said the newspaper.

However, all this hasn’t prevented the firm from winning new projects. Last week, the company announced it was awarded construction of two new electric substations and transmission lines in northeast Oman.