The Shakespeare Code

"The Shakespeare Code" is the second episode of the third series of the revived British science fiction television series Doctor Who. It was broadcast on BBC One on 7 April 2007. According to the BARB figures this episode was seen by 7.23 million viewers and was the fifth most popular broadcast on British television in that week. Originally titled "Love's Labour's Won", was also titled by David Tennant as "Theatre of Doom" during the "David's Video Diaries 2", part of the Series 3 DVD, the episode was re-titled as a reference to The Da Vinci Code.

In the episode, the alien time traveller the Doctor (David Tennant) takes his new travelling companion Martha Jones (Freema Agyeman) in her first trip in time and space. They arrive in 1599 near the Globe Theatre in Southwark, where they meet the playwright William Shakespeare. Shakespeare is being bewitched by three witch-like Carrionites to rewrite the ending to his play Love's Labour's Won so that the performance will create the right words to free the rest of the Carrionite race from imprisonment.

Plot
The Tenth Doctor, who promised to take Martha on one trip, takes her to a performance of Love's Labour's Lost at the Globe Theatre in Southwark in 1599. At the end of the play, William Shakespeare announces a forthcoming sequel entitled Love's Labour's Won. A witch called Lilith uses a voodoo doll to influence Shakespeare to declare that the new play will premiere the following evening. When Lynley, the Master of the Revels, demands to see the script before allowing the play to proceed, Lilith plunges a voodoo doll made of his hair into a bucket of water and stabs it in the chest. Lynley collapses on the ground dead. Lilith compels Shakespeare to write a strange concluding paragraph to Love's Labour's Won before flying away on a broom.

In the morning, the Doctor, Martha and Shakespeare proceed to the Globe Theatre, and the Doctor asks why the theatre has 14 sides. They decide to visit the architect of the theatre in Bethlem Hospital. They find the architect, Peter Streete, in a catatonic state. The Doctor helps him emerge from his catatonia long enough to reveal that the witches dictated the Globe's tetradecagonal design to him. The witches Lilith, Doomfinger, and Bloodtide observe this through their cauldron, and Doomfinger teleports to the cell and kills Peter with a touch. The Doctor identifies the witches as Carrionites, a species whose magic is based on the power of words which allows them to manipulate psychic energy. By uttering the name Carrionite the Doctor is able to repel her.

The Doctor deduces that the Carrionites intend to use the powerful words of Love's Labour's Won to break their species out of imprisonment. The Doctor confronts Lilith, who explains that the three witches were released from their banishment by Shakespeare's genius words after he lost his son Hamnet. Lilith temporarily stops one of the Doctor's two hearts and flies to the Globe Theatre. Shakespeare fails to stop the play from being performed. The actors speak the last lines of the play. A portal opens up, allowing the Carrionites back into the universe. The Doctor tells Shakespeare that only he can find the words to close the portal. Shakespeare improvises a short rhyming stanza but is stuck for a final word until Martha blurts out Expelliarmus. The Carrionites become trapped in a crystal ball the Doctor locks away in the TARDIS and all the copies of Love's Labour's Won are sucked back through the closing portal.

Shakespeare in Doctor Who
Shakespeare has appeared in one earlier Doctor Who episode, and the Doctor has also mentioned prior meetings. The Bard is seen by the Doctor and his companions on the screen of their Time-Space Visualiser in The Chase (1965), conversing with Elizabeth I; in Planet of Evil (1975), the Fourth Doctor mentions having met Shakespeare, and in City of Death (1979) he claims that he helped transcribe the original manuscript of Hamlet; and in The Mark of the Rani (1985) the Sixth Doctor says "I must see him [Shakespeare] again some time".

Among non-TV material, Shakespeare features in the Virgin Missing Adventures novels The Empire of Glass and The Plotters, and in the Big Finish Productions audio drama The Kingmaker. In another Big Finish drama, The Time of the Daleks, a child is revealed to be Shakespeare at the story's end. This has a sequel in Ian Potter's short story Apocrypha Bipedium in Short Trips: Companions, which concerns the young Shakespeare's anachronistic meeting with some of the characters he will later portray in Troilus and Cressida. Finally, the Bard also appears in the Doctor Who Magazine Ninth Doctor comic A Groatsworth of Wit (also written by Gareth Roberts).

Producer Russell T Davies and screenwriter Gareth Roberts have both stated that they were aware of these past references to meeting Shakespeare, but that they would neither be mentioned nor contradicted in the episode. Roberts added that although an early draft of "The Shakespeare Code" contained "a sly reference to City of Death", it was removed because "it was so sly it would have been a bit confusing for fans that recognised it and baffled the bejesus out of everyone else."

References to earlier Doctor Who episodes and stories
The name of the Carrionites derives from screenwriter Gareth Roberts' own New Adventures novel, Zamper (1995), which refers to a slug-like race known as "arrionites". Roberts has said, "I always thought it was a nice word, and I was thinking of the witches as carrion creatures, so I bunged a C in front of it".

In Douglas Adams' lost adventure Shada, there is a passing reference to a Time Lord, Scintilla, who was imprisoned for conspiring with Carrionites; the novelisation of Shada was also written by Roberts.

There are several references to races from earlier Doctor Who episodes. At one point, the Doctor uses the title "Sir Doctor of TARDIS," which had been awarded to him by Queen Victoria in "Tooth and Claw" (2006). The Carrionites' contribution to Love's Labour's Won includes a reference to "Dravidian shores"; a "Dravidians starship" is mentioned in The Brain of Morbius (1976). Lilith refers to the Eternals, a race introduced in the original series serial Enlightenment (1983). In addition, the Doctor finds a skull in Shakespeare's prop store that reminds him of the Sycorax race from "The Christmas Invasion" (2005); when the Doctor mentions the name "Sycorax" to Shakespeare, Shakespeare says that he will use the name (the joke is that the name in fact derives from Caliban's mother in Shakespeare's play The Tempest.)

Other sequences include subtle references to much earlier episodes. One of the putative lines of Love's Labour's Won, "the eye should have contentment where it rests", is taken from episode three of the 1965 serial The Crusade — a story consciously written in Shakespearean style.

References related to Shakespeare
The episode concerns the "lost" Shakespeare play Love's Labour's Won, which is referred to in more than one historical document, but which may be just an alternative title for an extant play. Historically, a reference to Love's Labour's Won (in Francis Meres's Palladis Tamia, Wits Treasury, 1598) predates the construction of the Globe Theatre (1599).

The Doctor and Martha make numerous references to Shakespeare's appearance: she notes that he looks nothing like his portrait, and wonders why he is not bald, while the Doctor says he could make his head bald if he rubs it and later gives him a ruff to keep (calling it "a neck brace"). Shakespeare himself speaks with a noticeable Midlands accent, a reference to his birth and upbringing in Stratford-upon-Avon.

The episode makes reference to the many debates about Shakespeare's sexuality. Shakespeare flirts with Martha multiple times during the episode, and ultimately composes Sonnet 18 for her, calling her his "Dark Lady". This is a reference to the enigmatic female character in Shakespeare's Sonnets, although Sonnet 18 is in fact one of those addressed to a male character, the Fair Youth. Shakespeare subsequently flirts with the Doctor as well, at which the Doctor observes, "Fifty-seven academics just punched the air," a reference to the debates on this subject.

There is a running joke throughout the episode in which the Doctor creates an apparent ontological paradox by inspiring Shakespeare to borrow phrases that the Doctor quotes from his plays. Examples of this include the Doctor telling Shakespeare that "all the world's a stage" (from As You Like It) and "the play's the thing" (from Hamlet), as well as the name Sycorax from The Tempest. However, when Shakespeare himself coins the phrase "To be, or not to be", the Doctor suggests he write it down, but Shakespeare considers it "too pretentious". In a different version of the joke, the Doctor exclaims "Once more unto the breach", and Shakespeare initially likes the phrase, before realising it is one of his own from Henry V, which was probably written in early 1599. When questioning Shakespeare about witches, Martha remarks that he has written about witches; a reference to Macbeth, which Shakespeare denies. At the time in which the episode is set, Shakespeare had yet to write Macbeth or Hamlet, which prominently feature the paranormal, such as witches and ghosts.

There are numerous other allusions to Shakespeare's plays. Just before the Doctor steps out of the TARDIS, he exclaims "Brave new world", from Act V Scene I of The Tempest. In an early scene a sign is glimpsed for an inn named "The Elephant". This is the name of an inn recommended in Twelfth Night. The three Carrionites allude to the Weird Sisters from Macbeth (which was written several years after the setting of this episode); like them, the Carrionites use trochaic tetrameter and rhyming couplets to cast spells. When regressing the architect in Bedlam, The Doctor uses the phrase "A Winter's Tale", whilst the architect himself uses the phrase "poor Tom" in the same way as the 'mad' Edgar in King Lear.

Lilith credits the Carrionites' escape from the Eternals' banishment to 'new...glittering' words. Shakespeare is credited with adding two to three thousand words to the English language, including 'assassination', 'eyeball', 'leapfrog' and 'gloomy'.

The character Kempe is William Kempe, a highly regarded comic actor of the era, who was a member of the Lord Chamberlain's Men along with Shakespeare and Richard Burbage.

Wiggins is named after Doctor Martin Wiggins, a distinguished academic in the field of Elizabethan and Jacobean literature and the editor of several editions of influential plays of this period. Wiggins is also a Doctor Who fan and a friend of writer Gareth Roberts. According to Roberts, "if anyone was gonna trip me after transmission it'd be him, so I thought I'd butter him up first".

Other
There are several references to the Harry Potter franchise. At one point, Martha says "It's all a bit Harry Potter", which prompts the Doctor to claim that he has read the final book in the series (which would not be released until three months after the episode was aired; the Doctor refers to it as "Book 7" because the title had not been made public at the time of filming). At the end of the episode, Shakespeare, the Doctor and Martha use a word from Harry Potter, "Expelliarmus", to defeat the Carrionites, and the Doctor exclaims "Good old J.K.!". These references include some metatheatrical humour, since David Tennant played the villain Barty Crouch, Jr in the film adaptation of Harry Potter and the Goblet of Fire.

There are several references to the paradoxes of time travel. Martha mentions the possibility of killing her grandfather, an allusion to the grandfather paradox, when she first steps from the TARDIS. She also suggests that stepping on a butterfly might change the future of the human race, an idea that originates in Ray Bradbury's 1952 short story A Sound of Thunder. The Doctor explains how history could be changed with devastating results by referring to the movie Back to the Future. Martha scorns this explanation by saying 'The film?' to which the Doctor retorts 'No, the novelisation! Yes the film!'. There is indeed a novelisation of Back to the Future, written by George Gipe.

Some of the words and names used are derived from other works. The Doctor claims Martha comes from Freedonia, a fictional country in the Marx Brothers film Duck Soup - it was also used as the name of a planet in the Doctor Who novel Warmonger (2002) by Terrance Dicks. The planet Rexel 4 is named in an episode of The Tomorrow People from 1974.

The Doctor quotes the line, "Rage, rage against the dying of the light," from "Do not go gentle into that good night" by Dylan Thomas — but warns Shakespeare he cannot use it as it is "somebody else's".

Writing and pre-production
The episode was Gareth Roberts' first writing credit proper on the show, but he had written for Doctor Who many times before. He started writing some Virgin New Adventures, a series of Doctor Who novels, with The Highest Science (1993). He went on to write several more books for Virgin Books and further Doctor Who spin-offs. With the new TV series, Roberts again produced a tie-in novel (Only Human, 2005) and then various smaller jobs for the TV show, including the "Attack of the Graske" digital television interactive mini-episode and the TARDISODEs.

As revealed in Doctor Who Adventures issue 30, this episode had the working title of "Loves Labour's Won". By the time of production, however, the title had been changed to "Theatre of Doom", according to David Tennant's video diary shot during production and included as a bonus feature of the Series 3 DVD set. Tennant remarks that the title would likely change before broadcast, suggesting "Theatre of Doom" was only a temporary title.

The ending featuring Queen Elizabeth was Russell T Davies's idea, who told Roberts to "make it a bit like the ending of The One Doctor", a Big Finish Productions audio drama also written by Roberts.

The scene in which the Doctor and Martha share a room was originally written to have the Doctor casually undress down to his underwear; and still obliviously invite Martha to share the bed. It was rewritten as the producers and Tennant thought it would be inappropriate.

Filming
Filming for the episode took place from 23 August to 15 September 2006. Production started at the production team's Upper Boat Studios in Trefforest for the scenes in the Crooked House.

Production then went on a week of location night shoots, beginning in Coventry, including Ford's Hospital, for one night, before moving to the Lord Leycester Hospital at Warwick. Scenes set in the Globe Theatre were then partially filmed in the recreated Globe Theatre in London.

Apart from Newport Indoor Market, where the scenes at Bedlam, as the Bethlem Royal Hospital was known as then, were recreated in the basement, the remainder of the shoot took place in Upper Boat Studios, for the scenes set in the Elephant Inn, sections of Globe Theatre material, and the TARDIS scenes.

In SFX magazine #152, producer Phil Collinson called this episode the "most expensive ever", because of the large amounts of CGI and filming in Warwick, Coventry and London.

Special effects
The special effects on the episode were done by The Mill, who have created the special effects on all Doctor Who episodes since its return in 2005. The vast amount of CGI work required was mainly for the climax of the episode.

One shot of the Doctor and Martha looking at the Globe Theatre was changed between the Series Three preview at the end of "The Runaway Bride" and the final episode; the edge of the Globe Theatre has been replaced with a CGI shot of a village and the distant theatre itself.

Broadcast and reception
The episode was first broadcast at 7pm on 7 April 2007. It was seen by 7.2 million viewers, and was the fourteenth most watched programme of the week.

"The Shakespeare Code", along with "Smith and Jones" and "Gridlock" was released on a DVD on 21 May 2007. It was then re-released as part of the Series Three boxset in November 2007.

Scott Matthewman of The Stage gave "The Shakespeare Code" a mostly positive review, highlighting the guest performances and the theme of the power of words. Digital Spy's Dek Hogan found the plot "ludicrous" but praised the production values and special effects. He speculated that he might like it better when watching it again later after he has warmed up to Martha. Nick Setchfield, writing for SFX, awarded the episode five out of five stars, finding the production "confident". He praised the acting, "witty" script, and the concept of the Carrionites' witch-like appearance. IGN reviewer Travis Fickett rated the episode 7.2 out of 10. He found the plot "straightforward", but still said it was entertaining with a good performance by Kelly.