Tesla announced Tuesday it planned to lay off up to nine percent of its workforce, a move that could eliminate roughly 3,700 employees. In a company-wide email, chief executive Elon Musk described the decision as “restructuring” and said it would affect only salaried employees – not the factory workers building its next fleet of Model 3 electric cars. “Tesla has grown and evolved rapidly over the past several years, which has resulted in some duplication of roles and some job functions that, while they made sense in the past, are difficult to justify today,” Musk wrote. The cuts come as the company aims to shrink costs and become profitable, Musk said. Analysts have lately argued that Tesla, which has attracted negative headlines for months, had finally turned a corner. Last week, Musk easily overcame an attempt to strip him of his role as chairman of Tesla’s board, a controversial plan introduced by a company shareholder who raised doubts about Musk’s ability to manage multiple companies simultaneously. Afterward an emotional Musk appeared to signal brighter days ahead for the Tesla when he predicted the company would begin pushing out 5,000 Model 3s per week by the end of June. He also predicted Tesla would be profitable in Q3 and Q4. “One of the biggest mistakes we made was trying to automate things that are super easy for a person to do, but super hard for a robot to do,” he said. Tesla has struggled in recent months to resolve nagging production issues surrounding the Model 3 roll-out. Despite glowing reviews and a cult-like following of eager buyers, new Model 3s have trickled out of Tesla’s factories months behind schedule.