Tim Westergren on stage at Hustle Con 2015 Matt Weinberger

Before Pandora hit it big, the music streaming company went through some tough times.

Tim Westergren, the Pandora co-founder, survived on maxed-out credit cards and sheer willpower.

Westergren recounted tales of those early, “not glamorous” days during a talk at today’s Hustle Con event in San Francisco.

The cash crunch:

In the run up to its 2004 Series B funding Pandora was running on financial fumes. Pandora wasn’t able to pay its employees for an astounding two years between 2002 to 2004 while it worked on producing a viable commercial product. Not paying full-time employees is very, very illegal in California, where Pandora is based.

“We had no idea we were breaking the law," Westergren said.

Over that period, Pandora accumulated $2 million in back wages owed. Westergren himself ran up a $500,000 debt on "maxed-out cards" while he paid bills and as many salaries as he could afford.

He paid a little at a time in the order they were due, an experience he describes as like "playing Tetris" with his finances, which he "[doesn't] recommend."

Two employees sued for back wages. And Pandora's original model of licensing out its Internet music recommendation engine to retailers and labels wasn't working out.

But Westergren, a musician by training who had little to fall back on if he defaulted on the debts, managed to keep most of the team together. To keep employees motivated, he gave speeches upon speeches, encouraging them that the potential market was huge, and so was Pandora's potential impact on music and culture.

Somehow — Westergren says he's not sure how — the company was able to close a $9 million round of funding in 2004, when money was much harder to come by than it is today.

Westergren called an all-hands meeting for everybody in Pandora that same day. Everybody was expecting another stirring speech, he says. Instead, he pulled a stack of envelopes from his back pocket and paid out the $2 million among the 50 employees right then and there.

"Everybody thought it was a bad joke, like it would bounce or something," Westergren says.

The Beatles - Bee Gees connection:

There was another scary moment earlier in Pandora’s life, shortly before the dot-com bubble burst in 2000, Westergren said.

Pandora founders Will Glaser, Jon Kraft, and Westergren had spent the last year and a lot of money on their so-called Music Genome Project, an algorithm that would predict what music listeners would want based on suggestions you put in.

Now it was ready for its first test.

The founders put in a song by the Beatles.

"Four or five minutes later," he says, it returned with a song by the Bee Gees — a pop group that couldn't be further from the Fab Four.

"We were like, 'oh f***," Westergren said.

But on further investigation, it turned out it was an early song by the Bee Gees, from when they were a "clone" of the Beatles, Westergren said. It worked, just in mysterious ways.

"We went from despair to elation in a very short period of time," Westergren said.

Nowadays, Pandora is a publically-traded company since 2011, and Westergren himself is building a massive vacation home.