Sam Simon, the writer and producer who co-created The Simpsons and the philanthropist who gave the millions he made from the show to charity, died Sunday after a two-year battle with terminal cancer. He was 59.

A Los Angeles native, Simon’s TV career – which would become legendary – took off fast. After beginning as a storyboard artist and writer on shows like The New Adventures of Mighty Mouse and Heckle & Jeckle, he transitioned to live-action sitcoms, and became the showrunner of Taxi when he was only 23. From there, he moved on to Cheers, the cult classic It’s Garry Shandling’s Show, and The Tracey Ullman Show, where what would become The Simpsons made its debut as a series of short films. Matt Groening, James L. Brooks, and Simon eventually adapted the shorts into an animated series for Fox, and the rest is history.

Simon worked as a writer, showrunner, and producer on The Simpsons from 1989 to 1993, and was dubbed “the unsung hero” of the show by former Simpsons director Brad Bird (The Iron Giant, Mission Impossible: Ghost Protocol). He helped assemble a now-legendary team of writers for the series and lent his own comic style to the development of Groening’s characters, and wrote or co-wrote classic episodes like “Two Cars in Every Garage and Three Eyes on Every Fish,” “The Telltale Head,” and a segment in the original “Treehouse of Horror,” but by 1993 he was tired of the TV grind and opted out. Before he left The Simpsons, though, he negotiated a deal that would grant him a perpetual executive producer credit on the series, and a share of whatever profits the show might produce, not knowing at the time that his name was going to be forever stamped on the longest running primetime series in TV history. Simon’s Simpsons deal ultimately paid him “tens of millions” of dollars every year, granting him both freedom and the opportunity for an immense philanthropic effort.

“The Simpsons money got bigger and bigger. When I left The Simpsons, no one thought that this thing was going to still be around. It’s the cumulative effect,” Simon told The Hollywood Reporter in 2013. “It’s like, ‘Oh my God, 25 years later, and it’s still coming in.’”

Simon returned to television many times after The Simpsons. He co-created The George Carlin Show alongside the legendary standup in 1994, served as a consultant on The Drew Carey Show and Charlie Sheen’s FX series Anger Management, and directed episodes of Friends and The Norm Show. In 2009, he spun his deep love of poker into Sam’s Game, a reality series on Playboy TV featuring friends and comedians like Norm Macdonald, Artie Lange, Dave Attell, Jeff Ross, and Simon’s ex-wife Jennifer Tilly.

Simon’s work on The Simpsons cemented his legacy, but in the years that followed his time with the show, he developed another legacy: one of giving. In 2013, after his cancer diagnosis, he admitted that he actually didn’t know how much money he’d given away, but that he intended to expand his giving as much as possible before his death (at the time of his diagnosis, he was given three to six months to live). His principal charity was his own foundation, The Sam Simon Foundation, which rescues dogs, offers free pet surgeries, trains therapy dogs for military veterans, distributes cruelty-free vegan food to hungry families, and more. As of 2011 the foundation was valued at $23 million, and Simon vowed to keep growing it in the years before his death. His other charitable causes included PETA, Save the Children, and the Sea Shepherd Conservation Society. Back in 2013, as several organizations he’d donated to were preparing tributes in his honor after learning of his illness, Simon summed up nicely why he intended to keep giving money away as long as he could, so we’ll let him have the last word:

“The sort of lifetime achievement stuff that I’m getting now is kind of like Tom Sawyer’s funeral because they all know I’m sick. I am getting buildings named after me and awards and stuff,” he said. “The truth is, I have more money than I’m interested in spending. Everyone in my family is taken care of. And I enjoy this.”