In just two years, Rite Aid Corporation's (NYSE:RAD) valuation as a company has increased from $1.2 billion to more than $6 billion today. This epic turnaround is due to three key factors, each of which has been important in taking the company from near bankruptcy to being a legitimate competitor among the largest pharmacies in the U.S.

1. The patent cliff had many effects
Between the years 2011 and 2017, Evaluate Pharma estimates that more than $130 billion in brand drug sales will be lost thanks to expired patent protection and new generic introductions. This has been catastrophic for companies like Pfizer (NYSE:PFE) and Eli Lilly (NYSE:LLY) as blockbusters, such as Lipitor and Cymbalta, must compete with much cheaper drugs.

However, for consumers, insurance companies, and pharmacies the patent cliff has been a big win, lowering the price of drugs. A couple years ago, during the initial phases of the patent cliff, pharmacies begun to experience higher profits. Specifically, CVS Caremark's (NYSE:CVS) CEO Larry Merlo said that "the influx of new generic drugs was a key driver of our year-over-year profit growth across the enterprise" during the company's 2012 conference call. Since then, profits and margins have risen consistently across the pharmacy space.

This is because generic drugs are priced lower and allow for much higher markups compared to brand-name drugs. Historically, brand-name drug manufacturers price drugs near the peak of what insurance companies will pay, which leaves very little opportunity for pharmacies and distributors to profit. However, with generic drugs, there is much more flexibility in pricing.

Also, the purchasing of generic drugs differs from purchasing brand-name drugs. For the most part, brand drugs are purchased in lower quantity, often having to be next-day ordered when the pharmacy is in need, which thereby boosts logistical costs. However, generic drugs, because of the lower price, are bought in bulk, therefore saving money for the pharmacy.

With that said, Walgreen, CVS, and Rite Aid have all seen profits soar during the patent cliff years, but for Rite Aid, the improvement has been drastic. Back in 2011, Rite Aid had an operating margin of negative 2.1%, which means that it lost $2.10 for every $100 in revenue it earned through operations. But during the last 12 months, its operating margin has risen to positive 2.7%, an incredible turnaround.

2. Time for massive change
With Rite Aid's newfound profits the company has been able to improve its atrocious balance sheet. Back in early 2012 Rite Aid had over $6.3 billion in debt. Today, Rite Aid has cuts its debt position to $5.7 billion, with its debt as a percentage of total assets being lowered to 82% from 86%. Yet, as the company works on clearing up its balance sheet, and giving it more financial flexibility for the future, Rite Aid has begun focusing on rejuvenating its brand. This process revolves around closing stores that weighed the company down and remodeling those with potential.


Source: Rite Aid.

The company called the new and improved versions Wellness stores, and they are noticeably cleaner, more spacious, and brightly colored. In fact, consumers who haven't visited a Rite Aid in the last several years would likely be shocked to see these new Wellness stores; they don't feel like the same Rite Aid. Already, the company has completed this transition at more than 1,200 of its 4,600 stores. 

Rite Aid's new Wellness stores are more than just a pretty face. Of course, there are GNC stores within, but the company has completely changed the products inside. For one, there are now more vitamins and a bigger selection of organic foods and natural personal care products.

Additionally, employees are armed with iPads, walking around helping customers with information on products within the store, like vitamins. These employees can also provide coupons or sign customers up to any of the company's programs

3. Strong behind-the-scenes activity
In adding to the physical changes that have taken place with remodeled stores, there are also a lot of other activities taking place at Rite Aid. For one, its Wellness+ program offers specialized care to certain patient populations. For example, its Wellness65+ caters to the elderly, with discounts on certain days and pharmacy consultations, among other services . 

Rite Aid's Health Alliance program connects pharmacists to local physicians for more personalized care with chronic conditions. Rite Aid also purchased the walk-in clinic RediClinic, a medical facility that is open every day of the week located beside Rite Aid stores. These are primarily in Texas right now, but Rite Aid has plans to build RediClinics all throughout the country.

All things considered, these added plans for customers, combined with the new look of stores, have allowed Rite Aid to create growth along with higher profits. In the past, Rite Aid's front-end sales consistently fell on an annualized basis, but in the process of this transitional period, the company has experienced growth. Specifically, during its last two months, front-end retail sales increased 0.9% and 1.5%, respectively, to compliment strong performance in the pharmacy.

Foolish final thoughts
Rite Aid's turnaround can be attributed to many factors, but three core reasons help explain it. This is a company that has thrived behind several key macro-related events, like the patent cliff and the Affordable Care Act, which provided insurance to millions of Americans, thus allowing for proper medical and drug treatment.

Nonetheless, Rite Aid may have been given a solid jump start from these macro events, but the construction of new stores along with its wellness programs have helped to drive new business into its stores.. Albeit, Rite Aid's company valuation is unlikely to appreciate by another 500% over the next two years, but with all of the positives surrounding this company, it's tough to imagine a scenario where either consumers or investors can go wrong by sticking with Rite Aid. 

Brian Nichols owns shares of Rite Aid. The Motley Fool recommends CVS Caremark. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.