Over the course of two and a half seasons Crazy Ex-Girlfriend's Rebecca Bunch (Rachel Bloom) has schemed and struggled and stumbled in her quest to achieve what she thinks will finally unlock the loving relationship that will ultimately fix her. She has lied to her friends about her past and lied to herself about needing help, but even if she hasn't always been self-aware or willing to accept assistance, that's all changing. After 36 episodes and a heartbreaking suicide attempt, Rebecca is finally getting the help she needs — and she's doing it with her friends by her side.

In Friday's new episode "Josh Is Irrelevant," Rebecca wakes up in the hospital, where Paula (Donna Lynne Champlin), Heather (Vella Lovell) and Valencia (Gabrielle Ruiz) have already gathered. She eventually learns she was previously misdiagnosed and that her doctor believes she suffers from Borderline Personality Disorder, a complex mental disorder that is difficult to diagnosis and difficult to treat. BPD involves a pattern of instability in moods and behavior which can result in impulsive actions and unstable relationships. To be diagnosed a person must exhibit five of nine tendencies — Rebecca exhibits all nine. Perhaps what is most interesting about this is that co-creators Bloom and Aline Brosh McKenna did not know going into the series what the character's diagnosis was going to be.

"We wrote her by feel for a while. We kind of wrote her behavior in a way that felt right to us for about a season and a half," McKenna revealed at a recent press screening. "Then Rachel and I started to realize that we were ... trying to help Rebecca, so we were trying to figure out what was wrong with her, and as we looked into it, so much of this seemed to resonate for her. As you see in the episode, she really has a lot of the classic hallmarks of this behavior."

Crazy Ex-Girlfriend Showrunner Discusses Rebecca's Heartbreaking Choice

But finally having the proper diagnosis is still only part of the answer for Rebecca in terms of actually getting help and moving forward. She'll have to go through treatment, which includes actually taking medication and attending group therapy, the latter of which fans will see in future episodes. But it doesn't mean she won't still be struggling.

"Just because she has a name for it doesn't mean that, all of a sudden, all of her behavior is going to be different. In many ways, it kind of enhances her struggle because it makes it harder," said McKenna. "Now when she's doing things, she kind of knows what she's doing and why. There's a certain way in which that makes her confused and angry. And with mental health stuff, there's a lot of one step forward, two steps back. ... [Rebecca] now has a name for this whole host of behaviors, but the host of behaviors are so deeply rooted in her that she's going to continue to struggle with it, but struggle with more information."

Jay Hayden and Rachel Bloom,<em> Crazy Ex-Girlfriend</em>Jay Hayden and Rachel Bloom, Crazy Ex-Girlfriend

The good news for Rebecca is that she isn't going through this alone; Crazy Ex-Girlfriend has been working on building a support system of friends and loved ones for her since the pilot. In fact, Rebecca's friendships with Paula, Heather and Valencia have become the foundation that supports the series. They are what allow the series to regularly subvert romantic comedy tropes. They are what anchor the hilarious and often skewering musical numbers that appear in each new episode. They are what infuse the story with much-needed heart. So even when those same relationships bring with them their own set of complicated issues, like Paula's over-involvement in every aspect of Rebecca's life, they are a necessary cog in the Crazy Ex-Girlfriend machine. And so although "Josh Is Irrelevant" carefully depicted Rebecca coming to terms with her mental illness in a respectful but totally-in-character manner, the episode also highlighted the part of this narrative that's perhaps less frequently explored: how her diagnosis affected the loyal women who are her support system.

Crazy Ex-Girlfriend Sings the Praises of the Zoo in Your New Favorite Song

Heather was the most collected and emotionally grounded of Rebecca's core friend group, which isn't to say she was unaffected by Rebecca's suicide attempt, just that she understood the delicate necessity for boundaries and space in the aftermath as Rebecca processed what happened and her subsequent diagnosis. However, Heather was also ready to lead the charge when Rebecca wasn't responding from the other side of a locked bathroom door, pulling an ax seemingly from nowhere with the intention of tearing the door down. None of this is a surprise, as Heather has always been a firm, if hilariously dry, voice of reason in the show's heightened moments, understanding others even if she doesn't always understand herself.

But if Heather was seemingly in control of her actions and emotions, Paula's need to parent Rebecca took their already unhealthy relationship to a new level as she inserted herself into every nook and cranny of Rebecca's life. Whether she was attempting to be her nurse, her therapist or her mother, Paula's codependent relationship with Rebecca frequently raised red flags regarding her own issues. According to McKenna, it is something the show will begin to address in the next episode, when Paula returns home to Buffalo.

"There are things in Paula's own story that made her connect to Rebecca so much, and we learned a little bit about those in the pilot, ... but in terms of that being the love story of the show, which we've always felt it is, it's not a completely functional relationship," explained McKenna. "There's a lot of love there, but they're always trying to figure out their boundaries. And Rebecca always wants to do the best by Paula, but she isn't always able to do it. And that really continues to be a theme, because as Paula tries to get healthy and Paula goes to law school and Paula ties to have better boundaries, she's still dealing with someone who is pretty immature and working on her own stuff."

Crazy Ex-Girlfriend: Rebecca Officially Hits Rock Bottom — So Now What?

Elsewhere, Valencia threw herself into the role of Rebecca's social media spokesperson. While Rebecca was in the hospital, she posted daily video updates on her progress, but it quickly became clear that Valencia's videos were merely a way of coping with what happened without actually processing it. Everything eventually came to a head after the aforementioned bathroom incident, when Valencia broke down crying and asked Rebecca to promise to never attempt to hurt herself again.

Rachel Bloom, Donna Lynne Champlin, Vella Lovell and Gabrielle Ruiz, <em>Crazy Ex-Girlfriend</em>Rachel Bloom, Donna Lynne Champlin, Vella Lovell and Gabrielle Ruiz, Crazy Ex-Girlfriend

Although Valencia's intense emotional reaction may have been surprising to some fans, viewers must remember that Valencia's friendship with Rebecca is also new territory for her. Although she has come relatively far from where she was was at the start of the series, she has never really had friends and therefore hasn't been in the position of caring about someone other than herself. She was belatedly overcome with emotion as a result, and her reaction is likely familiar to many people who've had the unfortunate experience of a similar trauma. It's nearly impossible to understand what drives someone's actions, but attempting to ignore the accompanying emotions in the aftermath isn't healthy either.

Altogether, the reactions of the three main women in Rebecca's life encompassed a variety of coping mechanisms, with Paula at one end of the spectrum trying to fix everything and Valencia at the other almost ignoring the severity of it completely. But they all came together in the end, something that was important, and very special, to McKenna. "I just love that they all understand how important it is that they found each other," she said. "I'm just very moved by the fact — and so is Rebecca — that she did horrible things to them and they all, without a second thought, come together for her in the hospital and then they support her through a diagnosis."

This isn't the first time Rebecca has been moved or perhaps even surprised by her friends' loving actions, but Rebecca has also lacked a strong support system for a very long time. That the show took the time to focus not just on Rebecca but also her friends and how they processed her heartbreaking decision is not surprising in the least as it is equally important to the overall narrative surrounding mental health. By showing the many ways people react to traumatic events like a loved one's suicide attempt, it reveals that everyone copes differently. It also shows that when someone is suffering from a mental illness, there's also no right way to handle it. Getting treatment takes time and sometimes just showing up when a friend needs support is the best thing anyone can do, because none of this is easy.

In many ways, Rebecca's suicide attempt last week and subsequent diagnosis this week were just the beginning of her story. Although we've spent more than 30 brilliant, funny, emotional hours with her already, she's been stuck in her own head for so long she's only now beginning to understand and accept the truth that viewers have known from the beginning. And so are her friends. As the show moves forward, Rebecca is going to have to work to get better, but with a circle of friends and loved ones there to act as a support system, she finally has all the pieces in place to be successful. She might finally, eventually be able to achieve her version of happiness.

Crazy Ex-Girlfriend airs Fridays at 8/7c on The CW.

(Full disclosure: TV Guide is owned by CBS, one of The CW's parent companies.)