Warning: The following article contains references to sexual violence. 

The fifth episode of American Horror Stories episode 5 follows Liv Whitley, a young wife who is desperate to have a baby with her husband. After she accidentally uses a demonic statue to help with her fertility, she successfully becomes pregnant and has her baby — but the consequences prove to be more sinister than she can handle.

The demonic pregnancy bears a familiar resemblance to Roman Polanski’s classic horror movie Rosemary’s Baby (1968). The film also documents a young, pregnant wife who suspects her neighbors are in a satanic cult, ultimately discovering her baby and husband are connected to the occult-based plan. The satanic connection to the baby and husband in American Horror Stories takes from the Rosemary’s Baby twist of the infant being the product of a demon, but creator Ryan Murphy adds a few of his own disturbing twists to the homage.

Related: American Horror Stories Drive In Ending: Rabbit, Rabbit’s Future Explained

The end of Rosemary’s Baby shows Rosemary discovering that her baby is actually the antichrist, having been the product of Guy and the Castevets arranging for Satan to rape and impregnate her. She comes up to their ritualistic satanist meeting, horrified by what’s happened to her and what her baby is, but is ultimately shown giving in to her maternal instincts. Liv’s baby Aaron is technically Matt’s because the earlier demon statue was fake, but once Liv actually conjures the real Ba’al, American Horror Stories’ twist ending is revealed: Liv used the demon to kill all of Matt’s friends and pin him for their murders in revenge, ultimately engaging in a consensual sexual relationship with Ba’al, asking him to give her another baby.

The major difference between the two stories is that Rosemary was horrified that her child was the antichrist, while American Horror Stories suggests Liv wants to have sex with Ba’al and desires a demonic antichrist baby. Additionally, Liv’s maternal instincts don’t kick in until she’s confident with Ba’al at her side, while Rosemary is terrified by the Satan connection but instinctually cares for her baby. The husbands’ acting careers also play slightly different roles in their malicious intentions, with Guy using the satanist connections to advance his career and Matt using his acting skills to gaslight Liv into thinking she’s insane.

The American Horror Stories episode also recalls Rosemary’s Baby’s theme of paranoia and gaslighting for its plot. In the former, Liv’s husband and her friends have been pretending to be the demon haunting her, while making her believe she’s crazy for what she’s seeing. Similarly, Rosemary’s Baby involves Rosemary being told she’s paranoid for her suspicions of the Woodhouse’s neighbors and a satanic association, even though she has been correct and her husband and neighbors have been grooming her baby for a satanic purpose. Another aspect that American Horror Stories puts a twist on from Rosemary’s Baby is that Liv actually gets revenge on Matt and his friends for torturing her, while Rosemary must succumb to dealing with the satanic cult.

Next: Why The Devil's Candy Is Rosemary's Baby From A Male POV