WASHINGTON -- Back on May 23, the Nationals were toast. Or so it seemed.

They'd just been swept in a four-game series by the Mets. They were 12 games under .500 and had the National League's second-worst record. Their bullpen was a mess and their manager's future was in doubt.

A month later, things have changed.

Even though the Nats dropped two straight to the Braves over the weekend -- an extra-innings defeat Sunday, preceded by a gut-punch loss on Saturday night fueled by yet another bullpen implosion -- they've managed to claw their way back to relevance in the NL playoff picture. Since May 24, they've won 18 of 27 games, giving them the second-best record in baseball over that stretch (only the Dodgers have been better).

Yes, they're still three games under .500. Sure, they're still eight games out of first place. True, the bullpen is still chock full o' warts. Despite all that, after going 4-2 against Philadelphia and Atlanta (the two teams that appeared to be the class of the division), Washington entered the week within three games of a wild-card spot. According to FanGraphs, the Nationals' postseason odds -- which had sunk to 22 percent a month ago -- were at 53 percent heading into Sunday, highest among the NL's non-division leaders. What's more, their next 12 games leading into the All-Star break come against the Marlins, Tigers and Royals. In other words, the Nats have a playoff pulse.

"We know we're capable of keeping up with any of these guys," catcher Yan Gomes said of the Nationals, who have managed to resurrect a season that, not long ago, seemed entirely, um, unresurrectable.

Here are five keys to Washington's turnaround:

1. Clean(ish) bill of health. Some teams (like the 2019 New York Yankees) can deal with injuries. The Nationals are not one of those teams. At least not this year's Nationals. Losing shortstop Trea Turner and third baseman Anthony Rendon within the first month of the season exposed the organization's lack of infield depth, simultaneously taking a major bite out of Washington's run production and run prevention.

Since Turner and Rendon have returned (and shaken off the rust), the Nats have been a completely different team on both sides of the ball. Just how good has Rendon been? Despite missing two weeks, he still ranks among the NL's top five in wins above replacement.

2. Max Scherzer pitching like Max Scherzer. The narrative early in the season was that Scherzer, whose team lost 10 of his first 12 starts, was this year's version of Jacob deGrom. He was pitching as well as ever but simply wasn't getting any support. Not from his offense. Not from his defense. Not from his bullpen.

Although there was some truth to that, there was also some truth to this: Over the first two months, Scherzer -- who led the NL in hits allowed through Memorial Day -- hadn't really kicked it into full Mad Max mode. Lately, he has. In four June starts, Washington's ace has an itsy-bitsy 0.93 ERA. In 29 innings, he has tallied 44 strikeouts against five walks. In related news, the Nationals have won all four of those games -- including his most recent outing, when he sealed a doubleheader sweep of the Phillies, striking out 10 and walking two while sporting a shiner from a broken nose suffered in batting practice the day before.

ESPYS Voting: Best MLB Player Which MLB star has shined the brightest? Let your voice be heard, and then tune in to The 2019 ESPYS presented by Capital One at 8 p.m. ET July 10 on ABC. Vote now!

3. Juan Soto hitting like Juan Soto. The Nats spent the early part of the season without their five best hitters from last year. Bryce Harper and Daniel Murphy, now on the Phillies and Rockies, respectively, aren't coming back. Rendon and Turner already have returned. But perhaps the biggest absence was Soto's. After rewriting the teenage record book in 2018, when he finished second in the voting for Rookie of the Year, the Dominican outfielder was expected to fill the offensive void created by Harper's exodus. Instead, he was virtually AWOL, struggling to adjust as pitchers attacked him with fewer fastballs and more off-speed stuff.

Through May 16, Soto was hitting a sickly .228 with a .759 OPS that was almost 40 points below the league average. Since then, he's hitting .381 (second in MLB) with a 1.103 OPS (fifth), and also has cut his whiff rate in half. Soto attributes the improvement to better balance at the plate, the result of oodles of resistance-band work with hitting coach Kevin Long. "I feel very good," said the Nats' cleanup hitter, who had a double, two triples and a homer during the three-game weekend set against Atlanta. "I'm seeing the ball really well."

4. Anibal Sanchez's command. The owner of a mixed-breed changeup he calls "La Mariposa" (Spanish for butterfly), Sanchez has undergone a complete metamorphosis since returning from a strained hamstring in late May. Prior to hitting the shelf, the veteran righty -- a finesse pitcher who signed a two-year deal with Washington in December -- was a shadow of the hurler who posted a career-best 2.83 ERA with the Braves last year.

Before the injury, Sanchez had issued 24 walks in 42⅓ innings and was 0-6 with an ERA north of 5.00. Since returning, he has walked a total of four batters in five starts and has lowered his ERA by more than a run. The Nats have won four of those five starts.

5. Better(ish) bullpen performance. You probably know this by now, but Washington's relievers have been really bad this year. Like, historically bad. But what you might not know is that lately, they've actually sorta kinda turned things around. Prior to their blowup on Saturday night, which resulted in the merciful release of free-agent failure Trevor Rosenthal and his 22.74 ERA (not a typo), the Nats' bullpen had posted a 3.82 ERA over the previous four weeks, the fourth-lowest mark in the majors.

Does that mean Washington's pen is magically fixed? Um, no. But it does mean it's headed in the right direction. The Nats still have All-Star closer Sean Doolittle at the back end, and righties Wander Suero and Tanner Rainey have shown increasing flashes of dependability. That said, as the Nationals' back-to-back defeats this weekend suggested, it's going to be challenging for them to make the postseason without significant changes to the current bullpen construction. But hey, that's why God created the trade deadline.