This post contains spoilers for Crazy Ex-Girlfriend Season 3, Episode 6.

Last Friday, Rachel Bloom posted a gentle warning on Twitter: “Hi friends, tonight’s #CrazyExGirlfriend is pretty emotionally intense. Just wanted to give everyone the head’s up.” From the beginning of the episode, which found our protagonist too depressed to leave her mother’s pullout couch, it was clear that Rebecca was hovering just above rock bottom. The ending of the episode was both expected and heartbreaking: Rebecca attempted suicide on a flight back to Los Angeles, taking strong anti-anxiety pills one after another.

This week’s episode, however, offers a ray of hope. As she wakes up from the hospital, Rebecca finds out that a team of doctors has conferred to give her a new diagnosis. In that moment, Rebecca sees a world of possibilities—and as she begins to turn a corner, so does the series.

Since the beginning, Rachel Bloom and her co-creator Aline Brosh McKenna have had a four-cycle plan mapped out for Crazy Ex-Girlfriend. (“We didn’t want to say seasons,” Bloom told V.F. last year. “They were kind of like four sections of this person’s story.”) But Rebecca’s new diagnosis—borderline personality disorder—was not actually part of that initial plan.

“That was something that became clear as we were writing the character,” Bloom said in a phone interview. “You know, I think that this character is a mix of me and Aline. . . . At first it became exaggerations of stuff within us. But as she started doing more diabolical stuff, right—like throwing a brick through a window; getting a fake boyfriend; having that pregnancy scare—these kind of outward plot devices pushed the character beyond, emotionally, what Aline and I had experienced. It’s almost like the plot kind of dictated her emotional swing, even more than we’d planned.”

Both co-creators, Bloom noted, have intimate knowledge of people with borderline personality disorder—and once they realized that their character had begun to exhibit behavior beyond unchecked anxiety and depression, they began to consider whether that might be a more apt diagnosis for Rebecca. To be certain, however, they consulted with a team of doctors.

“We didn’t tell them that we thought it was borderline; we just said, ‘Watch these episodes of the show,’” Bloom said. Their consensus was clear: Rebecca was acting like someone with borderline personality disorder.

With Rebecca’s new diagnosis, the series’ relationship with its title has shifted once more. When the show began, it consciously tried to subvert the term “crazy ex-girlfriend”; Rebecca’s impulses tended to be illogical, but also relatable. (Who hasn’t engaged in a bit of Instagram stalking?) But as the show evolved, some of Rebecca’s actions began to stray further and further from the spectrum of irrational but understandable behavior. (See: poop muffins.) Now, with her diagnosis (and a history including attempted arson), Rebecca fits the bill of what some might call “crazy” to the letter. The genius of the series, though, is that it’s acclimated viewers to Rebecca so much that they’ll feel reluctant to actually describe her with that word.

Once Bloom and Brosh McKenna made the decision to diagnose Rebecca, they knew they needed to make sure their depiction of her disorder was both accurate and, as Brosh McKenna put it, “humane.” Their main objective, Brosh McKenna said, “was to make sure that we were being as kind as possible—to Rebecca and about the situation.”

“We were aware of and trying to be careful about it and specific about it, and not be cavalier about it,” Brosh McKenna said.“But we were excited to kind of dig into the work of it. . . . We really felt like we owed the audience a deeper understanding of her mental health, and where she had been, and where she was going.”