A bunch of classic Doctor Who stories have appeared on DVD recently, and they're full of little gems. Like this suite of deleted scenes in which we learn that two random guards are named Kernighan and Ritchie.

What are the creators of the C programming language doing on Doctor Who? Blame Christopher H. Bidmead, computer textbook writer and the show's former script editor in the early 1980s, who worked lots of computer programming in-jokes into his stories. That's just one of the weird little easter eggs in these latest DVDs.

That one comes from the story "Frontios," Bidmead's final script for the program. The other stories newly on DVD include "Time and the Rani," "The Gunfighters" and "The Awakening."

Pretty much nobody's going to name these stories as their favorites — although quite a few many fans probably have a soft spot for "Frontios." But the DVDs might well be worth checking out in any case, for these little moments of discovery, and for the special features which illuminate just how much this show was being made by the seat of its pants, and how chaotic the show was behind the scenes.

For example, "The Gunfighters" is an utterly forgettable story — a musical comedy Western, in which the Doctor meets Wyatt Earp and scene changes are narrated with Western piano ballads. It has a few funny moments, but not nearly enough to sustain four long episodes. You can't help being a bit sorry that this story still exists in its entirety, when so many classics from the 1960s have been erased.

But the whole thing is totally justified by the lengthy featurette about the third year of classic Doctor Who, and the turmoil that the show went through after original producer Verity Lambert left. I didn't realize half the stuff that's included in that featurette, including the fact that Maureen O'Brien, who played the companion Vicki, was blindsided by having her character written out at the end of "The Myth-Makers." Or that there were several wildly different scripts for "The Celestial Toymaker," with two different script editors rewriting it from scratch.

The impression you get from the featurette "The End of the Line" is one of a show that was in absolute turmoil, with new producer John Wiles coming in with loads of new ideas, only to realize he was saddled with a twelve-part Dalek story and a dark historical epic about France. And star William Hartnell started having more and more meltdowns, at one point upsetting his dresser so much that all the dressers walked off set, potentially delaying the filming. John Wiles and his script editor, Donald Tosh, only lasted a short time before Wiles fell victim to burnout and a new team came in — ushering in another round of companions being blindsided by being written out. And then Hartnell himself was in the process of being written out as well, something that the production team had considered using a variety of methods to accomplish. This may well have been Doctor Who's most turbulent era, and it's fascinating to learn more about.

The other DVD that gives you a window into a time of total chaos in Doctor Who's history is the recently released "Time and the Rani," the first story of Sylvester McCoy's era. And again, you probably don't realize quite how messy this era of the show actually was, until you watch the special features on this disc. After the cataclysm that was "Trial of a Time Lord," producer John Nathan-Turner was ordered to fire Colin Baker as the show's star — which Nathan-Turner agreed to, on the condition that it would be his final action as producer before moving on. And then once Nathan-Turner did the deed, he was told that he had to stay on as Who producer for another year — but only after he'd gone on a long vacation. By then, there were no scripts, and the deadline to start filming was imminent. So if you view "Time and the Rani" as the alternative to 90 minutes of improv in a gravel quarry, then it starts to look sort of okay. Well, actually, scratch that — 90 minutes of improv might have been better.

The funniest part of the "Rani" DVD featurettes is the glimpse of Sylvester McCoy's original audition tapes, in which he acts opposite former companion Janet Fielding, playing a Margaret Thatcher-esque interplanetary dictator. It's one of the most cheesily written Doctor Who scenes ever, plus you get to see two other random actors — chosen just because they made McCoy look good by comparison — doing the same scene opposite Fielding.

"Rani" is probably most famous for its regeneration scene, in which they failed to convince Colin Baker to come back — so they put a curly blond wig on Sylvester McCoy, and he played both the Sixth and Seventh Doctors. At left is a CG-enhanced, slightly improved version of that scene that's available on the disc as an easter egg.

The other two stories that are newly out on DVD, "The Awakening" and "Frontios," aired back to back in 1984. "The Awakening" looks like a bit of a disaster in retrospect — it was originally a four-episode story, but was reduced to two episodes and drastically rewritten after the scripts appeared too thin. A novice director came in to handle the resulting mess, and was unable to make much of it. The most fascinating DVD extra might be the deleted scenes, which include a sequence that would have reintroduced the shape-changing android Kamelion, who was supposed to be part of the TARDIS crew during this era but almost never showed up.

And like I said, "Frontios" is the story that holds up the best out of these four — although it's directed by Ron Jones, who was one of the least imaginative directors of classic Who, and a lot of it sort of falls flat. At least, the story of an Earth colony in the distant future being menaced by burrowing creatures that use the power of gravity and kidnap people for use as spare parts is still pretty menacing and entertaining, after all this time.