Chipotle (NYSE:CMG) has suffered because of a series of E. coli outbreaks that began in July 2015, but these outbreaks really hurt the company in the fourth quarter of that year.

The biggest piece of that scandal took place in October, when 52 people got sick in restaurants across nine states. That news kept consumers from visiting Chipotle, and sales plummeted. It was a devastating blow to the company because the food safety issue challenged its core premise that it offered better food than its rivals.

Even though the chain responded aggressively to the problems -- including closing stores for an afternoon of training -- customers punished the chain by staying away. Comparable sales for 2016 tumbled 20.4%, while overall revenue fell 13.3%. In addition, the E. coli outbreak sent the company's share price dramatically in the wrong direction, from approaching $750 in July 2015 to under $380 at the end of 2016.

It has been a brutal ride for the company, and customers stayed away much longer than they have in similar situations with other chains. The tide has turned, however, and while the recovery may take years to fully take hold, it's going to happen, so shareholders have nothing to worry about.

A line at a Chipotle store

Customers have started to come back to Chipotle. Image source: Chipotle.

Is Chipotle making a comeback?

Eventually the cream rises to the top. The E. coli issues did not change the fact that Chipotle offers high-end, fresh food at fast-casual prices. It has taken a while, but the company showed signs that its turnaround had taken hold in the first quarter of 2017.

For the quarter, revenue jumped 28.1% year over year to $1.07 billion. In addition, comparable-store sales rose by 17.8%, and net income came in at $46.1 million, up from a net loss of $26.4 million. That translates to earnings of $1.60 per diluted share, an improvement from a diluted net loss per share of $0.88 in Q1 2016. On top of all that, Chipotle also opened 57 new restaurants during the quarter.

"By simplifying the focus in our restaurants to only those elements that lead to a great guest experience, our operations have improved every single month, which gives us confidence that we are on our way to achieve our mission to ensure that great food made with whole unprocessed ingredients is accessible to everyone," said CEO Steve Ells in the earnings release

CMG Chart

CMG data by YCharts.

It's going to be a long road

While it has taken a long time, it appears that consumers have begun to forgive Chipotle. The Q1 results look especially good because they come a year after the company had a disastrous quarter. That should be the case for all of 2017 as the chain deals with favorable comps.

Still, even though 2017's results will look better as compared to a bad year, they also show that the chain is back on the right path. The company predicts that comparable sales for the year will rise by the high-single digits, and perhaps most importantly, it has plans to open 195 to 210 new restaurants.

As you can see from the chart above, Chipotle's stock has begun its recovery, but it still has a long way to go. There may be bumps in the road, but because the company offers such a strong product, it should eventually get there. This recovery has taken investor patience, and it's going to take more, but Chipotle has shown that it can eventually move through it.

Daniel Kline has no position in any stocks mentioned. The Motley Fool owns shares of and recommends Chipotle Mexican Grill. The Motley Fool has a disclosure policy.