Behind the Krispy Kreme turnaround

June 27, 2013, 4:23 PM UTC

FORTUNE — It was only after three years of year-over-year revenue and gross profit growth, 18 consecutive quarters of same-store sales increases, and an eight-year high on the stock that Krispy Kreme Doughnut’s (KKD) executives finally turned to one another and acknowledged that they had turned the company around.

The hesitant optimism at the doughnut enterprise, best known for its Original Glazed doughnut, is understandable. Krispy Kreme had been a growth company before — until it imploded in the mid-2000s. Profits tumbled after the company grew too quickly, and an SEC investigation of its accounting practices led to high-level departures.

A previous unsuccessful turnaround attempt led to talk of having to sell the chain. “It was just a constant turmoil of, ‘Is the company going to make it?’” says CFO Doug Muir.

MORE: Why the Supreme Court is wrong on generic drugs

Krispy Kreme’s anxious past has informed the company’s current strategy, which has been predicated on slowly repairing the business and building a foundation that protects against future blowups.

“That’s a big perception and fear out there on the part of the public,” says CEO Jim Morgan. “We’ve learned an awful lot from the past. From day one, we told shareholders, ‘We are not the place to be if what you want is sudden fortune.’” Morgan, who became CEO in 2008, witnessed the turmoil first-hand as a board member since 2000.

The company just committed to a U.S. expansion effort for the first time in a decade. “People thought we were gun-shy, too cautious,” Muir explains. “We said, ‘When we’re ready. We’re not gun-shy. We’re prudent. We watched this thing blow up last time.’”

International growth helped carry Krispy Kreme as management rebuilt its U.S. market. The doughnut chain now has 532 stores in 21 countries outside the U.S., in addition to its 241 U.S. stores. Saudi Arabia and Mexico are its biggest markets by store count after the U.S.

In the U.S., Krispy Kreme refurbished its stores and rethought its model for new locations. The original Krispy Kremes had retail in the front, manufacturing in the middle, and a loading dock in the back to deliver to the wholesale market — think big-box and convenience stores. The stores, some of which were 5,000 to 6,000 square feet, made sense during the Krispy Kreme craze, when opening weeks brought in $200,000 in retail and wholesale was a bigger part of the business. (A Krispy Kreme factory store typically does $35,000 a week in sales, excluding wholesale.)

The new store format, of which there will be seven by the end of the year, will have smaller footprints of around 2,300 square feet. They’ll be retail only, no wholesale component, which will allow managers to run a simpler operation that focuses on the consumer.

With less than 300 stores in the U.S., Krispy Kreme is more of a destination concept than one of convenience. But smaller stores with lower overhead will make it easier to open new locations, making the brand more accessible to its customers. The company is also looking into special venues — serving transportation hubs, such as its only New York City location in Penn Station, or sporting arenas like its spot in the Bank of America Stadium in Charlotte, N.C., CEO Morgan’s hometown.

MORE: 5 steps to find (and keep) young stars

As a result of the new, retail-only store approach, wholesale is shrinking as a percentage of Krispy Kreme’s total business. The company eventually wants to come up with a longer shelf-life product for the wholesale market. Its Original Glazed doughnuts are, at best, good for 48 hours, which isn’t conducive to a long supply chain.

Beyond store format, the company still has a long to-do list. Muir and the marketing team are working on getting the technology in place to support a loyalty card program. Rather than rolling out new menu options, which the company says it will do eventually, it’s trying to focus on giving people more reasons to eat doughnuts — or “creating more doughnut occasions,” as Morgan likes to say.

Krispy Kreme is also pushing into beverages with a revamped coffee line. “We’re never going to be Starbucks or Dunkin’ or McDonald’s in terms of how powerful beverage can be,” Morgan said, but he would like to take beverages from 12% of the business to 20%.

The one thing Morgan and his cohort didn’t have to fix? The doughnuts. “We inherited an incredible brand,” he says.