United Parcel Service (UPS) delivered better-than-expected first-quarter earnings on Tuesday, but the positive results were accompanied by a stark announcement: the company plans to cut up to 20,000 jobs and close dozens of facilities in response to a slowdown in Amazon deliveries and broader economic uncertainty.

The restructuring effort is part of a larger strategy to streamline operations and shift focus toward more profitable logistics services.

The company’s shares rose 2.2% in pre-market trading following the earnings report and restructuring news.

UPS said the changes could generate $3.5 billion in cost savings by 2025, as it aggressively reduces its exposure to low-margin e-commerce shipments.