Nearly a year ago the remainder of running back Adrian Peterson’s NFL career seemed in doubt, and only a few months ago the former league MVP was taking to Twitter to blast the Minnesota Vikings and their apparent refusal to trade or release him.

But all of that speculation and finger-pointing has come to a halt, with Peterson and the Vikings agreeing to restructure the final three years of his current contract only two weeks before the start of training camp.

The Vikings announced the agreement on their official site Tuesday, and though they kept the exact figures close to the chest, a source told ProFootballTalk that Peterson can essentially expect $20 million upfront on the new deal. PFT suggested the new deal likely breaks down into $13 million fully guaranteed for this season with another $7 million “injury-only” guarantee until the start of next year’s waiver period or the new league year. The Vikings now have an easy out if they decide to part ways with the 30-year-old star rusher after this season.

Yahoo Sports’ Charles Robinson first reported the deal, and tweeted that Minnesota also included some guaranteed money for 2016, but that Peterson won’t be locked down in 2017.

With Minnesota at a critical juncture as it tries to rebuild, the decision to rework Peterson’s deal while keeping him happy for a potential playoff run also includes some financial perks for the NFC North mainstays.

For one, Peterson would have counted as a $15 million and $17 million cap hit in 2016 and 2017, respectively. If the Vikings opted to cut him before this season, Peterson would have accounted for a $2.4 million dead cap hit. But in the final two years of his deal, the Vikings could release Peterson and incur no penalties.

Instead of taking an outright financial hit, Minnesota basically guaranteed some of the salary Peterson would have received in the final two years of his deal in order placate him and put to rest any talk of leaving this season.

The cap savings could go a long way in the Vikings’ attempts to keep some important free agents over the next couple of years. In 2016 alone, Minnesota may have risked losing last year’s leading tackler and safety Robert Blanton, along with promising receiver Jarius Wright.

But it’s in 2017 when the cap savings will be put to better use. Depending on how he performs this season, the Vikings should have enough to keep left tackle Matt Kalil in town, along with burgeoning cornerback Xavier Rhodes, safety Harrison Smith, defensive tackle Sharrif Floyd, and budding receiver Cordarrelle Patterson.

Minnesota fans might hate to see Peterson leave next season or in 2017, which could be on the horizon, but his potential exit will avoid a major exodus of all the young defensive talent the Vikings have accumulated over the last few years.