The episode's climactic scene is based on the short story "The Final Problem",[REF][REF] in which Holmes and Moriarty square off.
The filming of the visit of Moriarty to Baker St pays tribute to William Gillette's 1899 play Sherlock Holmes and the 1945 film The Woman in Green [REF].