After much news, Toshiba Corp. has finally signed the deal to sell its flash memory chip business to a group led by Bain Capital. The deal is worth close to about 2 trillion yen ($18 billion). The deal comes through after months of contentious negotiations.

The Bain group includes some of the major technology players. The names associated with Bain group are Apple Inc., Dell Inc., SK Hynix Inc. and Japan’s Hoya Corp. According to reports, Toshiba will maintain a stake in the company after the deal. The financial aspects of the deal may change depending on capital expenditures. The deal is to keep Toshiba in command of its business in Japan while also repairing its damaged balance sheets.

The deal has come through after fierce negotiations between Toshiba and Western Digital Corp. The Western Digital Corp is Toshiba’s partner in the chip business who claimed to have a veto power in case any sale was on the cards. Though Toshiba denies that its US partner has any such rights, Western Digital has however vowed to fight the sale to Bain through arbitration filings in the U.S.

The deal has been under the heat ever since day one. The Bain group called for a press conference at the dazzling Palace Hotel in Tokyo but canceled it before media arrived. Bain’s Japan unit chief, however, explained that the press conference or any such event hasn’t been called off. The event may take place in the near future.

Toshiba is facing intense scrutiny to raise money by March 2018. The company had lost billions of dollars in its US nuclear business. The company saw its shares being lifted off from the Tokyo Stock Exchange. The agreement signing is just a step towards completing the deal after it was stalled in January this year. Bain was selected as the bidder but the deal could not be done as Innovation Network Corp. of Japan and Development Bank of Japan did not support the deal owing to Western Digital’s threats. Apple played a crucial role by providing the financial support and making the deal successful. Apple is reportedly investing a massive 165 billion yen in Toshiba as part of the deal. The company will get an equity stake as part of the deal.

Toshiba will provide 350.5 billion yen while Bain will invest 212 billion yen and 27 billion yen will come from Hoya as part of the deal. Hynix is reportedly investing 395 billion yen, while U.S. investors will add another 415.5 billion yen. Pangea will play the role of the special purpose entity by securing loans of about 600 billion yen. As part of the agreement, Japan’s Toshiba and Hoya will hold a majority of Pangea’s stock.