It seems hard to believe, in an era when The Lego Movie made $468 million globally last year, but a decade ago, Lego was actually on the verge of collapse. After the 2002 holiday season, Toys R Us stores were actually left with over 40 percent of their Lego stock unsold. Costly product flops and mismanagement had driven the business into the ground. And yet, like a phoenix that gets really good at interlocking various pieces of plastic together, it came roaring back. In 2014, for the first time ever, Lego’s profits beat out those of Mattel, despite the latter’s ownership of Barbie, Hot Wheels, Fisher-Price, and numerous other brands.

Fast Company has posted a lengthy account of the fall and rise of Lego over the past 15 years, detailing the steps it took to revamp its flagging business and once again get the children of the world super into building little miniature versions of stuff. There’s an Apple-like obsessive control over their product quality (every single Lego brick is encoded with a tiny number in order to track any defective part back to the machine that made it), an overwhelming amount of anthropological research (Fast Company notes that the company likely has more data on how children play than any other institution in the world), and fun new innovations (for example, a product where kids build racing hovercrafts and scan them into a computer to digitally race their creations). Everything is awesome, indeed.