Tim Cook had big shoes to fill when he took the reins as Apple Inc.’s chief executive from company co-founder Steve Jobs five years ago. That role has exposed him to intense scrutiny, with particular emphasis placed on the ways in which he has or has not stacked up against Jobs, whose legacy product, the iPhone, remains Apple’s best-selling offering.

The stock has more than doubled on a split-adjusted basis since Cook took the job in August 2011. Apple AAPL, +3.03% surpassed Exxon Mobil Corp. XOM, -2.04% by market valuation on his watch, making it the most valuable publicly traded company in the U.S.

Some analysts say Cook’s legacy will be determined not by what has happened since Jobs’s death but by what Cook does over the next five years to keep the company fresh in the face of a number of challenges, including a smartphone market that has become commoditized, slowing industry growth and the emergence of low-end rivals in emerging markets, which has weighed on the pace of Apple’s global expansion.

Apple customarily doesn’t comment on future products, but Cook has said Apple is investing in augmented reality, which he’s deemed a huge commercial opportunity. Unconfirmed reports, meanwhile, have indicated Apple is secretly developing a smart car.

For now, though, here’s a look back at five things Cook has—in some cases, arguably—done right so far:

Returning cash to shareholders. Steve Jobs wasn’t a big fan of capital-return programs. But since the beginning of 2012, Apple has repurchased roughly $127 billion in shares, according to securities filings, and issued $44.8 billion in dividends.

In April of this year, Apple’s board of directors increased its buyback authorization to $175 billion from $140 billion, increasing the total size of the program to $250 billion. The board also raised Apple’s dividend by 10% to 57 cents a share.

Activist investor Carl Icahn played a significant role in this capital-return surge, calling in 2013 for the company to launch a buyback program worth $150 billion—after the billionaire investor had scooped up more than $2 billion in Apple shares. On CNBC earlier this year, Icahn said Cook has done a “good job,” even though he sold his entire stake in Apple because of his fear that a slowing Chinese economy would weigh on Apple’s growth.

Bringing back the stylus. Cook brought back the stylus in 2015 with the enterprise-grade iPad Pro and the Apple Pencil. Jobs famously had called the digital pencil a signal of failure.

“Who wants a stylus? Yuck—nobody wants a stylus,” Jobs said at the MacWorld event in 2007, where he introduced the iPhone’s multitouch feature.

But a stylus has actually proven helpful in the case of the iPad Pro, which has found a place among professionals, particularly those in creative roles, such as designers, illustrators and architects.

While iPad sales are off sharply from their peak, the iPad Pro helped to keep the product in the game at a time when rival companies such as Alphabet Inc. GOOG, -1.97% GOOGL, -1.44% and Microsoft Corp. MSFT, +1.07% were staking out positions in the enterprise hardware market with tablets, styluses and keyboards.

Squeezing out telecom companies. A year ago, Apple decided to cut out the middleman, launching a new upgrade program and an installment plan that enable consumers to upgrade to new iPhones annually, rather than having to wait out a traditional two-year carrier contract.

Wireless carriers have also distanced themselves from the two-year contract in recent years, but Apple has the added benefit of offering exclusive perks, such as access to AppleCare at no additional cost. The program is seen as helping the company secure upgrades more frequently, as data have indicated upgrade cycles have been lengthening.

Building an Apple music and services empire. AppleCare is just one of many services now in Apple’s arsenal. On the company’s last two quarterly earnings calls with analysts, Cook has touted growth in services, such as Apple Music and AppleCare. Earlier this year, revenue from services surpassed Mac revenue for the first time, becoming, with roughly $6 billion in sales, Apple’s No. 2 source of revenue, behind only the iPhone.

Recording artist Drake speaks about Apple Music during the Apple WWDC in June 2015. Getty Images

Many analysts have called services Apple’s next big revenue driver, particularly as hardware sales continue to be affected by commoditization. Apple’s $3 billion purchase of Beats Music in 2014 helped it get started down this road, leading to the launch of Apple Music last summer. In 2014, Apple launched Apple Pay. It has also expanded its iCloud storage products.

Investing in social causes. Apple has made a big push under Cook to improve its sustainability footprint and invest in social causes, such as gay rights and workforce diversity.

Earlier this year, the company began using robots to mine materials such as gold from recycled products. In 2015, it teamed up with the Conservation Fund to help conserve more than 36,000 acres of forest in the U.S. Its new spaceship-like headquarters is slated to run entirely on clean energy when it opens in 2017, partially due to rooftop solar panels.

In 2014, Cook became the only openly gay CEO of a major U.S. company, at a time when many gay couples were still fighting for the right to legally marry. He has written op-eds weighing in on gay-rights issues and legislation, and he told the Washington Post recently that part of his decision to come out was to help gay kids who might feel isolated or depressed know that they, too, could achieve anything.

Apple—like many of its peers in Silicon Valley, responding to social pressure—has placed greater emphasis on the hiring of women and minorities. In its most recent diversity report, the company said women had made up 37% of new hires in the preceding 12 months, now representing 32% of the total workforce. Minorities accounted for 27% of new hires, though they still make up just 22% of the Apple workforce.