The Buffalo Bills gave up a ton of salary cap space when they acquired running back LeSean McCoy from the Philadelphia Eagles and quarterback Matt Cassel from the Minnesota Vikings via two separate trades in less than 24 hours this week. Specifically the Bills dropped from eighth to 17th in cap space that was supposedly earmarked for improvements on offense.

But a closer look at both McCoy and Cassel’s current contracts, as well as Buffalo’s free agents this season and in 2016, reveals the Bills may have excellent short and long-term strategies to snap their 15-year playoff drought.

The Bills managed to swing two trades for McCoy, Cassel, and a draft pick, for the cost of young inside linebacker Kiko Alonso, two other draft picks, and technically the loss of almost $12 million in salary cap space less than a week before the start of free agency.

The loss of such valuable cap space and a promising young player like Alonso might give Bills fans enough cause to question Ryan and general manager Doug Whaley’s bold decisions as the team comes off a 9-7 campaign.

But taking a look forward, the trades will allow Buffalo to equal or better their production from last year and build enough cap space to keep several prized future free agents in 2016.

In terms of cap space, the Bills did lose a large amount by absorbing McCoy’s $10.25 million and Cassel’s $4.75 million cap hits. Before the trades the Bills had $29.6 million in cap space, the eighth most in the NFL, and now according to Spotrac.com they’ve dipped to $17.7 million, the 17th highest amount.

It doesn’t seem like much considering both defensive end Jerry Hughes, as well as inside linebacker Brandon Spikes hit free agency next week, but it should be enough to retain at least Hughes.

Hughes’ contributions can’t be understated. He was third on the team with 9.0 sacks last season, and was part of a three-headed monster pass rush along with defensive tackle Marcel Dareus and defensive end Mario Williams. With those three in tow, the Bills fielded the NFL’s No. 4 overall defense, and terrorized opposing quarterbacks with the league’s best pass rush and 54 total sacks.

Retaining Hughes with a long-term deal figures to be first on the Bills agenda following the trades, but Spikes is a different story. The 27-year-old ranked sixth on the team with 54 total tackles, and came up with 1.0 sack and three passes defended, but the Bills already have linebackers Preston Brown and Nigel Bradham and together they’ll represent a $1.4 million cap hit next season.

That’s reason enough to let Spikes walk and save some cap space down the road for Dareus. A free agent in 2016, Dareus enters the fifth season of his career with 28.5 sacks and 11 run stuffs and as one of the best defensive tackles in the league. He’ll no doubt command a deal close to whatever Ndamukong Suh receives this offseason and the Bills will need a significant amount of cap space to keep him.

And that’s where Cassel and McCoy’s deals come into play. Cassell will be a free agent after next season, and much like he did last year with Teddy Bridgewater, he could serve as a competitor to fuel former first-round pick and quarterback E.J. Manuel while coming off the books in 2016. Cassel could even play as well as Kyle Orton did and lift the Bills into the playoffs if Manuel doesn’t pan out.

McCoy immediately becomes the Bills second-highest paid player, and amidst rumblings that he’s unhappy with the trade, in the long run he might not cost Buffalo much. If it doesn’t work out in 2015, the Bills could release McCoy and suffer no hit to their dead money total since Philadelphia has already paid out most of the $20.7 million in guarantees laid out in his deal back in 2012.

Should the Bills release McCoy after next year, they would save $7.15 million that could go to Dareus and perhaps cornerback Stephen Gilmore and Bradham, who will also both be up for new deals in 2016.

Such a move does the beg question: Why cut McCoy after giving up a talented player like Alonso?

In fairness, Alonso was coming off an exceptional rookie season, leading the Bills in tackles and interceptions. But he sat out the entire 2014 season after tearing his ACL last July, and the Bills didn’t miss a stride with him out.

What made Alonso seem like an obvious keeper was his inexpensive contract. Next season Alonso make less than $800,000 and in 2016 a shade under $1 million, and then he will be a restricted free agent.

But Buffalo’s offense left much to be desired in 2014, and Whaley instead chose to sell Alonso high and not risk the chance that he re-injures his knee.

The Bills were No. 26 in total offense last season and needed to make a drastic move for a playmaker to pair with top receiver Sammy Watkins. The rookie caught 65 passes for 982 yards and six touchdowns last season, and acquiring a running back like McCoy and a veteran signal caller like Cassel should help Watkins develop.

Furthermore, it’s not like $17.7 million is a miniscule amount of cap space either. Assuming Whaley can sign Hughes to a back loaded deal, the Bills can spruce up their offensive line by adding any of the top lineman that hit the open market next week. It's a list that includes San Francisco 49ers guard Mike Iupati, Green Bay Packers right tackle Bryan Bulaga, and Tennessee Titans right tackle Michael Oher.

The future is bright in Buffalo, and all it cost the Bills was a currently injured linebacker and $12 million cap space they figure to get back next season.