Joe Ianniello was seen as the odd man out once members of the CBS and Viacom boards got serious about merger discussions this past spring. It became clear early on that Bob Bakish was the choice to lead the combined company as CEO.

But as the negotiations progressed, the future of CBS’ president and acting CEO became a key concern for CBS board members. As demonstrated by CBS’ second quarter earnings report released last week, the company is performing well despite the upheaval over the past year and is on target to meet its ambitious growth projections.

CBS board members were concerned about endorsing a merger agreement that left no management role for Ianniello, according to multiple sources. After 22 years at CBS, he was prepared to move on if a merger deal was reached. But CBS board members, including controlling shareholder Shari Redstone, persuaded him to consider options for remaining with the media company.

In his new role as chairman-CEO of CBS, Ianniello will oversee all CBS-branded assets that will now be under the ViacomCBS umbrella. Showtime and smaller cable channels Pop and Smithsonian will move out of Ianniello’s portfolio, with Showtime chief and CBS chief creative officer David Nevins now reporting directly to Bakish, as well as to Ianniello on CBS-related programming matters. Ianniello will also report to Bakish.

“Our board spent significant time with me going through deep dives into the business,” Ianniello told Variety. “Any time there’s a transaction of this size, there’s the question of whether there are meaningful roles for multiple executives. Obviously there’s only one CEO. The art of the deal here was finding a scenario where Bob and Joe can stay together.”

It is believed that as an incentive to stay, Ianniello was granted an unusual level of autonomy that was built into his employment contract. Sources said Ianniello and CBS board members pushed hard in the final days before the deal was announced to give him the flexibility to run CBS as he sees fit, although some deal points were ultimately rebuffed. Ianniello declined to comment on the specifics of his new contract, which runs through 2021. Under his previous employment contract, Ianniello had been in line to receive $69 million if he was not promoted to CEO after Moonves left. It’s understood that Ianniello will still receive that money, although the timing and specifics of when that windfall will be paid out are still unclear.

Ianniello’s lofty status is a far cry from the expectation this time last year when longtime CBS leader Leslie Moonves was ousted amid the battle with Redstone over control of CBS. Moonves strongly opposed the proposed reunion with Viacom (the companies merged in 2000 but were split up again in January 2006) on the grounds that Viacom’s struggles would be a drag on CBS.

Ianniello was Moonves’ right-hand lieutenant on the business side for years, serving as chief financial officer and chief operating officer, until Moonves was fired last September after allegations of past sexual misconduct surfaced. Ianniello’s close association with Moonves and involvement in CBS’ failed legal action against Shari Redstone and the Redstone family’s National Amusements last year seemed to ensure he would be shown the door soon after Moonves’ ouster. As part of the flurry of legal filings connected to the litigation, Ianniello was revealed to have made snarky comments about Redstone in private communications with Moonves.

But Ianniello’s intimate knowledge of CBS and the support he received from CBS employees still made him the logical choice to take the helm after the shock of Moonves’ messy exit. Over the past nine months, according to multiple sources, Ianniello and Redstone put the past behind them and developed a solid working relationship.

Ianniello would not comment on how the legal fight colored his relationship with Redstone. His focus now is on keeping CBS humming and harnessing the potential of the enlarged company. Already, Ianniello and Bakish have been talking up the potential to share assets and leverage content franchises more broadly across CBS and Viacom outlets.

“This transaction has been about the industrial logic of the deal – not about me or any one individual,” Ianniello said. “I think combined there are great things ahead.”

Ianniello noted that he has known Bakish for more than 20 years. Both come from similar backgrounds in business and finance.

“I know Bob a long time,” Ianniello said. “I respect what he has accomplished at Viacom. He was thrown into a situation and he really has stabilized and righted the ship. I know I can really work well with him. We’re both committed to making this work.”

Ianniello climbed the ranks at CBS (and Viacom during the first merger period) but his reputation as a strategist and financial wizard was sealed in 2009, shortly after he was promoted to chief financial officer. CBS’ stock price had sunk below $10 amid the global financial crisis. The company was almost entirely dependent on advertising revenue, which plummeted as advertisers retrenched in the global recession. Moreover, CBS had several big debt payments looming.

Ianniello got the debt issue under control, and then he turned his focus to diversifying CBS’ revenue streams.

“When the recession hit, our revenue got sick. That put a lot of pressure on the enterprise,” Ianniello said. “I knew we could never put ourselves in that position again. We had to de-risk.”

Ianniello’s focus turned to distribution revenue – or the lack of it – that CBS received from cable operators for the right to carry CBS’ O&O stations. CBS, like Fox and other big broadcast groups, began to push hard for much higher retransmission consent fees from MVPDs. “We were bringing (distributors) massive reach but we weren’t being paid for it,” Ianniello said. “That was the opportunity.”

CBS is now on track to generate $2.5 billion a year in retrans revenue (including payments made to the network by its affiliate stations) by next year. CBS’ steadfast insistence on what it sees as fair market value was tested in 2013 when the company endured a monthlong blackout on Time Warner Cable when the sides couldn’t come to terms on a carriage deal. CBS stood firm on its price and Time Warner eventually conceded. Ianniello suspects he would have been fired had the situation gone the other way. Just last month, CBS went toe-to-toe with AT&T in a contract wrangle that led to a 20-day blackout on DirecTV and U-verse.

CBS’ experience in carriage battles taught Ianniello a great deal about the value of the high-end content, notably NFL rights, that CBS brings to the table. Although the combined ViacomCBS still has a smaller balance sheet than rivals such as Comcast, Disney and AT&T, the company that owns America’s most-watched network still has plenty of leverage.

“When I’m sitting across the table (in a contract negotiation), I don’t feel small,” Ianniello said. “It’s the reach that CBS and Viacom bring to the table that is so valuable. We’re still not being paid ESPN rates. So we have a lot of room to grow.”

Ianniello was also instrumental in the development of CBS All Access. CBS was far ahead of its traditional TV competitors in launching a subscription streaming service in 2014. The impetus to take the leap five years ago came as CBS leaders realized how eagerly consumers were embracing on-demand platforms. It also allowed CBS to “plant the flag for the value of our content” in a fast-changing pay TV landscape, Ianniello said.

All Access begat other advertising-supporting niche streaming services – including CBSN, CBS Sports HQ and ET Live – that have given CBS an important footprint for advertising and a level of visibility for its brands. The company is now in the midst of a push to launch 24-hour local news and lifestyle streaming services in 13 major markets where it has O&O stations. The flagship effort launched in New York in December; Los Angeles’ went live in June. Nine more local iterations are scheduled to be up and running by next year.

“That’s the future. That’s where the growth is,” Ianniello said of CBS’ local stations.

Ianniello said he expects the changes to come with the merger will allow him to focus more deeply on the operations of the CBS network, its stations and studio arms as well as CBS Interactive. “I think I will get even closer to the executives running those units,” he said. “There’s a lot of value to be created there.”

Ianniello faced plenty of personnel management issues during the past year as the departure of Moonves led to scrutiny and harsh criticism of the corporate culture on his watch. Ianniello said he has been gratified by the response to organizational and leadership changes that he instituted, including the promotion of Nevins and the appointment of longtime producer Susan Zirinsky as president of CBS News.

“I credit our executives with keeping the company focused during a hard time,” Ianniello said. “It’s a team effort. I’m fortunate to be the head of this team.”