After a months-long bidding process and many layoffs, Yahoo has finally found a buyer. Verizon (which owns AOL, which owns TechCrunch) is officially acquiring Yahoo’s core business for $4.83 billion in cash, which includes Yahoo’s advertising, content, search and mobile activities.

“Just over a year ago we acquired AOL to enhance our strategy of providing a cross-screen connection for consumers, creators and advertisers,” Verizon Chairman and CEO Lowell McAdam said in the release. “The acquisition of Yahoo will put Verizon in a highly competitive position as a top global mobile media company, and help accelerate our revenue stream in digital advertising.”

Yahoo’s stakes in Alibaba and Yahoo Japan aren’t part of the acquisition. These stakes are worth tens of billions of dollars alone. As of Friday July 22nd, Yahoo’s 15 percent stake of Alibaba represented $31.2 billion, and its 34 percent of Yahoo Japan was worth $8.3 billion. Yahoo’s patent portfolio, which is worth around $1 billion, isn’t part of the sale either. Yahoo’s Sunnyvale headquarters are part of the acquisition, a source told TechCrunch.

Yahoo will be integrated with AOL, and Verizon EVP and President of the Product Innovation and New Businesses organization Marni Walden is going to lead the process. AOL CEO Tim Armstrong also mentions Marissa Mayer in his memo though. “For me personally, I’m planning to stay. I love Yahoo, and I believe in all of you. It’s important to me to see Yahoo into its next chapter,” Mayer wrote in an internal Yahoo memo. The transaction is expected to close in Q1 2017.

“Yahoo is a company that has changed the world, and will continue to do so through this combination with Verizon and AOL. The sale of our operating business, which effectively separates our Asian asset equity stakes, is an important step in our plan to unlock shareholder value for Yahoo,” Marissa Mayer said in the release. “This transaction also sets up a great opportunity for Yahoo to build further distribution and accelerate our work in mobile, video, native advertising and social. Yahoo and AOL popularized the Internet, email, search and real-time media. It’s poetic to be joining forces with AOL and Verizon as we enter our next chapter focused on achieving scale on mobile. We have a terrific, loyal, experienced and quality team, and I couldn’t be prouder of our achievements to date, including building our new lines of business to $1.6 billion in GAAP revenue in 2015. I’m excited to extend our momentum through this transaction.”

Last year, Verizon acquired AOL for $4.4 billion to boost its media and advertising businesses. Verizon remains a giant telecom company, but the acquisitions of AOL and now Yahoo show that the company wants to diversify its revenue and operations.

Once the deal closes, Verizon wants to merge Yahoo and AOL to form a bigger advertising and media subsidiary. This way, AOL gets more scale and reaches enough internet and mobile users to become an advertising giant reaching hundreds of millions or even billions of people.

As we noted last week when reports emerged that a deal was imminent, AOL has been preparing for this integration process for months already. It will be a sizeable integration process, and the company seems to want to hit the ground running when it comes to combining the two teams.

Eventually, Verizon wants to compete with Google and Facebook when it comes to advertising. Online advertising is currently dominated by the two Silicon Valley-based companies. Verizon wants to become the third way.

This isn’t the first time a telecom company has been looking at ways to provide and operate more than dumb pipes for computers and phones — Verizon now wants to control what’s going through these pipes. And the company is investing a lot of money in this venture.

“Our mission at AOL is to build brands people love, and we will continue to invest in and grow them. Yahoo has been a long-time investor in premium content and created some of the most beloved consumer brands in key categories like sports, news and finance,” AOL CEO Tim Armstrong said in the release. “We have enormous respect for what Yahoo has accomplished: this transaction is about unleashing Yahoo’s full potential, building upon our collective synergies, and strengthening and accelerating that growth. Combining Verizon, AOL and Yahoo will create a new powerful competitive rival in mobile media, and an open, scaled alternative offering for advertisers and publishers.”

Verizon now faces two challenges if the acquisition is approved by the regulator. First, the integration process will be tough. In its most recent earnings call, Yahoo said that its headcount stands at 8,800 employees and 700 contractors — by comparison, AOL has 6,800 employees. So merging two big teams with thousands of employees will be no small feat for everyone involved. Second, Yahoo has been losing quite a bit of money. Verizon will need to turn Yahoo into a money-making, profitable company otherwise it’s going to hurt AOL’s bottom line.

In the official announcement, Verizon named a few reasons that justified an acquisition. Yahoo has a global audience of more than 1 billion users, including 600 million on mobile. The company also owns premium brands in finance, news and sports. Yahoo Mail has 225 million monthly active users. And when it comes to advertising technology and analytics, Verizon named Brightroll, Flurry and Gemini. Interestingly, Verizon didn’t mention Tumblr.

In February and after years of turmoil, Yahoo officially announced that it was exploring acquisition offers. A month later, activist investor Starboard wrote a controversial letter saying that the entire board should be replaced and both the board and the management team were dragging their feet on the acquisition process.

Between the lines, you could see that Starboard wanted to sell Yahoo as quickly as possible and maximize the acquisition price. But Yahoo CEO Marissa Mayer kept giving interviews and saying that she could turn the company around in five to seven years.

When Marissa Mayer joined Yahoo in July 2012, she had big plans to make Yahoo relevant again. She doubled down on mobile, made dozens of acqui-hires, acquired Tumblr for $1.1 billion, acquired Brightroll for $640 million and revamped key products, such as Yahoo Mail, Flickr, Yahoo Weather and Yahoo Messenger.

But all of these changes didn’t really boost the company’s bottom line, leading to today’s acquisition.

While Verizon has been the most likely buyer from day one, other potential buyers included AT&T, a private equity group led by TPG, and an investor group led by Dan Gilbert of Quicken Loans. Verizon will hold a call in a little bit more than an hour with more details about the transaction. Verizon’s stock is flat (+0.21 percent) in pre-market trading following the news. The deal started leaking on Friday and shareholders anticipated today’s announcement.