The Eagles just improved their secondary, but it came at what could be a hefty cost for Carson Wentz.

Jordan Matthews, the team’s leading wide receiver the last two seasons, was traded along with a third-round pick for Ronald Darby, a starting cornerback for the Buffalo Bills.

Matthews caught 225 passes in his three-year Eagles career, averaging better than 110 targets per season. His catch percentage last year was 62.4 percent, the lowest of his career, but it was more than 10 percent higher than Nelson Agholor, who is slated to replace Matthews as the lead slot receiver.

Matthews had been rumored as trade bait for weeks. He’s making just $1.09 million this season, but it’s the final year of his rookie contract. An unrestricted free agent after this season, Matthews was set to test the market after not getting a deal worked out with the team this offseason. Given the likelihood the Eagles would lose him after this year, they opted to trade him now for help in the secondary.

Not only does the departure of Matthews vastly change the offense — taking away away one of Wentz’s most dependable outlets on the field — but the team also just shipped out one of his best friends, too.

Fans were down on Matthews — he, like Agholor, has had too many drops — but his value as a security blanket for the second-year quarterback can’t be ignored. Even in the touchdown drive in Thursday’s preseason game, Matthews caught a short pass to pick up a key first down simply by having great field awareness, something the Eagles will lack with Agholor or one of the younger receivers who have stepped up in preseason camp.

Agholor is now listed as the starting receiver in the slot with Bryce Treggs listed behind him. Mack Hollins, who scored a 38-yard touchdown Thursday night in Green Bay, is listed as the backup to Torrey Smith on one side, while Marcus Johnson is behind Alshon Jeffery on the other.

Nelson Agholor’s hands … still a problem. #drop

— Brandon Lee Gowton (@BrandonGowton) August 11, 2017

From a business standpoint, the move makes sense, but given Jeffery’s inability to stay healthy throughout his career — he’s played just 63 games in five seasons, missing 11 in the last two years alone — and knowing Agholor has been totally unreliable on gamedays, it is a bit surprising to see Matthews gone.

Last season, with Wentz under center and head coach Doug Pederson calling the plays, Matthews led the team with 117 targets. Tight End Zach Ertz was next with 106, then Dorial Green-Beckham with 74. Green-Beckham was cut loose before camp began.

Darren Sproles had 71 passing targets, then Agholor’s 69 and 60 for Trey Burton. Wentz has been given more, and better, offensive weapons this year, but still 19 percent of his record-setting number of attempts went in the direction of Matthews last season.

In the preseason opener against Green Bay, albeit without Jeffery on the field, Wentz completed four passes, and three were to Matthews.

What the Eagles get in return is a starting corner for a secondary that sorely needed help. They also get another former member of the Buffalo Bills, as defensive coordinator Jim Schwartz continues to stockpile players from his previous stop. Darby is the fourth player from the Bills to join the Eagles’ defense in the last two seasons.

Hopefully, he’s the best.

Opinions on the deal will be understandably split, but the Eagles traded for a position of need and gave up a third-rounder and what they feel is a surplus player they won’t be signing longterm. That, in and of itself, may be the most short-sighted part of the decision. With Jeffery and Smith on one-year deals, Matthews could have factored into the longterm plans. Not anymore. But given he’s in just his second year, Darby surely does.

According to Rotowire, Darby has great speed and elite jumping ability, and at 5’11, 193 he’s a bigger corner who will have to lock down some of the top receivers in the NFL this season. He led the Bills in passes defended last season and was third on the team in tackles, but he didn’t have any interceptions or forced fumbles. In his two-year career, Darby has just two picks in 29 games.

The Bills simultaneously flipped receiver Sammy Watkins and a late pick for cornerback E.J. Gaines and a second-rounder from the Rams. This is a huge deal for Buffalo, as they swapped Darby and Watkins for Matthews and Gaines and acquired a second-round and a third-round pick for their troubles, without getting much worse on the field.

Some of this might be reshuffling of some NFL deck chairs — getting rid of good young players who won’t get expensive contracts for other good young players who might — but for the Eagles, it took their primary problem in the secondary and made it disappear.

Now let’s hope either Agholor starts catching footballs, or Hollins is as good as everyone wants him to be.