Uber Technologies Inc will pay $245 million worth of its own shares to Alphabet Inc’s Waymo self-driving vehicle unit to settle a legal dispute over trade secrets, allowing Uber’s new chief executive to move past one of the company’s most bruising public controversies.

The settlement announcement on Friday was made just before the fifth day of testimony was about to begin at a jury trial in San Francisco federal court.

Waymo sued Uber last year, claiming one of its former engineers who became chief of Uber’s self-driving car project took with him thousands of confidential documents. Uber fired the engineer after Waymo sued.

The two companies are battling for supremacy in one of the most lucrative races in Silicon Valley – to create fleets of self-driving cars.

The settlement allows Uber CEO Dara Khosrowshahi to put another scandal behind the company and move ahead with development of self-driving technology after the tumultuous leadership of the firm by former CEO Travis Kalanick, who testified at the trial on Tuesday and Wednesday.

As part of the deal, Uber agreed to pay equity valued at about $245 million, a Waymo representative said. The settlement also includes an agreement “to ensure that any Waymo confidential information is not being incorporated in Uber Advanced Technologies Group hardware and software,” a Waymo representative said.

In settlement talks last year, Waymo had sought at least $1 billion from Uber, and wanted an independent monitor to ensure Uber does not use Waymo technology in the future, Reuters reported. Waymo also asked for an apology.

Instead, Khosrowshahi expressed “regret” for the company’s actions in a statement on Friday.

“While we do not believe that any trade secrets made their way from Waymo to Uber, nor do we believe that Uber has used any of Waymo’s proprietary information in its self-driving technology, we are taking steps with Waymo to ensure our Lidar and software represents just our good work,” Khosrowshahi said in a statement.

Neither company offered details on what those steps will entail.

Waymo’s lawsuit said that one of the company’s former engineers, Anthony Levandowski, downloaded more than 14,000 confidential files containing designs for autonomous vehicles in December 2015 before he went on to work at Uber in 2016.

The case had hinged on whether Uber used the trade secrets to further its autonomous vehicle program.

The U.S. Department of Justice is conducting a separate, criminal investigation into the trade secrets. Levandowski has never publicly addressed the allegations of taking the documents and law enforcement has not charged anyone with their theft. Levandowski was not a defendant in the case.

Series of Problems at Uber

The Waymo lawsuit was the most pressing legal battle for Uber but only one item in a long list of controversies that have dogged the company for the last year.

Public accusations of sexual harassment and a toxic workplace prompted an internal investigation at Uber that resulted in more than 20 people being fired, while the company faces multiple federal criminal probes, including an investigation into its use of software to evade regulators, its handling of the medical records of a victim raped by an Uber driver in India and possible bribes paid overseas.

The company has also experienced turmoil at the top with the ousting of Kalanick in June, the departure of several top-level executives and a bitter board dispute.

The settlement increases Alphabet’s stake in Uber from an initial investment of $258 million in 2013, which was at the time Uber’s largest fundraising round.

Uber has gone on to raise more than $14 billion in new funding and last month closed a deal with SoftBank Group Corp , in which the Japanese conglomerate, along with other investors, took at 17.5 percent stake in the company. Uber is now valued at about $54 billion.

The deal was an opportunity for early investors and employees to cash in their shares and gave lossmaking Uber a much-needed financial boost.

Autonomous cars offer a multi-billion-dollar opportunity to remake transportation, and companies including Apple Inc , General Motors Co, Ford Motor Co, Volkswagen AG and scores of startups are competing to develop the technology.

In Kalanick’s second day of trial testimony, Waymo sought to portray him as so eager to improve Uber’s lagging autonomous car business that he did a deal with Levandowski without properly assessing the risks. (Additional reporting by Heather Somerville.)