The company—which has 24 men’s stores across the country that sell suits, dress shirts, tops, pants, shoes and accessories—said in court papers that business was profitable until 2016, when its consumers started gravitating more toward online shopping. Even though Bachrach’s e-commerce sales grew from $1 million in 2015 to $1.2 million in 2016, that was far from enough to make up for a number of less profitable stores based primarily in shopping malls.From 2010 to 2015, the company was in the black, with gross sales growing from $11 million in 2010 to their peak of $18.8 million in 2014. Along with that revenue boost came 17 new stores in 2012, according to court documents.

This store-expansion plan was part of a package deal with mall owner Simon Properties Group, court papers said, which required that Bachrach lease certain retail space at Simon’s less desirable Class C malls in order to get into better locations at some of Simon’s topnotch malls. Initially, this expansion plan worked well but eventually started to drag on revenues when the stores at Class C properties started underperforming.

Now Bachrach wants to shutter 13 unprofitable stores in its 24-store chain and keep 11 lucrative outposts up and running.

In court papers, Brian Lipman, chief executive of Bachrach and its principal owner, said that in 2016 revenues were $18 million but EBITDA (earnings before interest, taxes, depreciation and amortization) dipped to minus $100,000 compared to a positive $740,000 the previous year. “Despite the size of e-commerce sales relative to the retail stores, the company’s e-commerce revenue is stable and growing as opposed to the retail store sales, which have decreased,” Lipman wrote in a court statement.

In the bankruptcy, filed in Los Angeles, the company listed $11.3 million in assets and $12.4 million in liabilities. Bachrach’s biggest creditor is Israel Discount Bank of New York, which is owed $10.57 million.

“We are looking to be out of bankruptcy in four months, which is a fairly quick timetable,” said Brian Davidoff, the bankruptcy attorney at Greenberg Glusker Fields Claman & Machtinger representing Bachrach. “Many of the retailers who have been restructuring or filed bankruptcy had the idea that they would sell the company or restructure, but they haven’t been able to survive because there were no buyers for them. Bacharach is different. The good stores are actually good and profitable.”

The downhill slope for revenues at Bachrach’s stores started last summer. By the end of 2016, Bachrach’s locations were seeing an across-the-board 10 percent dip in sales. With sales tanking, Bachrach closed four stores in Illinois, New Jersey and New York. But that still left 13 stores that weren’t making the grade but were too costly to close outside of bankruptcy. Bankruptcies allow retailers to break store leases without paying a penalty.

Bachrach said it would like to emerge from bankruptcy, keep its profitable stores and beef up its e-commerce site, which currently employs seven people out of a staff of 151. The e-commerce site is supplied by a Los Angeles warehouse.

“Sales from bachrach.com have grown over the years, and the company sees the e-commerce business as a fundamental component of the success of the company going forward,” Lipman wrote in court papers.

This is not the first bankruptcy for Bachrach. In 2005, the retail chain was acquired by Sun Capital Partners when the company had 79 stores throughout the United States—mostly in the Midwest. But many stores were located in underperforming markets, putting a drag on revenue.

By 2006, Sun Capital partners had filed for bankruptcy, selling the business to Bachrach Acquisition, whose owners included Brian Lipman, the current CEO.

Bachrach, founded in 1877 in Decatur, Ill., joins a growing rank of troubled retailers seeing increasing competition from online shopping sites. In the first four months of this year, 14 chains have announced they will seek court protection, according to an analysis by S&P Global Market Intelligence, almost surpassing all of 2016. Those who have filed for bankruptcy this year include BCBG Max Azria, The Wet Seal, Limited Stores, Eastern Outfitters, Gander Mountain, Gordmans discount department store and Payless ShoeSource.

Bebe, based in the San Francisco area, expects to close all its 168 stores and liquidate its inventory by the end of May. This will result in a $20 million charge. The company said it wants to concentrate on e-commerce sales, but some experts expect it to head to bankruptcy soon.

At this rate, 2017 may turn out to be one of the worst years for retailers since 2008, when the recession took hold of the economy.

Online sales are the beast that is eating up retailers’ revenues. And increasingly, Amazon.com is becoming the top e-commerce monster forging its way into the apparel business, taking over like it dominated the book-selling market and then expanded into other categories.

Recently, Amazon has launched a number of its own private-label clothing brands and is talking about providing custom-fit clothing within days of an order.

Howard Davidowitz, a retail expert who is chairman of Howard Davidowitz & Associates in New York, said we are a country of too many stores. “We have five times more square footage per person than England, France, Japan and Canada. We are gigantically over-stored,” he said.

Pile on the competition of online shopping sites, and you have a recipe for more store closures down the line. “There is going to be a five-to seven-year adjustment for retailers and malls, and there will be an awful lot of pain,” Davidowitz said. “We are only in the second inning of this problem.”