When Crazy Ex-Girlfriend star and co-creator Rachel Bloom first told me that Darryl Whitefeather would come out as bisexual this season, I was thrilled.

Not only are media representations of bisexual people practically nonexistent, what few there are tend to be resoundingly negative. Positive depictions of bisexual men are especially rare. According to a GLAAD report (PDF), there were only two male bisexual characters on broadcast TV in 2015. Many bi TV characters, as GLAAD noted, are still depicted as “self-destructive,” “untrustworthy,” and “lacking a sense of morality.”

The old stereotypes, it seems, are alive and well. But if there’s a show that I would trust to subvert them, it’s Crazy Ex-Girlfriend, which has already delivered such nuanced characters as Rebecca Bunch (Bloom), a romantic lead suffering from depression, and the hunky “Asian Bro” Josh Chan (Vincent Rodriguez III).

With Darryl (Pete Gardner), Rebecca Bunch’s awkward but good-hearted boss, the show has done it again. Over the past few episodes, Crazy Ex-Girlfriend has produced the single most authentic and positive portrayal of bisexuality ever seen on network television.

Now that Darryl’s secret is out, I checked in with Crazy Ex-Girlfriend co-creator and The Devil Wears Prada screenwriter Aline Brosh McKenna to learn how this storyline came about.

Turns out, GLAAD itself played a big role. Because neither Bloom nor McKenna had direct experience with the subject matter, they asked a representative from the LGBT media organization to provide input on the character.

“One of the things that we learned was the extent of the stereotypes,” McKenna said.Those stereotypes include the idea that bisexuality is just a phase or that it automatically implies sexual promiscuity. There’s also a common perception that people, especially men, can’t even be bisexual—only gay or straight, one or the other.

“I sent [songwriter Adam Schlesinger] a list of what I understood to be the most prevalent stereotypes and he took that and ran with it and came up with something so joyful,” McKenna recalled.

The result is “Getting Bi,” a celebratory coming out tune in which Darryl busts myths about bisexuality in the style of Huey Lewis and the News, complete with a saxophone solo. In a show filled with great musical numbers, it’s one of the best.“It’s not a phase, I’m not confused,” Darryl sings. “Not indecisive. I don’t have the gotta-choose blues. I don’t care if you wear high heels or a tie. You might just catch my eye because I’m definitely bi.”

And in response to the myth that bisexuality, as McKenna puts it, is just a “waystation on the way to being gay,” Darryl belts out the beautiful lines: “Now some may say, ‘Are you just gay? Why don’t you just go gay all the way?’ But that’s not it cuz bi’s legit! Whether you’re a he or she, we might be a perfect fit.”

There’s never been anything like this on television. It’s exactly the sort of bisexual visibility that’s been sorely lacking as the medium grows more diverse. Even though bisexuals in America outnumber gays and lesbians combined, there were four times as many gay and lesbian characters on broadcast TV last year than bisexual ones according to GLAAD (PDF).

But Bloom and McKenna weren’t trying to check off a box on a diversity checklist, they were simply looking for new ways to represent the realities they saw around them.

“I can’t remember exactly how the idea of [Darryl] being bisexual came up but it did,” said McKenna. “And we both had the same reaction, which was that it was something that we had seen a lot in our lives—we knew a lot of people who were bi—but we hadn’t seen it so much on television and also maybe not so much in comedies.

“We wanted to reflect what we see and experience in our lives,” she added. “We didn’t have any kind of overall agenda in taking on that storyline, it’s really just about good stories and good characters.”

The storyline itself has unfolded slowly over the last five or so episodes and, in so doing, Crazy Ex-Girlfriend has avoided one of the most common pitfalls identified by GLAAD (PDF), namely treating bisexuality “as a temporary plot device that is rarely addressed again.”

First, Darryl’s fitness instructor White Josh—so-named to differentiate him from Josh Chan—surprises him with a kiss on the cheek at the end of a party. When they rehash the smooch in a subsequent episode, White Josh assumes that Darryl is only interested in men and Darryl reacts defensively, awkwardly bringing up his ex-wife as proof that he’s not gay.

But after scoping out some butts of different genders during a barefoot cardio mamba class, Darryl comes to the realization that he is—as he so adorably puts it before learning the proper term—“bothsexual.”After this epiphany, Darryl wants to jump feet first into a relationship with White Josh but he’s also reluctant to be seen dating another man where his co-workers might see him. White Josh, on the other hand, has been out as gay since he was a teenager, and refuses to go back in the closet for an older but less experienced man.

“I think that there’s something poignant about somebody at a later stage of their life coming to this realization while in a relationship with someone who has been out and [for whom] it’s not a big deal,” McKenna said.

It’s this difference between Darryl and White Josh that makes their romance so precious. White Josh shows Darryl some of the LGBT ropes, most notably by teaching him the word “bisexual.” And Darryl, in all of his post-coming out innocence, is giddy at the thought of merely kissing White Josh on the lips.

But their different life stages also provide the writers with much-needed fuel for conflict. It would be tempting to hypercorrect for the negative media representation of bisexuals by making Darryl infallible, but it’s more helpful for the show to simply treat him as human. And that’s exactly what McKenna and crew have been so careful to do.

“This is not a couple that’s going to sail off into the sunset with no further problems,” she assured me. “They’re going to have the same vicissitudes that any couple has. I don’t want this to be a thing where Darryl figures this out about himself and then we park him in some unrealistically happy situation.”

In 2016, it shouldn’t be revolutionary to simply have a bi male character on television who’s treated the same as any other character. But it is. And while McKenna and Bloom might not have set out to explicitly help bisexual people with their show, they almost certainly have.

“Though bisexual people make up the majority of the LGBT community, they are less likely than their gay and lesbian peers to be out to the people they love because their identity is constantly misconstrued as either a form of confusion, a lie, or a contrived and hypersexualized means to an end,” GLAAD media strategist and bisexual advocate Alexandra Bolles noted (PDF). “Perpetuating these tropes undermines the truth that bisexuality is real and that bi people deserve to be treated equally and fairly.”

Research does indeed show that bisexual people are unlikely to be out to their loved ones and that they have a high prevalence of mood and anxiety disorders. When Pew asked LGBT adults in 2013 how much acceptance there was for each letter of that acronym, only 8 percent said there was “a lot” of acceptance for bisexual men—the worst score for any sexual orientation and proof of the unique stigma those men face.

And if these problems are, in part, fueled by stubbornly negative media portrayals of bisexuality, then a character like Darryl Whitefeather is a solid step toward undoing some of that damage.

“That makes us happy,” McKenna said when I told her how important I thought the storyline would prove to be. But she quickly turned to imagine how her character might react to that praise.“No one would be happier about that than Darryl,” she said.