O'Brien (his final assignment for The Simpsons; by the time this episode aired, his brand-new late night show on NBC had been on for a little over a month), Bill Oakley, Josh Weinstein, Greg Daniels, Dan McGrath, and Bill Canterbury. It is the fourth episode of the annual Treehouse of Horror Halloween specials. As with the rest of the Halloween specials, the episode is considered non-canon and falls outside the show's regular continuity. O'Brien worked on the "wrap-arounds" of Bart introducing each segment to make sure that they "pulled" the episode together. The wrap-arounds are based on Rod Serling's television series Night Gallery, in which Serling appears at an art gallery and introduces each episode by unveiling paintings depicting the stories. Executive producer James L. Brooks loved the show, so it was "great fun" for him to do the parody. Show runner David Mirkin thought the Treehouse of Horror episodes were the hardest episodes to do because the staff had to fit in all three stories in only 22 minutes. Mirkin said, "Things had to happen really fast. They're really just crammed with jokes and story beats and everything." The first segment, "The Devil and Homer Simpson", was written by Daniels and McGrath. The first time Devil Flanders appears, he looks the same as the devil Chernabog from the 1940 Walt Disney produced film Fantasia; Silverman particularly admired the animation in that sequence. Oakley loved the idea of Flanders being the Devil because he was the character whom viewers would least expect. He also thought Harry Shearer did a good job of playing Flanders in a much darker way, while remaining very true to the character. Many scenes had to be cut to shorten the segment, including one that showed Homer's severed head being used as a bowling ball by a demon in hell. This scene later appeared in the clip show episode "The Simpsons 138th Episode Spectacular", which aired in the show's seventh season. The second segment, "Terror at Feet", was written by Oakley and Weinstein. It was inspired by an episode of The Twilight Zone called "Nightmare at 20,000 Feet", in which William Shatner's character is inside an airplane watching a gremlin tear apart the wing. Silverman watched the episode to get inspiration for Bart's facial expressions. Oakley said there was a lot of work put into the design of the gremlin in "Terror at Feet" to make