It’s Always Sunny in Philadelphia debuted back in 2005. The story behind the development of It’s Always Sunny is as humble and improbable as they come. You’ll likely never hear again of what was essentially a home movie being turned into a pilot, which impossibly was greenlit, and which would last for nine seasons (so far), become the cornerstone comedy hit of a now successful network, and also become the first sitcom ever to get a cable-to-cable syndication deal (reruns of the FX hit play on Comedy Central). There was no focus testing. No lighting. No big stars. There weren’t even small stars. It was just three struggling actors goofing off, and it was transformed into comedy gold.

Here’s how it happened:

1. Depending on who you ask, the unaired pilot for It’s Always Sunny in Philadelphia cost between $85 and $200, almost all of which was spent on tapes. That has to make it the cheapest greenlit sitcom pilot in history, and if not that, certainly the cheapest pilot ever for a show that ran for a decade.

2. The original title of the show was actually, It’s Always Sunny on Television, and the unaired pilot was set in Los Angeles. It was only after FX picked it up that the set location was moved to Philadelphia (Rob McElhenney’s hometown) because the network thought there were already too many sitcoms set in Los Angeles and it wanted to distinguish itself.

3. It was actually more important at the time for the series to distinguish itself because it hadn’t yet developed its misanthropic streak. In the original pilot, they’re not so much terrible people as they are mistaken as terrible people by misunderstandings (over the course of the first season, they eschewed the misunderstandings and owned up to their terribleness). It was also centered around the entertainment industry (they were struggling actors) rather than owners of a bar.

4. The credit sequence is also probably the cheapest ever to produce. It was just Rob McElhenney taping Philly footage with a camcorder and editing it together. The theme song — “Temptation Sensation” by Heinz Kiessling — like much of the first season soundtrack, is music from the public domain.

5. The pilot was not really originally designed to land a show. They were just friends hanging out who decided to put together the pilot for themselves, and to show other people, because they thought it was funny. But once they saw that it was funny, McElhenney began showing it around until FX saw it (and loved it) (several other networks, including HBO, passed).

6. The genesis for the entire sitcom came with an idea that McElhenney had to create this awkward situation where a friend reveals to another that he has cancer, and instead of sympathizing or consoling the guy with cancer, the friend tries to get the hell out as fast as possible (the storyline for the pilot was transformed into the fourth episode of the series,”Charlie has Cancer.”)

7. There were actually two versions of the unaired pilot. The first one was very bad, and in it, the role of Mac was played by David Hornsby (who would later play Cricket).

8. A version of the Sweet Dee role was originally played by Jordan Reid, who was McElhenney’s girlfriend at the time. The two would later break up, and Kaitlin Olson was brought in to replace her. According to Jordan Reid, who is now married to Kendrick Strauch of The Harlem Shakes, she was let go after the break up with McElhenney.

9. The role of Carmen was played by Morena Baccarin (Homeland) in the unaired pilot. She was a college friend of Glenn Howerton’s and appeared as a favor.

10. When Kaitlin Olson auditioned, she read Glenn’s part, and was pissed off to later learn that she wouldn’t get to deliver the lines on camera.