Not long after it began in 2009, CBBC's educational sketch show Horrible Histories had cult appeal beyond the channel's kiddie remit. The focus on ridiculous, icky and gruesome moments from the past – almost every sketch can be boiled down to "Yes, people really used to do that. Yuk!" – taught kids aged 6-12 that history needn't be dull, and drew in never-grew-up adults too. Like all the best kids' shows, there were subtler jokes carefully placed just for parents.
By series two or three, one aspect of the programme was being praised above all others: the weekly songs, which, after some tinkering in the early days, quickly adopted the format of pastiching recognisable pop styles.
The songs are what have really made HH a breakout hit. Perfect viral-video material, they're composed and performed with astonishing skill – and this year, in the show's fifth and final series, they're better than ever. In fact they're some of the best TV moments of the year so far.
Each song has a long creative process behind it: series producer Caroline Norris and resident historian Greg Jenner find a subject matter, before commissioning a lyric from one of the writing team – almost always Dave Cohen. Norris and Cohen then write and rewrite, desperately trying to convey as much complex historical information as they can, as clearly as they can.
Then, however, the Horrible Histories songs become a one-man show. Every number is not only written by Warwick-based composer Richie Webb: he plays all the instruments and, with the help of a studio engineer, apes whichever musical style Norris has requested. Sometimes Webb - who also composes for 15-Minute Musical and The Music Teacher on Radio 4 - suggests an artist he'd like to parody, but normally he's working to order, and he does it incredibly effectively. David Bowie, Boyzone, Lady Gaga, The Smiths, Eminem, Michael Jackson, the Motown house band: Webb has been them all, on his own. Norris, who previously worked with Webb on Live & Kicking and Dead Ringers, describes him simply as "a genius".
"Over the years I've managed to develop the ability to write and play in many styles," Webb shrugs. "There aren't many genres I haven't written in now."
"Richie always speaks in self-admonishing terms about the three chords he puts in every song," says cast member Mathew Baynton. "He makes out that he's basically got two or three melodies. The truth is he puts so much detail into them."
"We're perfectly aware now we're not just writing songs for seven- and eight-year-olds," says Webb. "The show's evolved. Because of how YouTube has exploded, things now can stand many listenings. Before, you'd write a song for kids' telly, it'd go out once, that'd be it. Now you can pack stuff in because you know they'll be heard over and over again.
"I am in a band, the Liberty Ships. We play gentle folk-pop. But I can't imagine having more fun than pretending to be Simon & Garfunkel for a few days."
Songs coming up include a Tom Jones-style tribute to Welsh revolutionary Owain Glendwr, and one about Henry VII because, says Norris, "he's the original Tudor but not as funny as his kids, so a song felt like the most dynamic way to tell his story".
What about the last episode ever? "We wanted an epic song. I won't give away what it is, but it was quite an undertaking."
For now, here are five classics the final series has already brought us…
1. Charles Dickens/The Smiths
Mathew Baynton is Morrissey is Charles Dickens. "I overheard someone saying we could do The Smiths," Baynton tells RadioTimes.com. "I'm rarely this forthright, but I immediately piped up and said I would be distraught if you gave that to anyone else."
It's a dead-on Smiths mash that will fly straight over the head of the kids in the CBBC audience: the stop/start clatter of This Charming Man welded to the lyrics and up-sliding guitar riff of Heaven Knows I'm Miserable Now.
"I couldn't believe it when they played me this," says Baynton. "The guitar is pure Johnny Marr! But it's all Richie. He's an extraordinary talent."
"Maybe those 10 years in my bedroom playing guitar on my own have finally paid off," laughs Webb. "You could say, which child has heard of Morrissey? But maybe as well as giving them a lesson in British or American history, there's a little history of pop as well. Mum and Dad will say, that sounds like a bit like The Smiths. Together they'll go to YouTube and a little child will get turned on to music of the 1980s."
Over the top of the music is a typically efficient distillation of Dickens' life and career, themed around the idea of him being a miserable sod pouring his own torment into his work. Watch for occasional cast member Al Murray on drums.
2. Rosa Parks/Aretha Franklin
"I meant bizzy-nus/So we stayed off the bus…" The Dickens skit has got the show the most attention, being picked up in amused/bemused pieces in the LA Times and Slate. But this is the one, the team's best song ever.
Postwar history, which is new territory for HH, fitted in seamlessly to this year's series opener as the story of anti-segregation protester Rosa Parks (a flawless turn from Dominique Moore) was explained to kids via a Motown/Atlantic finger-clicker. "We wanted to do more black history and thought Rosa Parks was an essential story," says Caroline Norris. "It gave me goosebumps even when it was just Richie's guide vocal."
While you marvel at how elegantly Dave Cohen rhymes the whole story of Parks refusing to give her seat on a bus to a white passenger, you can groove to the Staxy horn stabs, then put on your headphones and check the twiddly bass, which sounds a lot like James Jamerson of the Funk Brothers.
"Ah man, if you knew how long that bass part took to record! It was about 90 takes!" says Webb. "I often say to Dominic Brigstocke the director: I spend hours putting this stuff in that nobody hears. He says: people don't hear it, but it adds to the overall effect. The combination of everything makes it authentic. Everyone in HH puts that little bit of extra effort in now. The editing lifts it another level, the performers, everyone. It all pays off. Difficult basslines are part of that!"
Whether or not they picked up on the musical subtleties, thousands of British kids now know Rosa's name. The simple closing caption is actually rather moving. "Absolutely," says Baynton. "It's moving because it's a celebration. I remember seeing it cut together and thinking, I wouldn't bet against that one song having a life beyond Horrible Histories."
3. Joan of Arc/Jessie J
One that the kids will definitely have got: a parody of Price Tag by Jessie J. Martha Howe-Douglas – who takes the lead role in Yonderland, the HH team's upcoming fantasy sitcom for Sky1 - plays the back-chatting, trouser-wearing heretic Joan of Arc. The interrogation breakdown is particularly good.
"We try to cover a range of styles, eras, and performers, and not repeat what we've done before," says Norris. "Everyone can pitch in with style ideas. I usually think about the song compilation episode [which ends the series after the 12 regular episodes] and what the mix will feel like in that. We're always looking for modern styles that the audience will know, as well as older music they might think is fun."
4. The Vikings/Simon & Garfunkel
Baynton again as Art Garfunkel, with Jim Howick as Paul Simon singing about the Viking invasion, its lasting legacy in Britain and why our view of the Vikings as violent pillagers is unfair. This one has perhaps the most musical jokes, directly referencing Mrs Robinson, The Boxer and, in a barely audible horn motif, Baby Driver. Richie Webb: "That's actually a piccolo trumpet. We had to work out how they got that sound, and it's a blend of a piccolo trumpet and a volume pedal on an electric guitar."
Baynton's approximation of Art Garfunkel staring beatifically at people off-camera is just right, too. "Art Garfunkel always seems to have his hands clasped in front of his chest. But I'm a massive Simon & Garfunkel fan, so it wasn't a stretch to imitate him. I've been doing it since I was a kid."
5. Marcus Licinius Crassus/Dizzee Rascal
An introduction to the Roman general who was perhaps the richest man of all time, represented here by Simon Farnaby in a well dench grime-up, with tremendous lyrics by Webb's former Live & Kicking collaborator Ben Ward. HH is brilliant at finding lesser-known stories that prove history isn't boring: this is one of them, and the music fits it ideally.
"Simon after all these years finally got his moment," says Baynton, "and the idea of someone showing off how rich they are, married to a bling grime kind of thing, is just perfect."
Horrible Histories series 5, episodes 1-6 are available on iPlayer. It continues Tuesdays 5pm on CBBC.