(Reuters) - Verizon Communications Inc VZ.N said on Tuesday it would buy Yahoo Inc's YHOO.O core business for $4.48 billion, lowering its original offer by $350 million in the wake of two massive cyber attacks at the internet company.

The closing of the deal, which was first announced in July, had been delayed as the companies assessed the fallout from two data breaches that Yahoo disclosed last year. The No. 1 U.S. wireless carrier had been trying to persuade Yahoo to amend the terms of the agreement following the attacks.

Verizon and Yahoo signed the deal on Sunday evening after weeks of talks that included calls with Yahoo CEO Marissa Mayer and a meeting between Verizon CEO Lowell McAdam and Yahoo director Tom McInerney in New York earlier this month to agree on the amount of the price reduction, a person involved in the talks said.

The two sides had an agreement in principle about a week earlier that included a liability sharing agreement, something that Verizon decided early on that it needed to reach a deal.

Verizon conducted brand studies and found that Yahoo’s reputation was holding up after the hacks, the person said. The company decided to proceed in part because it continued to believe that the deal made strategic sense and that users were loyal and engaged.

The companies said on Tuesday they expect the deal to close in the second quarter. The data breach may delay some integration of Yahoo with Verizon after the closing, the person said.

The deal brings to Verizon Yahoo’s more than 1 billion users and a wealth of data it can use to offer more targeted advertising. Verizon will combine Yahoo’s advertising technology tools as well as its search, email and messenger assets with its AOL unit, purchased for $4.4 billion in 2015.

Verizon’s shares rose 0.3 percent to $49.33 in afternoon trading, while Yahoo’s shares were up 0.8 percent at $45.48.

Under the amended terms, Yahoo and Verizon will split cash liabilities related to some government investigations and third-party litigation related to the breaches.

Yahoo, however, will continue to be responsible for liabilities from shareholder lawsuits and SEC investigations.

Yahoo said in December that data from more than 1 billion user accounts was compromised in August 2013, making it the largest breach in history.

This followed the company’s disclosure in September that at least 500 million accounts were affected in another breach in 2014.