In the second-ever episode of Westworld on HBO, before he turned into a ruthless, super-rich cowboy cosplayer, William, the show’s conflicted antihero, was asked to choose between a white or a black hat. He chose the white hat, but that would change.

As the season went on, it became extremely evident that the hats weren’t just there so park guests could play make-believe — they were morally symbolic, a tool to visually pinpoint William’s malevolent journey to become the Man in Black.

Now in Season Two William reveals that the hats have another purpose — and are something that real-life neuroscientists would probably want to test in a lab.

Mara Mather, Ph.D. a professor of gerontology and psychology at the University of Southern California, tells Inverse that the Westworld cowboy hats create a sci-fi scenario that’s “not implausible” and are “a natural extension of what we have today.”

But first: This post contains spoilers for Westworld Season 2 Episode 9. If you haven’t seen it, cease all motor functions.

William, Westworld
William as a White Hat in Season 1.

In typical Westworld fashion, Season 2 has been one of major reveals and sophisticated, technological concepts. We now know that one of the main goals of the Delos corporation is to copy human consciousness and place that into a Host — hypothetically providing people with the means to live forever. Copies of the minds of every human whose visited Westworld are stored in a place called the Forge, which the Hosts have been calling the Valley Beyond. We got a peek at it in Episode 8 when Akecheta stumbled upon it, believing it to be a door to another world.

But exactly how guest minds have been copied has been a mystery — until (somewhat) now. In a conversation between William and his daughter (or it could be a Host version of his daughter), he lets it slide to Emily (who in early cast announcements was called Grace) that the hats have been an integral tool all along.

We get to that point after a brilliant display of science word-salad. To duplicate a person, Emily points out, Delos would need to “capture them down to the tiniest detail.”

“I get the data you have access to here — genetic, epigenetic, that’s easy,” Emily explains, without telling us exactly why that would be so simple. “But still, you’d need to a complete picture of the internal process of their cognition, wouldn’t you?” She questions how they could have been scanning for that information and, with an adjustment of his hat, William informs her that they were built in.

Emily, William, Westworld
Emily and William discuss the park.

In real life, the closest thing we have to a Delos cognition-scanning cowboy hat is a fMRI, or functional magnetic resonance imaging, machine. This is used to map and measure brain activity in a way that’s noninvasive and safe. Researchers have used in a smorgasbord of ways — from determining what parts of the brain activate when someone watches porn to determining what neural connections are made when someone is being creative. Scientists have also gotten really into the potential of fMRI machines — in 1993 there were less than 20 published studies that used fMRI and by 2003 that number jumped to 1,800.

In turn, scientists believe that fMRI can be used to better understand human cognition — the mental process of acquiring knowledge and understanding through thought.

“Currently, fMRI provides us with some crude mind-reading capabilities,” Mather explains. Using it researchers can guess pretty well about how people are thinking about certain things — Mather says that they even can use it to tell whether someone is thinking about playing tennis or about someone else’s face.

“As long as we have some training data to learn your individual brain patterns, we can extract a blurry rough image of what your visual cortex is seeing or imagining,” says Mather. “Eventually, the machinery is likely to get more powerful and smaller — perhaps even small enough to fit into a hat.”

It might seem like pure-HBO prestige TV to have a hat that reveals a person’s “internal process of cognition” — but we already have a tool that can assess what happens to a brain when it creates a memory, completes a task, or simply matures and develops.

We currently don’t have the power to turn that information into robots complete with a human mind — but it’s probably for the best that stays in Westworld.