At a time when the stock market has been setting records, are there any bargains left? There are—in companies that have run into big problems but are ripe for a turnaround in both their businesses and their stock prices. Here are three of the best turnaround prospects now, all of which have seen a slowdown in earnings growth…

Brookdale Senior Living (BKD), which operates 1,114 independent-living and assisted-living communities in 47 states, has struggled to effectively integrate facilities from an acquisition that doubled its size in 2014. But by 2017, it will give Brookdale a major profit boost, especially as Brookdale becomes the increasingly dominant player in a rapidly growing industry that is largely fragmented with small, local operators. Recent share price: $18.02.

Macy’s (M), which operates about 870 Macy’s and Bloomingdale’s stores, has seen its earnings plunge in the past year in the face of rising competition from online retailers. But new CEO Jeff Gennette is putting greater stress on categories that are most resistant to online competition, such as makeup, jewelry and private-label clothing. And Macy’s is considering spinning off its real estate holdings, with an estimated value of $10 billion to $21 billion. Recent share price: $35.87.

Staples (SPLS) saw its stock price plunge this year after a federal court blocked its merger with Office Depot on antitrust grounds. But the nation’s largest office-supply retailer still has many ways to grow its business. It already is the fourth-largest Internet retailer in the US (behind Amazon, Wal-Mart and Apple). And it is rolling out new services such as same-day delivery. Recent share price: $9.23.