J.C. Penney JCP said on Thursday that it plans to close another 39 stores in 2015, bringing its fleet down to some 1,020 locations and shuttering dozens of stores for the second year in a row.

While store closings are usually a sign of trouble for a retailer, in Penney’s case, they should buoy anyone concerned about the department store’s longer term prospects, even with the news coming on the heels of a much better than expected holiday season: comparable sales rose 3.7% in November and December, sending Penney’s shares up 20% on Wednesday.

The fact remains that Penney’s annual sales, expected by Wall Street analysts to reach $12.2 billion in the fiscal year ending this month, are still well below the levels of a few years ago to justify its then-1,100-store fleet. And according to Penney’s own targets from its recent analyst day, they are likely to remain so for many years. Add to that how many malls are struggling now and how much e-commerce is expected to grow, and you have a strong case for downsizing Penney’s footprint as it gears up for a future as a smaller, but hopefully more profitable, retailer.

Here is a closer look at why this is a good move by J.C. Penney.

1. Too many of Penney’s stores are in bad malls

Penney operates nearly 700 mall-based stores, making it the second most common anchor tenant in the U.S. after Sears SHLD . But unfortunately for Penney, half of those stores are in so-called “B” malls, which are muddling along amid weak traffic, according to Green Street Advisors, and another 25% in “C” malls which are frankly in undesirable spots and seen by many analysts as irretrievably in decline. That leaves only a quarter of Penney’s mall-based stores are in prime “A” locations. (Penney has about another 400 stores that are off-mall, with many in smaller markets.)

With shopper traffic falling, and Sears closing dozens of its own stores, compounding that problem at many malls, why would Penney want to be in locations that have such grim prospects? By some estimates, about 20% of U.S. malls could close within a few years. Indeed, a number of the Penney store closings are in malls featured on the Deadmalls.com web site.

2. Sales per square foot, and overall sales, don’t justify such a big fleet

It was fine for Penney to have 1,100 stores when its annual sales were hovering around the $20 billion mark, as they were in 2006. But they trailed downward after Penney’s sales took longer to recover than rivals’ after the recession. And they went into free fall in 2012 and the first half of 2013 after ex-CEO Ron Johnson failed to reinvent Penney as a hipper retailer and alienated longtime shoppers.

Penney said in October it expects sales to only reach $14.5 billion by 2017, despite all its efforts to bring back the in-house brands and discounts its loyal customers wanted, suggesting many customers have been lost for good, and making it hard to justify the same number of stores as before.

Indeed, the decline Penney’s sales per square foot, arguably the most important metric in retail says it all: they slipped to $147 in 2013 from $248 in 2007, putting well behind Macy’s M and Kohl’s KSS , so Penney really does need to pare weak stores. (It closed 33 stores in 2014.)

3. Penney’s e-commerce is on the rebound

Mike Rodgers, the Penney executive hired last year to fix its e-commerce, told Fortune in October that e-commerce could eventually hit 20% of company sales (from about 10% now), diminishing the need for so many stores. While it is true that retailers will need stores to help e-commerce, so they function as showrooms and distribution centers, it is not true when it pertains to unattractive stores in malls no one goes to anymore.

4. Most of the stores being closed are leased locations

While Penney owns an unusually large amount of its stores (about half), the ones it is closing are for the most part leased stores. So that takes no assets off their balance sheets (it would in the case of a lease in a good mall and with several years to go) and allows Penney to gradually shrink its footprint as needed without paying penalties. (Barnes & Noble BKS has been closing stores as leases come due to shrink its fleet with little pain. The inability to close leased stores was one of the big factors that led Borders to file for bankruptcy protection a few years ago.)

Here is a list of the stores Penney will close in 2015.

Screen Shot 2015-01-08 at 12.26.14 PM