Boeing is replacing the head of its commercial-airplanes division as it struggles with a crisis created by two deadly crashes of its newest airliner.

Boeing said Tuesday that Kevin McAllister is out as chief executive of Boeing Commercial Airplanes. He is being replaced by Stanley Deal, leader of Boeing’s services division.

The shake-up in Boeing’s top ranks comes just days after the release of internal communications that showed a senior test pilot experienced serious problems while testing flight-control software for the 737 Max on a simulator.

That software, called MCAS, is at the centre of investigations into two crashes that killed 346 people and led to grounding of the Max. Boeing is taking much longer than executives expected to change the software and get the plane flying again.

Boeing announced two other promotions, including a replacement for Deal, who has led Boeing Global Services since the division was created in 2016.

McAllister was recruited from General Electric Co.’s jet-engine operation to run Boeing’s biggest division in 2016, just months before the 737 Max went into service. Boeing did not specify whether he quit or was fired.

“The Boeing board fully supports these leadership moves,” Chairman David Calhoun said in a prepared statement.

Calhoun himself is new in his position. CEO Dennis Muilenburg also served as company chairman until the board stripped him of that job and elevated Calhoun two weeks ago.

In a statement, Muilenburg thanked McAllister for his service “during a challenging time, and for his commitment to support this transition.”

Boeing took a $5.6 billion pretax charge this summer to cover its estimate for compensating airlines that have cancelled thousands of flights because of grounded planes. It has disclosed nearly $3 billion in other additional costs related to the grounding.

The company faces dozens of lawsuits by families of passengers killed in the Max crashes in Indonesia and Ethiopia. It is also the subject of investigations by the Justice Department and Congress.

Chicago-based Boeing Co. is scheduled to report its latest financial results on Wednesday.