On July 21, the Cleveland Cavaliers signed rookie Joe Harris to a contract, leaving them $1.6 million in cap space. The team then embarked on a convoluted and complicated journey that included five trades, eight second-round picks, two first-round picks, five delayed signings and $1 million in cash. This twisted voyage led them to Wednesday's trade for Timofey Mozgov.

The Cavs' front office, led by general manager David Griffin, has been aggressive in creating assets and spending money to build a team around LeBron James. The trail of maneuvers and contractual timing that enabled the Mozgov move was costly but quite creative.

Here's how it happened:

Step 1

With their remaining cap space, in July the Cavs made a two-tier trade with the Utah Jazz. They traded Carrick Felix for Erik Murphy. Then, in separate transactions, they absorbed John Lucas III into cap space and Malcolm Thomas with a minimum salary exception. The reason for this trade was for the Cavs to turn that $1.6 million in space into three players with non-guaranteed contracts totaling $3.4 million. They could not have pulled this off without that little bit of cap space.

To get the Jazz to cooperate, the Cavs paid with their 2015 second-round pick and a check for $1 million.

Step 2

Once the Cavs had exhausted their cap space after the Jazz trades, they inked five players whom they had initially delayed signing. By taking advantage of the various exceptions that allow them to exceed the salary cap, the team signed first-round pick Andrew Wiggins, second-round pick Dwight Powell and veteran free agents Mike Miller, Shawn Marion and James Jones.

All the contracts were guaranteed other than Powell's, which is a relevant detail.

Step 3

On Sept. 25, the players acquired from the Jazz had become eligible to be repackaged in a trade under NBA rules, and the Cavs did just that. They traded the former Jazz players, plus Powell, to the Boston Celtics to acquire Keith Bogans. Essentially the Cavs took four players whose contracts totaled $4 million in non-guaranteed money to get Bogans and his $5.2 million non-guaranteed contract.

To get the Celtics to participate in this maneuver, the Cavs handed over their 2016 and 2017 second-round picks. The Celtics sent two second-round picks back to the Cavs in the deal, the Sacramento Kings' 2015 and 2017 picks. But those will only end up in the Cavs' hands if they are in the last five picks in the draft, making them unlikely to ever convey.

So the Cavs had Bogans' contract, a valuable $5.2 million trade chip they created from that once-paltry $1.6 million in cap space. However, the mission hadn't yet been accomplished.

The Cavs didn't want to pay Bogans' salary or have him take up a roster spot for months. Also, if they didn't trade him by Jan. 10 they would have to guarantee his full salary. So the Cavs needed another move.

Step 4

If you need to offload a player for any reason, these days you call the Philadelphia 76ers because they have open cap space to absorb players and will provide just about any trade service for a second-round pick. That's what the Cavs did on Sept. 27. They traded Bogans to Philly in exchange for another 2015 second-round draft pick that will never actually convey -- the 76ers only send their pick to the Cavs if it falls between the 51st and 55th pick in the draft.

In return the Cavs sent their 2018 second-round pick to the 76ers, meaning they had used their 2014, '15, '16, '17, and '18 second-rounders in this exercise. As a side note, the Cavs traded their 2019 second-round pick this week to the New York Knicks in a deal that got them J.R. Smith and Iman Shumpert.

Bogans, Murphy, Lucas and Thomas were all later waived by the Sixers and Celtics. Powell was used in the Rajon Rondo trade and is now in Dallas.

Steps 1-4 left the Cavs holding a $5.2 million trade exception with an expiration date of one year, Sept. 27, 2015.

Step 5

On Wednesday the Cavs used the trade exception to acquire Mozgov, who fit into it nicely with his $4.6 million contract, filling their badly needed center role. The Cavs had wanted Mozgov since July and their need got stronger when Anderson Varejao was lost for the season. They sent the Denver Nuggets two future first-round picks, the major part of the trade. The Nuggets also sent the Cavs a 2015 second-round pick, the lesser of the Chicago Bulls and Portland Trail Blazers picks, meaning it will probably fall in the bottom 10 spots in the draft.

Considering where the Cavs started, it was making something from virtually nothing, even if it cost them a cache of draft picks. It is a strong example of how salary-cap management and manipulation are an important part of front-office work in the modern NBA.

And just what lengths the Cavs were willing to go to get a center.