Whether it’s a wordy epic that chronicles the show’s backstory or an orchestral piece that lends itself to lyrical parody, a good theme song can augment a TV show’s popularity and even sometimes outlive it. But there’s no clear path to creating—or even just choosing—the perfect track. If you’re trying to include a sleigh bell, it could take months of tinkering; if Will Smith is involved, on the other hand, it might only take 15 minutes. From The Sopranos’s gritty intro to Sesame Street's much sunnier one, here’s how 11 iconic TV theme songs came to be.

1. The Sopranos // “Woke Up This Morning”

In 1990, a British woman named Sara Thornton was sentenced to life in prison for murdering her abusive husband. The case caught the attention of Rob Spragg (also known as Larry Love), who penned a song about the ordeal for his band, Alabama 3.

That song was “Woke Up This Morning,” which eventually fell upon the ears of The Sopranos creator David Chase. With bluesy overtones and lyrics like “You woke up this morning / Got yourself a gun,” the track was the ideal theme for Tony Soprano and his gun-toting goons, and HBO reportedly offered the band $40,000 to use it for the series. Alabama 3 agreed, but the irony of the song’s origin wasn’t lost on its members. “It was meant to be about female empowerment, and it ends up becoming a gangster anthem,” Spragg told The Guardian.

2. Succession // “Succession (Main Title Theme)”

Nicholas Britell had composed all the music for Succession’s debut season when he finally got around to tackling the intro, so he already knew how to translate the show’s darkly comic elements into melodies. His eccentric recipe for the perfect, Emmy-winning theme would involve several out-of-tune pianos, some hip-hop beats (a passion of his from college), and a literal sleigh bell. Though Britell had collaborated closely with the show’s creators throughout the first season, he was still nervous to send them the track. “I remember thinking to myself, ‘I hope they like this because if they don’t, I actually don’t know what else to do,’” he told NME. “So I emailed it over and [creator Jesse Armstrong] almost immediately responded and said, ‘I think the right response to this is: F*** yeah!’”

3. Gilmore Girls // “Where You Lead”

If you grew up listening to Carole King’s “Where You Lead” usher in a new episode (or rerun) of Gilmore Girls, you might consider it the ultimate mother-daughter song. But if you grew up listening to the original version on King’s 1971 album Tapestry, you might have a different association. With lyrics like “I always wanted a real home / With flowers on the windowsill / But if you wanna live in New York City / Honey, you know I will,” the track embodied a submissive quality that King later soured on. When King’s friend Amy Sherman-Palladino approached her about using the song for Gilmore Girls in 2000, the ’70s singer/songwriter saw an opportunity to give it a makeover. She asked her daughter, Louise Goffin, to sing it with her, and the two came up with some new lyrics, including: “You never know how it's all gonna turn out, but that's OK / Just as long as we're together, we can find a way.”

“When she was singing it with me, it just gave it a whole new spin,” Goffin told BuzzFeed, explaining that the new version was more about how “there is no distance that is too far to go be with your child.”

4. The Proud Family // “The Proud Family Theme Song”

In July 2001, Disney Channel announced that the theme song for its upcoming animated series The Proud Family would be performed by Solange Knowles, then a virtually unknown 15-year-old who had never released any music. The ensuing excitement wasn’t unfounded: Her sister, Beyoncé, had agreed to sing backup with the other two-thirds of Destiny’s Child. According to songwriter Kurt Farquhar, the producers (one of whom was his brother, Ralph) had gone through “a virtual who’s who of [popular] artists” and snagged a deal with Solange and Destiny’s Child at the eleventh hour. “It was so last minute that I don’t think any of them had really heard the song when they came into the studio,” he told Vulture. Fortunately, they were impressed with it, and Beyoncé even helped produce the track. But even if things hadn’t worked out with the Knowles sisters, The Proud Family probably still would’ve boasted one of the best kids’ show intros of all time; Ralph Farquhar revealed during a recent cast reunion that their backup plan was Alicia Keys.

5. Friends // “I’ll Be There For You”

When Friends producer Kevin S. Bright sent the pilot episode to The Rembrandts’s Danny Wilde and Phil Solem, its placeholder theme song was R.E.M.’s “It’s the End of the World As We Know It (And I Feel Fine),” which he was hoping they could emulate if they took the gig. They did take the gig, but the band itself didn’t actually come up with the sitcom’s still-ubiquitous theme song. Friends co-creator Marta Kauffman’s husband, Michael Skloff, composed it, with lyrical help from Allee Willis (who co-wrote Earth, Wind, & Fire’s hit “September”). The Rembrandts “Rembrandt-ified it,” as Solem told BuzzFeed News, and the show’s producers surprised them by adding their own finishing touch: the four claps, which took them more than a few takes to get right.

Friends premiered about a week after they wrapped, and The Rembrandts returned their focus to their forthcoming album, L.P. But after a Nashville radio program director named Charlie Quinn played a looped version of the 45-second theme song, it became clear that the public wanted more. “It got a crazy amount of requests. The phone lines started blowing up and all the sister stations started playing it and it went national,” Wilde told BuzzFeed News. L.P. was completely done, but their label insisted they record a longer edition of the Friends theme and add it to the end of the album. Though they weren’t exactly thrilled, they eventually came to appreciate the song’s success. “It didn’t really fit,” Wilde explained. “But it helped sell that record!”

6. Gilligan’s Island // “The Ballad of Gilligan’s Isle”

Years before John Williams gained acclaim for composing the Star Wars score (among many other blockbuster themes), he came up with a calypso intro for Gilligan’s Island, written and performed by the show’s producer, Sherwood Schwartz. Not only did the song sound completely different from the one we’re familiar with today, but the lyrics tell a slightly different story, too. The professor is just a “high school teacher,” Ginger and Mary Ann are “two secretaries,” and the passengers take a “six-hour ride” instead of a “three-hour tour.” By the time the show premiered, Schwartz had scrapped the song for “The Ballad of Gilligan’s Isle,” which he composed with George Wyle and booked folk singers The Wellingtons to perform.

Schwartz wasn’t quite done tweaking the tune, though. In the version that aired during season 1 of Gilligan’s Island, the list of passengers ends with “the movie star, and the rest,” omitting both the Professor and Mary Ann. According to MeTV, this was because Tina Louise’s (Ginger, the movie star) contract mandated that her name come last in the credits. For season two, Bob Denver (Gilligan) told the producers that unless they worked those two castaways into the opening credits, he’d like his name to get bumped to the end credits in solidarity. Since Denver was the top-billed cast member, they agreed. “The Professor and I still send each other little notes saying ‘Love, The Rest,’” Dawn Wells (Mary Ann) said on Today in 1995.

7. The Fresh Prince of Bel-Air // “Yo Home to Bel-Air”

When NBC gave Andy Borowitz the green light for The Fresh Prince of Bel-Air, he already knew he wanted the theme song to tell the story of how Will Smith’s character ended up in Bel-Air. “I was like, ‘We’re basically doing the hip-hop Beverly Hillbillies here. Let’s not run away from that—let’s just go for it,” he told Entertainment Weekly. It was near the end of pilot season, and Borowitz didn’t have much time to deliver an episode to the network. Luckily, Smith didn’t need much time to write the now-iconic bars.

“We literally went into the studio and made the theme song in about 15 minutes,” DJ Jazzy Jeff, the other half of Smith’s hip-hop duo, told Entertainment Weekly. “I ended up just going in and programming some music, and he wrote something and laid it down. I did [a] rough mix and sent it in, and in about three weeks it was on NBC.”

8. The Andy Griffith Show // “The Fishin' Hole”

Composer Earle Hagen (who was also behind the themes for The Dick Van Dyke Show and That Girl) didn’t have an easy time dreaming up a simple song for The Andy Griffith Show until he realized just how simple it should be. “One morning I got up after beating our brains out for a couple of months, and I thought ‘That thing ought to be simple enough to whistle.’ And it took me about 10 minutes to write it,” he said in an interview with The Television Academy. He presented it to producer Sheldon Leonard, who immediately suggested filming Andy Griffith and Ron Howard ambling lakeside with fishing poles while the song played. Hagen himself whistled on the track. “I had never whistled before in my life, and never since,” he said.

Though “The Fishin’ Hole” was instrumental in the show, actor Everett Sloane—who guest-starred as farmer Jubal Foster in a season 2 episode—later wrote lyrics for it, and Griffith sang them for the 1961 album Songs, Themes And Laughs From The Andy Griffith Show.

9. Batman // “Batman Theme”

Batman’s theme song has been covered so often in the last half century that younger fans might not even know where it originated. The year was 1966, the show was ABC’s animated series Batman, and the musical genius was Neal Hefti. In a 2006 interview for Journal Into Melody, Hefti admitted that he struggled to develop a tune that was as “outrageous” as the show itself, and he didn’t have high hopes for his pitch to producers. “I had to sing it and play it on the piano. Well, I'm no singer, and I'm no pianist,” he said. “My first thought was that they were going to throw me out, very quickly, but as I was going through it, I heard them both reacting with statements like, ‘Oh, that's kicky. That will be good in the car chase.’”

Hefti eventually used eight singers to bring the “Batman!” chorus to life, but he suggested cutting two different tracks in case producer William Dozier preferred a purely instrumental intro. Though Dozier chose the vocal version, Batman star Adam West later propagated the myth that instruments—not voices—were behind the “Batman!” bit. “Old pals would call to congratulate me and also to ask, ‘Are those horns or voices saying ‘Batman’ during your theme song?’” he wrote in his 1994 autobiography. “(They were horns.)”

Since the single word did technically qualify as “lyrics,” Hefti was credited as both songwriter and composer. “One of the choir members on the recording session wrote on his part: ‘Word and Music by Neal Hefti,’” Hefti told the Los Angeles Times.

10. Sesame Street // “Sunny Days”

When it came to Sesame Street’s opening ditty, creator Jon Stone loved Joe Raposo’s composition just as much as he hated Bruce Hart’s lyrics—and he didn’t downplay either emotion. According to Michael Davis’s book Street Gang: The Complete History of Sesame Street, Stone called Raposo’s music “just plain brilliant,” commending how it was “melodic and easy enough for a child to recognize and even sing along to, but still had a musical sophistication.” Though it was Stone’s idea to center the song around the line “Can you tell me how to get to Sesame Street?” he thought the rest of Hart’s “platitudinous kiddie-show lyrics” were “trite and thoughtless.”

“I kept thinking that in a week or so I’d get around to getting rid of such hackneyed phrases as ‘It’s a magic carpet ride,’ but I never did, and once it aired there was no way to go back and make repairs,” he explained, calling the whole work a “musical masterpiece and a lyrical embarrassment.” Evidently, it wasn’t embarrassing enough to preclude Stone from listing himself as a co-writer and claiming a portion of the royalties.

11. Cheers // “Where Everybody Knows Your Name”

In the early 1980s, Gary Portnoy and Judy Hart Angelo were busy mailing cassette tapes featuring songs from their fledgling Broadway show, Preppies, to potential backers in the entertainment industry. Soon, the musicians were contacted by brothers Glenn and Les Charles, who didn’t want to invest in the musical at all. Instead, they wanted to buy its opening number, “People Like Us,” for their upcoming NBC sitcom, Cheers. Since Preppies producers wouldn’t let them poach it, the Charles brothers simply commissioned Portnoy and Hart Angelo to pen a similar song for the TV series. What they originally wrote centered on Ted Danson’s rather amorous character, Sam, and classic Boston culture; lyrics included, “Singing the blues when the Red Sox lose / It’s a crisis in your life / On the run ’cause all your girlfriends want to be your wife.”

“They called us back and said, ‘We really love that, but we love our show and think it’s going to run forever, so if you could make the verse more universal in nature,'" Portnoy told Metro.co.uk. The duo took their advice, and ended up with “Where Everybody Knows Your Name," which Portnoy recorded himself—all six singing parts. The beloved and meaningful song still generates healthy royalty checks for its creators, but the same can’t be said for their ill-fated musical. Preppies debuted Off-Broadway to lackluster reviews and shuttered just weeks later.