Pharmacy chain Rite Aid (RAD) has been an absolute home run thus far in 2013, with the stock up nearly 230% year to date. The company continued its streak of success last Thursday when it released better-than-expected earnings -- convincing the market to send shares up 25% on the day. Almost every time the company reports, it increases its guidance, and management's cost-saving efforts appear to be effective enough to eventually bring margins in line with competitors'. Even with its tremendous run and seemingly pricey valuation multiples, Rite Aid may have significantly more room to run as its efforts continue to pay off. Here's what you need to know.

Earnings recap 
For the fourth consecutive quarter (a good sign given the company's recent history), Rite Aid was in the black -- this time with net income of $32.8 million. The number represents a gain of $71.6 million from the year-ago quarter. Same-store sales ticked up 1%. Though top-line sales are not much to celebrate, the company is earning its keep on generic drugs and aggressive cost savings measures. This has helped drive earnings per share tremendously higher throughout the past year.

Apparently surprising itself again, management upped guidance significantly, with a net income projection of $182 million to $268 million. Prior to the release, management was expecting a midpoint of just $105 million. Adjusted EBITDA is set to be in the range of $1.24 billion to $1.32 billion.

Despite its tremendous run-up, and a forward price-to-earnings ratio of almost 19 times, Rite Aid is not an overbought stock, as many analysts have chimed in after Thursday's bull run. At the low point of EBITDA guidance, the company has an EV/EBITDA of 7.62 times. If the past four quarters are any indication, the company could come in at the high end, or even beyond expectations, lowering the ratio further. For comparison, Walgreen trades at 11.66 times, and CVS at 8.5 times. Both companies enjoy far better profit margins than Rite Aid and a better history of profitability, giving them richer valuations.

Investors should note that in the past year, Rite Aid's margins have gone from nearly two points in the red to a projected 1% for 2013. If they can continue building toward its competitors' 3% to 3.4%, the stock has more than enough room to run significantly higher. Supporting the thesis more is the so-called "patent cliff." Many big-name drugs have been and are expiring their patents, opening up the generic market. Pharmacies have far greater profit margins on generics, and this can only help Rite Aid, and its competitors.

Bottom line 
Rite Aid management has worked some magic at the once-beleaguered 4,500-store chain. And even though the stock has made the bulk of its run, there is still time to bank on the improving margins and coming generic drug boom. Keep an eye out for this ongoing recovery play. It could cure what ails ya.