While much of the U.S. economy has ground to a halt because of the coronavirus outbreak, several dozen workers in orange vests and hard hats were hauling heavy equipment Sunday at a General Motors plant in Kokomo, Ind.

The crew was part of a crash effort to make tens of thousands of ventilators, the lifesaving machines that keep critically ill patients breathing. The machines are in desperate demand as hospitals face the prospect of dire shortages.

President Donald Trump on Friday accused GM and its chief executive, Mary Barra, of dragging their feet on the project and directed his administration to force the company to make ventilators under a 1950s law. But accounts from five people with knowledge of the automaker's plans depict an attempt by GM and its partner, Ventec Life Systems, a small maker of ventilators, to accelerate production of the devices. (Twin City Die Castings in Minneapolis also is a part of the deal.)

On March 19, GM began collaborating with Ventec, which normally makes about 200 machines a month, to figure out how to make about 10 times as many in that time. Working through the weekend of March 21-22, they hurried to find new suppliers that could provide parts in high volumes, said the five people, who asked not to be named because they fear it would further antagonize Trump.

Over the weekend, GM called in workers to clear out the Kokomo plant, which has been idled because of the outbreak, of machinery previously used to make electrical components for cars. Over the next few days, the automaker and Ventec plan to begin setting up an assembly line. GM is already taking applications for the hundreds of jobs. "We continue to work around the clock on our efforts with Ventec," GM said in a statement Sunday night. "We are working as fast as we can to begin production in Kokomo."

"I'm pretty amazed at what they've done," said Kristin Dziczek, vice president for industry and economics at the Center for Automotive Research in Ann Arbor, Mich. "But automotive production involves a massive supply chain, and GM has risen to the occasion on other big manufacturing challenges."

Trump does not see it that way. On Friday, he said on Twitter that Barra and GM had promised to provide 40,000 ventilators "very quickly" but was now telling the administration that it could produce only 6,000 by late April and wanted "top dollar" for the machines. "Always a mess with Mary B," he said.

GM wasn't negotiating price and other details with the government. Ventec has led the talks with the Federal Emergency Management Agency and the Department of Health and Human Services about how many ventilators the government would like to buy, and at what price. The automaker has said it will not make a profit on the ventilators it assembles and is only seeking to cover its costs.

GM's involvement in ventilators began with a phone call asking for help.

This month, Barra was contacted by a representative of Stop the Spread, a nonprofit campaign started by Rachel Romer Carlson, chief executive of Guild Education, and Kenneth Chenault, chairman and managing director at venture capital firm General Catalyst and a former CEO of American Express, four people familiar with the discussion said.

Barra offered to help, they said, and the representative from Stop the Spread suggested the company help Ventec scale up ventilator production.

Ventec isn't a giant in the ventilator industry, but it is known for its VOCSN model, which received FDA approval in 2017. The VOCSN, which is the size of a large toaster oven, combines a number of functions that had previously been performed by several machines. The device is used in critical-care hospital units but also can be used for home care. The day after Barra spoke to Stop the Spread, GM and the other two large U.S. automakers said they would shut down plants until at least March 30.

Early on Friday, March 20, the GM team sat down with Ventec executives to learn how the ventilators are made, and what parts are required.

By last Tuesday, GM and Ventec had the details of their collaboration hammered out.

When Trump lashed out at GM on Friday, executives at both companies were stunned. GM executives were furious Trump would attack the company after it had made so much progress in a week and the administration had earlier been supportive of their effort. (The president on Friday also took aim at Ford.)

"What we've accomplished in five days is incredible," Larryson Foltran, who works in a technology support group at GM, wrote on Facebook.

Ultimately, GM and Ventec executives decided that they would offer no direct response to the president because responding would only invite more criticism from the White House, two people familiar with those discussions said.

At a White House news conference on Sunday, the president struck a different tone. "General Motors is doing a fantastic job," Trump said. "I don't think we have to worry about General Motors now."