Shares of General Motors Co. on Monday ended at their highest in three months after the car maker announced a sweeping cost-cutting plan that includes trimming its vehicle lineup in the U.S., closing U.S. and overseas plants, and layoffs.

GM GM, -0.37% stock, briefly halted ahead of the announcement, jumped past 7% before closing 4.8% higher and at its best since Aug. 27.

GM will cut salaried and salaried contract staff by 15%, including 25% fewer executives to “streamline decision making,” the company said.

The company will funnel more resources to electric and autonomous vehicles, and expects that more than 75% of its global sales volume will come from five vehicle architectures by early next decade.

“The actions we are taking today continue our transformation to be highly agile, resilient and profitable, while giving us the flexibility to invest in the future,” GM Chief Executive Mary Barra said in a statement. “These actions will increase the long-term profit and cash generation potential of the company and improve resilience through the cycle.”

See also: GM’s Barra to meet Trump adviser Kudlow after job-cut announcement

The plan is expected to increase the company’s free cash flow from autos by $6 billion by 2020, via cost reductions of around $4.5 billion and lower capital spending.

Unlike in the past, GM is trying to get ahead of a potential crisis by making cuts now, said Michelle Krebs, an analyst with Autotrader.

The move is being prompted by a downturn in the Chinese market as well as a potential downturn in the North American market, a consumer shift to SUVs from sedans, and the impact of tariffs and trade issues, Krebs said.

“GM is actually a tad late to adjusting its product line and production capacity to the dramatic car-to-utility shift,” she said. “(Ford Motor Co.) and (Fiat Chrysler Automobiles NV) already revealed their plans to largely abandon traditional cars. We had expected GM to follow suit, especially in light of 2019’s labor talks with the UAW.”

Related: Alphabet’s Waymo first to test driverless cars in California without human drivers

GM had reportedly began offering buyouts to salaried employees last month, so the announcement was “not a total surprise,” analysts at CFRA said in a note Monday.

The analysts raised their price target on GM stock to $40 from $38, representing 6% upside to Monday’s prices. Wall Street on average has a $44.80 price target on GM shares, according to FactSet.

GM “is already further along with respect to ongoing restructuring efforts relative to peers, but this signals more cost burdens still remain,” analysts at Consumer Edge said in a note.

GM is “perhaps the best positioned” global car maker at the moment, with “dominant market share” in the highest margin internal-combustion car segment in addition to being an industry leader in driverless cars, the Consumer Edge analysts said.

Ford F, -2.25% has embarked on its own turnaround plan, saying earlier this year it was all but pulling out of sedans in North America.

GM said it expects pretax charges of between $3 billion and $3.8 billion related to restructuring, including up to $1.8 billion in write-downs and pension charges, and up to $2 billion in severance pay and other cash expenses. Most charges will be booked in the fourth quarter of 2018 and first quarter of 2019, with some additional costs to be incurred through the remainder of 2019, the company said.

Plants to be shut down include locations in Maryland, Michigan and Ohio as well as in Ontario, Canada, along with two unnamed plants outside North America. Shutdowns are expected to be completed by the end of next year.

U.S. politicians on both sides of the aisle criticized the move, and the UAW called the decision to close the U.S. plants and lay off workers “callous” and one that “will not go unchallenged.”

See also: Lawmakers blast GM over plans to cut jobs, close plants

President Donald Trump said he was not “happy” about GM’s and Barra’s decision and in separate comments to The Wall Street Journal said he urged Barra to open another plant in Ohio to make up for plant closures.