MIAMI (AP) — Dwyane Wade is staying with the Heat and his latest deal is designed to give both the player and the only franchise he’s ever known some flexibility in the coming years.

Wade agreed Tuesday to a two-year contract to stay in Miami, the second of those seasons a player option, said a person familiar with the situation. The person spoke to The Associated Press on condition of anonymity because neither side announced the deal. Financial terms were being completed, though it’s expected Wade’s salary for next season will not reach the $20.2 million he would have made under the terms of his previous contract.

“Home Is Where The Heart Is… My Home,My City,My House,” Wade wrote on Twitter, then used the phrase “HeatLifer” when attaching a photo of himself standing below the three NBA championship banners that hang at the arena the Heat call home in Miami.

Wade’s return was not in any way unexpected, yet still represents a huge win for Miami during free agency — especially since it comes less than a week after LeBron James left the Heat after four seasons and returned to the Cleveland Cavaliers.

Wade is entering his 12th Heat season and is the franchise’s all-time leader in games, points, assists and steals. He and Udonis Haslem, who is also expected to complete a new two-year contract with Miami in the coming days, are the only players to appear on all three of the Heat teams that won NBA championships in 2006, 2012 and 2013.

He was limited to 54 games last season, in large part because of a maintenance program designed to limit wear and tear on his knees. But when he was on the floor, he was effective — shooting a career best 54.5 percent and averaging 19.0 points.

With James gone, Wade likely won’t have the luxury of resting as much this season.

He’s averaged 24.3 points for his career, 16th-best in NBA history and fifth-best among active players with at least seven seasons. And only seven other players in league history have as many points (17,481), rebounds (3,605), assists (4,301), steals (1,262) and blocked shots (696) as Wade has posted so far in his career.