It was probably the most surprising pickup at this year’s upfronts – a racy, half-hour half-hour comedy pilot for pay cable network Showtime getting a series order as an hourlong series for the CW, a network with a much younger skew that also happens to be on broadcast. Here is how that happened and what changes the show will undergo, including a recasting of the role played in the original pilot by Michael McDonald.

PilotAbout two months ago, Kate Adler and Jim Donnelly, comedy executives at CBS TV Studios, which produced the musical comedy pilot for Showtime, reached out to Gaye Hirsch and Joanna Klein, co-heads of scripted development for the CW, asking them whether they would take a look at the pilot, recently passed over by the premium cable network, as a potential companion to Jane The Virgin. (CBS Studios, the CW and Showtime are all part of the CBS family.) Hirsch and Klein watched it, loved it, showed it to their boss, CW EVP development Thom Sherman who also loved it and, in turn, showed it to the CW president Mark Pedowitz, who also gave it thumbs-up. In Crazy Ex-Girlfriend, a driven young woman (Rachel Bloom) leaves abruptly her successful career as a lawyer in Manhattan to follow her ex-boyfriend to West Covina, California. In addition to having a similar sensibility to Jane The Virgin, Crazy Ex-Girlfriend features a star– actress-comedian Bloom — who is in her 20s, right in the CW’s lead actor sweet spot. She also happens to be a viral star with the music videos of her songs drawing millions of streams.

CW LogoSherman next called CBS TV Studios David Stapf and asked him whether the studio would consider doing the show for them as an hourlong comedy. I hear the first reaction in the studio’s executive suit was that of deep skepticism as the show was a premium cable half-hour, with the content and the high price tag that go with that.

Marc Webb 2AlineBroshMcKennaStill, a meeting was set up at the CW between the CW’s Pedowitz and Sherman, Stapf, Adler, Donnelly as well as Ex-Crazy Girlfriend creators Bloom and Aline Brosh McKenna and the pilot’s director Marc Webb. The network made its pitch, and the two sides discussed ways to expand the show from half-hour to one-hour and adjust it to broadcast standards.

The Crazy Ex-Girlfriend‘s team and CBS TV Studio mulled the idea, with the studio making it clear to the creators that they didn’t have to compromise and should only do the show they wanted to do. Upon examining the pilot, the conclusion was that, aside from the foul-mouth language and a blow-job scene, there was not that much that could’t possibly work for the CW. A plan was put in motion to try and redevelop the show as an hourlong comedy targeted for the 2016-17 season.

That plan got greatly accelerated a couple of weeks ago when the CW execs asked their studio counterparts whether the show could possibly be ready for this comingJane The Virgin - CW season, 2015-16. The answer was yes, and, while Bloom and Brosh McKenna got working on an hourlong pilot script, the half-hour Showtime pilot was screened with the rest of the CW pilots for next season. It was a runaway hit. Then, as the CW executives were heading into New York for scheduling meetings at the beginning of last week, they got the new script. Based on that and the pilot’s reception, Crazy Ex-Girlfriend was put on the board for pickup consideration and ended up paired with Jane The Virgin on the network’s fall schedule. “This was the perfect companion for Jane,” Pedowitz said today. “It is very funny and very different — a blue-skies show with a very dark twist.” Added Bloom, “it’s a dark, screwed-up romantic comedy.”

showtime4__140512213840I hear Showtime brass were informed just before the CW officially picked up the pilot to series, and the pay cable series is expected to recoup the money it’d spent on the project.

Because of Crazy Ex-Girlfriend‘s transformation from half-hour to one-hour, the studio had to make a new deal with the actors. Of the original cast, only Michael McDonald, who had 1-2 scenes in the Showtime pilot, has opted not to come back. He is a busy comedy episodic director, and he had signed on for the role with the intention to also direct episodes of the potential single-camera Showtime series, something he could no longer do because of the format change. Santino Fontana, Donna Lynne Champlin and Vincent Rodriguez III co-star.

While waiting for Showtime’s decision on the original pilot, Bloom and Brosh McKenna had written two more half-hour scripts, so there is some partial roadmap for the series. I hear the new hourlong pilot script was based solely on the Showtime pilot. The first episode of the CW series will feature existing footage from the original pilot while fleshing out and expanding the stories of the supporting characters. The half-hour pilot included three big musical production numbers based on songs by Bloom. I hear in the CW version there will likely be 2 music bits per episode, organically blending into the narrative, with a big production number every couple of episodes. And of course, tweaks have been made to the original dialogue. “We are making minor language changes as we are limited in the word we can use on the CW,” Pedowitz said. You can watch the show’s CW trailer below:

And this is how Crazy-Ex Girlfriend made the improbable leap from the pilot scrapheat at Showtime to the CW fall schedule while changing its format in just a couple of months. Such a happy ending is still the exception, with a slew of busted pilots getting shopped with no success every year. But for all executives and producers of a pilot that was just passed on by the broadcast networks, maybe it’s worth making a couple of extra calls to places that may not seem like an obvious choice. You never know what may happen.