SPOILER ALERT: Do not read if you have not yet watched “The Most Disappointed Man,” the seventh episode of the second season of “This Is Us.”

The past and present day stories within episodes of NBC’s “This Is Us” always have thematic parallels to each other, but perhaps none has thus far been as poignant as in the seventh episode of the second season, “The Most Disappointed Man.”

The episode saw Jack (Milo Ventimiglia) and Rebecca (Mandy Moore) hit a roadblock on the way to adopting Randall in an African-American judge (guest star Delroy Lindo), who thought the boy would be better off placed with a black family, while grown up Randall (Sterling K. Brown) found an obstacle of his own when he met Deja’s mother (Joy Brunson) and learned she planned to get out of jail and get her daughter back.

“We knew we always wanted to do a story in the area of the formal adoption of Randall because in the pilot they bring him home, and then we’re in the future, and we never really told the story of how he became, really, their child. Once we heard the opinion of the time, we knew we really wanted to dive in and explore it in that way,” executive producer Isaac Aptaker tells Variety.

Here, Aptaker talks Variety through working out the details of this episode, including the research done on both the adoption and foster care systems, what’s next for Randall and Deja’s mom, Kate (Chrissy Metz) finally planning a wedding, and Kevin’s (Justin Hartley) addiction.

What kind of research did you do in breaking the story about adoption decades ago?

It really came from the writer of the episode — Kay Oyegun — who came in and brought it to our attention that in 1972 the National Association of Black Social Workers published a statement very much against transracial adoption. So with Randall’s adoption in ’80 or ’81, less than a decade after this has been released, the Pearsons were doing something that at the time was considered very controversial — especially in the African-American community.

What did you learn about the foster care system today?

We’ve had a lot of people come in and talk to us about foster and fost-to-adopt, and what I think is really interesting about fost-to-adopt is the ultimate goal there is reunification with the birth parents. So you’re in this really tricky situation where you’re bringing a child in who, for one reason or another, the birth parents were found unsuitable for the time, and of course you’re probably falling in love with that kid and trying to give them a good home, but the ultimate goal there is that the birth parent or parents complete their treatment plan and get the child back. So there is competing, conflicting what you’re rooting for as a foster parent, and that’s something that I think is so interesting.

What does Randall’s journey look like now? Does he have to prepare himself to say good-bye, or will he fight harder to keep her even if her mother gets released?

Even in this episode we see that conflict within Randall. This whole episode is about them trying to decide how they feel about this woman — she’s so different from them, and she hasn’t been the best mother to Deja but obviously has so much love for her. So it’s a really, really tricky thing.

Randall did let Deja (Lyric Ross) speak to her mother on the phone, so will she be integrating back into Deja’s life in coming episodes?

Yeah, we have the actress — she’s so fantastic, and when she came in, she had the same sort of vocalisms as Lyric, who plays Deja, so as soon as we saw her, we said, “Oh my God, she’s amazing!” Our casting director did a great job matching. But yes, this is not the last you will see of her. It’s a story that’s going to play out over the next few episodes.

How did you come up with the scene with Randall and Deja’s mom? Telling someone how they should parent is not something to which most people are receptive.

It was a really tough scene to write, and we worked on many different rewrites of the scene. I think on our show it’s important that nobody is a full-on hero, nobody’s a full-on villain. We’re trying to examine the complexity of the situation, and for me, Sterling is so great in that scene, but by the end of it, you’re kind of like, “Whoa, Randall! I’m not so sure I totally agree with you.” You know where he’s coming from, but it’s like, “Whoa, dude, that’s her daughter, and she’s only been in your house a few weeks.” He kind of redeems himself in the next scene where he clearly had this off-camera change of heart. But it’s just a testament to both of those performances that in that three- or four-minute scene, Randall, who’s our guy, you’re able to just all of a sudden be like, “Maybe I’m on her side?” It’s not where you may expect to be.

Similarly, the audience has an emotional history with Jack and Rebecca and therefore is armed with reasons why they should be allowed to adopt Randall, but the judge has his own perspective on transracial adoption.

No one there is totally in the right or totally in the wrong. It’s just people from different points of view trying to understand each other. The judge has to make some points where you’re like, “Wow, I didn’t see it that way.”

Was there ever temptation to have either Jack or Rebecca respond to the judge to point out the flaws in the adoption system? Or would they have even known just how hard that system was?

I don’t think they’re necessarily super-educated in that way. You know, this is a time before the internet, and they can’t just Google and have all of the information at their fingertips as we can now. So they’re definitely as informed as they can be, but they made this decision on a whim, and it’s only been about a year now that they’ve had to learn about this, so they’re not coming at this as experts.

How did you come to cast Delroy Lindo and Sam Anderson in their respective judge roles? Was there ever a discussion about what it says to have the judge who helps William (Jermel Nakia) be a kind of white savior?

We talked about it a lot. We talked about what the races of the judges should be, and we ultimately decided that we’d have the two black judges in the one story and the white judge in the other. A lot of it was finding the actors, but also you want to be true to the reality of the world, and it felt like three black judges wasn’t necessarily what the make-up of the judicial system would have been in Pennsylvania at that time. So it was being true to the time and finding amazing people for the jobs.

Turning to Kate and Toby (Chris Sullivan), are they actually going to be moving toward having a wedding this season?

Yes, they’re definitely going to start picking up momentum, and in the back-half of the season, we’ll start really getting some real traction on that. We’re going to do a big, awesome Pearson wedding that will deliver on what everyone is hoping for and what that courthouse wedding couldn’t have possibly been.

Why did you feel it was important to give them some moments of tradition at this stage in their relationship?

It’s about Toby is such a romantic. He loves romantic comedies, and he sees in Kate a woman who deserves everything that she has ever wanted. So we were very mindful of making sure it wasn’t a story that Toby was throwing a wedding that Kate didn’t want on her. It was a case of your partner knowing you better than you know yourself. She just needed a little push from him to say, “Yes, that’s what I really want. Now let’s go for it.”

Is the pregnancy and wedding planning taking the forefront of Kate’s attention, or is music still a big part of her arc?

She’s a have-it-all kind of girl, so I don’t think it’s the case of one or the other. Their lives are going to get a little crazier with the pregnancy and the wedding, but we’re moving forward on all of those fronts, and the singing is getting traction for her, and I don’t think it’s going anywhere.

And with Kevin, how much was his speech to Sophie (Alexandra Breckenridge) just a method of pushing her away before she noticed just how troubled he is?

I think so much of it is about pushing her away. In a way, it mirrors the Kate story, who’s another character who just doesn’t feel worthy. He’s so cognizant of how he hurt her in the past — and how the first time around, he really destroyed her for quite awhile. And I think at this point, he’s pushing her away both to protect her and to protect his growing addiction because he thinks he’s bad news and doesn’t want to hurt her more. He doesn’t want to burden her with more of his drama.

Is this the end for them?

As we saw last year she forgave him for cheating on her and getting divorced, so they’ve come back from bigger obstacles from this. But I think it’s safe to say that for the immediate future, Kevin is not in a place where he should be in a relationship. For everybody’s best interest.

Without her in his life, and with his family so obviously dealing with their own things, is there anyone who can notice what’s going on with him?

You hope it’s Kate, but at the same time, she has the singing and the pregnancy and the marriage. We talked to a lot of people with addiction — particularly pill addiction — and they really are able to hide it from even their closest, closest friends and family members and significant others for such a long time. You saw Kate senses something’s off a little bit, but then she very very quickly accepted his excuses for it and goes back to her thing. He’s doing a very good job of hiding it.

“This Is Us” airs on Tuesdays at 9 p.m. on NBC.