Many eyes were on Riverdale‘s season four premiere Wednesday night, as both fans and critics waited to see how it would pay tribute to Luke Perry, who passed away in March after suffering a stroke. Perry, perhaps best known for portraying Dylan McKay on Beverly Hills, 90210, co-starred on Riverdale as Archie Andrews’s father, Fred. He was a beloved character—a moral compass, of sorts, in what’s otherwise an incredibly dark and dramatic world. Tonight’s episode, appropriately titled “In Memoriam,” honored that.

Early in the episode we learn the cause of Fred’s death: He was driving a few towns over and stopped to help a woman whose car tires blew out. While attempting to fix her car, he was struck by an ongoing vehicle and sustained fatal injuries. The person driving the car didn’t stop after hitting Fred. At first, we think the culprit is a grown man named George Augustine, who Archie goes to confront in a fit of rage. But there’s a twist: George is actually covering for his young son, who secretly took the family’s car out and struck Fred by accident.

Archie is overcome with even more emotion when he finds out how his father died. Essentially, Fred passed away as he lived on Riverdale: helping people. What’s more: George covered up for his son exactly how Fred would’ve for Archie had he done something similar. There’s a resonance to how the show-runners wrote Fred’s death that deserves to be applauded.

Also commendable (and powerful) was including Shannen Doherty, Perry’s 90210 co-star, in the episode. She plays a small but pivotal role as the woman who Fred pulled over to help. Doherty appears midway through the episode, dropping flowers off on the side of the road where Fred was hit. “He saved my life,” she tells Archie. “If he hadn’t done what he did, there’s no way I’d be here right now. I know that.”

Many Beverly Hills, 90210 fans were moved by Doherty’s cameo. Here are just a few Twitter reactions:

The episode, overall, was a respectful, heartfelt, and warm homage to a Hollywood icon. It makes sense that Riverdale creator Roberto Aguirre-Sacasa waited until now to address Luke Perry’s death on the show. Doing it in the spring, so soon after Perry passed, would’ve felt like a rush job—like the show was trying to fit something in at the last minute. But Perry was too important of a figure, both on Riverdale and beyond, to get a quick tribute.