Networks are changing the way they develop and release new shows, and even commercials, as they seek to adapt to new TV viewing habits and profit from the “binge-watching” made popular by video streaming services like Netflix nflx .

The changes could help offset declining audiences and the trend known as “cord cutting,” as a growing number of Americans opt to go without traditional cable or satellite television service and rely instead on Internet streaming video.

Viacom’s viab TV Land network is developing more serialized programming where the plot unfolds with each episode, and recently changed the storyline of a new show to encourage binging.

Time Warner’s twc Turner Broadcasting System in January launched its new comedy Angie Tribeca by airing the entire 10-episode season in a 25-hour “binge-a-thon” on TBS tkobf . A third of viewers were new to the network.

TV executives are also working with advertisers to change commercials, so binging viewers stay engaged. Experiments include making brands part of the show on Turner. CBS cbs , meanwhile, is studying whether commercials themselves should be serialized to tell a story.

The changes reflect a realization that fewer people, particularly younger viewers, watch shows when they air and instead binge-watch series like Netflix’s House of Cards or Orange is the New Black.

“The streaming platforms have created a more competitive environment and we all need to deliver better,” said David Levy, president of Turner.

Networks used to cringe at serialized shows because they did not lend themselves well to syndication. Out-of-order reruns can be confusing, so program developers preferred series such as CBS hits The Big Bang Theory or NCIS, which wrap up a story in each episode.

 

But with the rise of binge-watching, TV networks see a chance to hook viewers through cliffhangers. They make batches of current episodes available on-demand through cable boxes or online apps, and sell them later to the likes of Netflix.

Forty-six percent of millennials—people in the 18-to-34 age group—watch shows after they air, according to media researcher Comscore scor . And 42% of viewers binge-watch multiple episodes of a show, one to two times per month.

“Bingers are super fans,” said Jonnie Davis, president of creative affairs for 20th Century Fox TV fox . “These are the people who go to work the next day and want to talk about the show.”

At TV Land, creative and marketing executive Kim Rosenblum said one new show, Impastor, was rewritten from the pilot to drive the story across episodes and attract binge viewers.

The show follows slacker Buddy Dobbs who escapes from his gambling debt by pretending to be a preacher in a small town. To encourage people to keep watching, writers developed a story line about thugs hunting down Dobbs, giving each episode a cliffhanger, Rosenblum said.

“Instead of it being every episode as a standalone, we added a storyline that was told more episodically as the mystery unravels,” she said.

Turner has added original, serialized shows like The Alienist and Good Behavior, to TNT, which traditionally has been rerun heavy.

Binging viewers are also less likely to watch ads because most are watching them via their DVRs, which allow them to fast forward past commercials. Forty-three percent of viewers prefer to binge watch shows via their DVRs, compared to only 19% who do so through video on demand, according to Comscore.

To address this, Turner is ramping up brand placement in its shows, for example filming a scene of truTV’s The Carbonaro Effect at Papa John’s Pizza pzza , which sponsored the episode.

CBS is considering adding serialized commercials, to make sure that binge viewers are not exposed to the same ad again and again, and draw them in with a story, said David Poltrack, chief research officer at CBS.

It all comes down to networks realizing that streaming video has become one of broadcast television’s biggest threats, and potentially its salvation, said Dave Morgan, chief executive of Simulmedia, a New York-based ad tech firm.

“If they don’t get viewership, they don’t get paid,” he said.