A week ago, the Orlando Magic were in dire straits.

The team was struggling at 3-5, dropping two after winning three games in a row. Their supposed defensive identity was falling apart as they ranked 29th in the league in defensive rating, giving up 109.0 points per 100 possessions. With one of the worst offenses in the league too and the worst field-goal shooting to boot, the Magic were sinking fast.

Magic coach Frank Vogel took the drastic change of sending prized youngster Aaron Gordon to the bench in favor of veteran Jeff Green, hoping to add some stability. The results were not immediate, and that change may not be the root cause, but something happened for the Magic in the week since.

More from FoxSports

In four games, the Magic defense has suddenly come alive. Orlando has given up 96.1 points per 100 possessions in the past week, the sixth best in the league in that time. They have risen from 29th in defensive efficiency to a much more respectable 15th overall.

Defense has taken hold.

"We are creating habits," Evan Fournier said after practice Friday. "It's not second nature yet. But we are definitely creating habits. It is encouraging. But on both ways. We have good players offensively as well. We have times where we really move the ball and find the open shooter. At times we do it, but we have to be more consistent. It is obvious we are getting better."

The Magic's offense remains much more of a work in progress than the defense at this point. But they have held three of their last four opponents to less than 90 points and have held opponents to worse than 40 percent shooting in the past two games. That helps the offense do just enough to win games -- two of the past three.

Orlando has slowly begun to formulate a defensive identity that has propelled the team to five wins despite its anemic offense.

The Dallas Mavericks are in much the same boat, without the same kind of success.

Dallas has just two following an 80-64 home loss to the Memphis Grizzlies. The Mavericks have seen injuries hit the team's roster hard. Deron Williams, Devin Harris and Dirk Nowitzki have all missed time so far this season.

Both Nowitzki and Williams will miss Saturday's game in Orlando, in addition to sitting out Friday's home game against the Grizzlies, coach Rick Carlisle said Friday.

"(Nowitzki is) making progress, but we're going to be cautious and we're going to be smart about it," Carlisle told Tim MacMahon of ESPN Dallas. "He's played hurt a lot in his career. This situation is different, though. We're early in the year. There's something that has hung around that needs to be addressed and be expunged, so we're working on it."

Harrison Barnes and Wesley Matthews have had to carry the offensive load. And have struggled to do so. The Mavericks shot 28.8 percent from the floor in Friday's loss, the lowest single-game field-goal percentage in the NBA this season.

But like the Magic, the Mavericks have thrived on defense while struggling on offense. Dallas has the second worst field goal percentage in the league at 41.8 percent entering the game (the Magic are last at 40.8 percent).

That defense has not translated to wins yet though.

Both teams have had to settle into the season, integrate new pieces and discover their identity. Injuries have hurt the Mavericks' offense while their defense has played well enough to keep them in most games. The Magic appear to be rounding into form.