With Amazon taking on e-commerce dominance, many wondered how viable and sustainable Walmart is, but on Thursday after the release of its second quarter earnings, it became clear: Walmart is here to stay, at least for now.

'The department store is online now,' Warren Buffet, billionaire investor said at Berkshire Hathaway's annual May meeting in Omaha, Nebraska, as Business Insider's Bob Bryan reported. In February, Buffet was interviewed by CNBC saying, 'retailing is very tough and I think online is hard to figure out' when compared to Amazon.

Instead of awaiting its fate as many other big-box stores, Walmart reinvented itself and brought in $123.36 billion in revenue exceeding Wall Street expectations. The big company taught us a lesson all startups should learn: While change is never easy, those companies that adapt quickly have the best chance of survival.

In their book Stall Points, Matthew S. Olson and Derek van Bever write, "Once a company runs up against a major stall in its growth, it has less than a ten percent chance of ever fully recovering." While there can be a host of reasons as your company's stagnation, if you want to avoid being part of the 90 percent, learn from Walmart and don't wait too long to repair the damage.

Here are the two things Walmart did to reinvent itself before it was too late:

1. Increasing focus in e-commerce

In the second quarter, Walmart's e-commerce sales climbed 63 percent, compared with 29 percent growth in the prior quarter and they did it by buying up trendy e-commerce sites. Since the purchase of online shopping giant Jet last year, Walmart has acquired other digital retailers like Modcloth, ShoeBuy and most recently Bonobos.

Online cosmetics retailer Birchbox is also reportedly in talks with Walmart. Walmart hopes to leverage the popularity of these niche, trendy sites with subsets of consumers who wouldn't be caught dead in a Walmart store.

Food, accounts for 56 percent of Walmart's revenue. The retailer further capitalized on e-commerce by building a proprietary app that matches online delivery addresses with employees' driving routes home. The result, an online grocery delivery that rivals Amazon and Whole Foods from more than 900 stores with plans to expand further by the end of the year.

Increasing e-commerce may not be the solution for you, but the benefits of e-commerce should not be ignored. For every small business, e-commerce can bring convenience whether for products or appointments or the promotion your band.

Even if you're currently using e-commerce, ask yourself the question how can your business better use e-commerce to accomplish its goals? Perhaps you can use it to expand your presence similar to Walmart.

2. Securing state and local tax credits

A secret behind Walmart and the Walton family's rapid expansion includes more than $7.8 billion in tax credits, according to Forbes. Walmart has been successful attracting free land, infrastructure assistance, low-cost financing and state and local tax credits and incentives.

Similar to Amazon, securing tax credits is key to success as it is a direct tool to subsidize it's cost, as it expands distribution warehouses across the country to get goods faster to consumers. According to Good Jobs First, some of the most generous states for Walmart have been Illinois ($51 million), New York ($50 million), Florida ($22 million), Louisiana ($12 million) and Maine ($10 million).

While Walmart is not out of the dark, they've showed great tenacity and will not leave without a fight. Industries are constantly transforming and businesses have to stay ahead of the curve. Your company may be no different.

Invest in e-commerce where it makes sense. Don't be afraid to go the acquisition route to grow. And seek out state and local tax credits that encourage business growth. You too, can be the next reinvented company.