When Sydney boy Steven Spaliviero found himself locked up in a US prison cell with a master drug cook named Igor, he decided to make the most of it.
What happened afterwards is like the TV series Breaking Bad, on steroids.
On the surface, the handsome young Australian led a glamorous life from Sydney to Los Angeles of luxury cars, yachts, celebrities and beautiful women.
But Spaliviero would become one of the world's biggest ecstasy manufacturers.
As taught by his cellmate Igor, he became a hands-on cook of massive amounts of high-grade MDMA.
Spaliviero spent his leisure time out driving Lamborghinis, romancing women or rubbing shoulders in nightclubs with Sylvester Stallone or Eddie Murphy.
But by day he'd be sweating it out in a secret laboratory, toiling over gigantic drug boilers he welded himself to produce what was eventually billions of ecstasy pills.
And it was all on a mammoth scale.
Viewers of the Breaking Bad series have seen the Walter White character and his meth cook buddy Jesse Pinkman in hazmat suits hauling drums in their secret ice factory.
"As far as the size of the fictional Breaking Bad operation was, they used 25-litre drums weighing around 25kg to load on to a 400-litre reaction vessel," Spaliviero told news.com.au.
"Ours was a 1000-litre reaction vessel and the drums weighed 200kg, so you couldn't pour them, they had to be loaded by forklift.
"Of course the big difference to Breaking Bad was ours was real, plus the chemicals to make MDMA are much more dangerous."
Eventually Spaliviero would get caught, in Australia, and spend 11 years in prison, from which the now 52-year-old has just emerged around six weeks ago.
But having done his time and leaving his life of crime behind, reformed drug criminal Spaliviero has revealed all in his new book Narco X.
It tells the tale of how a Sydney boy from a poor migrant family rose to rub shoulders with the CIA and the infamous Sinaloa drug cartel.
Spaliviero is remembered for his romance with Swedish model Charlotte Lindstrom who also spent time behind bars.
But his career as a drug cook began in his early twenties when he was locked up for a luxury car racket in California's Avenal State Prison with the Dutch drug cook, Igor.
Spaliviero's cellmate was a chemical engineer who, like Walter White, had a personal motivation for making drugs.
In the TV show, chemistry teacher White is diagnosed with cancer and descends into wholesale methamphetamine manufacturing to provide for his family once he dies.
Igor, the one-time Bayer chemical company engineer, had become an ecstasy cook after his wife died of cancer and he left his job to care for his young daughter, Emily.
In their shared cell at Avenal, a large jail in California's San Joaquin Valley riven by a bloody gang war, Igor told Spaliviero why he had turned to crime.
His daughter had cerebral palsy and to prevent her being taken into care, a broke Igor had agreed to set up an illegal laboratory in America and manufacture MDMA.
The Drug Enforcement Agency kicked down the door as Igor was making about 100kg, and he was sentenced to 12 years' jail.
At first, Igor taught Spaliviero how to survive the frequent fatal gang stabbings in the prison yard.
When Igor received news that his sister's husband had died and she could no longer afford to look after Emily, he agreed to teach Spaliviero the art of ecstasy manufacture.
The Australian was already adept at fixing things, and pulling apart Porsches for his illegal parts scam.
In April, 1991, the cellmates made a pact that if Igor taught him to make ecstasy, Spaliviero would pay for Emily's upkeep.
For the last 18 months of his sentence, he was Igor's student, vowing on his release to support Emily with proceeds from the drug trade.
"I had entered Avenal a naive car thief," Spaliviero writes in Narco X.
"I left as a resentful ecstasy cook, a product of California Corrections, determined to make my mark in the world."
Spaliviero told news.com.au that he had always "thought big", and so when it came to manufacturing his first batch of MDMA he wanted to make it worthwhile.
He made up a phony business name, LabTec, and used the address of a vacant local factory.
Spaliviero located enough chemicals to make 20kg of pure ecstasy, and then sat off the factory site to make sure police were not tailing the delivery of "cleaning chemicals".
Next, Spaliviero needed to build a 60 litre "reaction vessel" using stainless steel rolled into a cylinder and welded each end with circles of steel.
He added a pressure gauge and a porthole to the vessel, which was the size of a beer keg and took a week to build, using skills he learnt back in Sydney fixing cars and machines.
Following Igor's instructions, he took the keg on his boat with the chemicals, and sailed off from LA towards Catalina Island.
"I was the captain of a multimillion-dollar floating drug lab," Spaliviero writes.
When he reached a secluded spot, he tied a rope around the keg, filled it with the chemicals and lowered it 20m into the water
"Igor had stressed this was the most dangerous part of the process and I was not go near it for at least 20 minutes."
After several minutes, the reaction vessel exploded and filled the sea with hydrogen gas, ecstasy chemicals and dead fish.
All was lost.
Spaliviero decided that what had gone wrong was the temperature of the water, too warm at 18C.
He got to work and designed another reaction vessel, this time much larger and using pharmaceutical grade steel.
So huge, it could only be loaded on to his boat via a ramp, he drove it to the spot and waited.
This one survived, but he could not haul it back onboard and had to tow it ashore.
On an isolated beach, Spaliviero unbolted the filling port and was rewarded with the sight of drug crystals the size of diamonds.
He swallowed one, 20 minutes later he was "travelling to my planet of euphoria".
As soon as he had sold it, his buyers wanted more of the "amazing" stuff.
It had cost him just $2000, including the chemicals and the vessel, to make $275,000.
He sent $20,000 to Igor's sister, but among his drug buyers in LA, "everyone was screaming for more".
Spaliviero decided he needed to build a large enough vessel to make 20kg in one go, and a 5000 litre plastic water tank in which he could empty bags of party ice, then lower the vessel down using a one-ton winch.
He found a factory, next to an oil refinery to mask the smell of the chemicals.
Again the drugs were a raving success, but his buyers wanted him to supply pills rather than powder.
He flew to Amsterdam and to meet Igor's sister and Emily, and a man who ran a legal operation making vitamins with a pill press.
Spaliviero returned with the innocent vitamin maker's knowledge.
"I entered America with the intention to produce millions and millions of ecstasy pills," he said.
Spaliviero built a new reaction vessel 1.5m high, and bought 2000kg of pill binding powder and three pill presses, capable of producing 7500 pills a minute.
When he set up the factory, "I turned on the machines," he said.
"Instantly little white pills started pouring out like coins from a Las Vegas poker machine having hit the jackpot, except these coins were $6 ecstasy pills.
"While cops busted the gangs at the end of my street for selling small amounts of crack and weed, I manufactured hundreds of kilograms of drugs.
"I became addicted to the thrill of hearing police sirens blaring past the factory on the way to enforce traffic violations ... knowing I was invisible behind the factory walls."
Then he met a CIA official who agreed to tell him if he was under scrutiny by the Feds.
"I was Mr Clean. I felt untouchable," Spaliviero said.
"By 2001, I had made $23 million from the sale of ecstasy."
But the US Government had moved to crack down on the drug trade and outlaw the importation of precursor chemicals.
Then Igor got out of jail and invited Spaliviero to meet him in Shanghai.
Igor had been working on a new chemical to make ecstasy, to beat the precursor ban.
The main precursor chemical, MDP2P, now fetched a whopping $20,000 per kilo on the black market.
"Any good drug cook could turn that one kilo into a kilogram of ecstasy in one days and make a quick $40,000," Spaliviero writes.
"The problem was you had to get it into the country."
Igor, who had graduated in chemical engineering from the University of Zurich before working for Bayer, had come up with a plan to modify the structure of MDP2P
He found a Chinese company with a 500,000kg stockpile of MDP2P that was willing to barter.
Spaliviero and Igor calculated how many million ecstasy pills they could make at $6 each wholesale, for a $21 billion profit.
Standing in their massive new MDMA warehouse, Spaliviero figured this was the adult realisation of his childhood dream.
"When I was a child my grandmother Irene took me to see the movie Willie Wonka and the Chocolate Factory," he writes.
"For years I had fantasised over the chocolate river and how amazing it would be to see such a place.
"Today I stood in something even more phenomenal than I could have imagined.
"The moment I stepped into the warehouse in front of me stood enough MDP2P to make 3.5 billion ecstasy pills, enough to supply the world for the next 10 years."
Spaliviero had to leave behind the method of making ecstasy underwater as his operation became too large.
Like in Breaking Bad, he and his assistant drug cooks wore chemical masks and heavy clothing to be safe from the chemicals.
But compared with making methamphetamine, manufacturing ecstasy produces huge amounts of hydrogen. On one occasion one of the men took his mask off by mistake and collapsed, having to be resuscitated.
Steven Spaliviero was sentenced to 16 years for running an ecstasy drug laboratory at Riverstone in northwestern Sydney, manufacturing 44kg of the drug.
He was released after serving 11 years, and having acted as a mentor to young inmates in prison, is now starting a new life away from crime.
But Spaliviero, who is in a relationship with Sydney model Chelsea Coates, decided to tell his story in Narco X, writing the book in his final years behind bars at Long Bay, Cooma and Goulburn correctional centres.
"The narcotics business is over for me," Spaliviero told news.com.au.
"There are huge amounts of money to be made in narcotics however, the prison sentences and the advance technology police have at their disposal makes you question whether the money is worth it.
"How do you put a price figure on 16 years of your life in a prison cell? 5696 — That's how many sunsets I missed, 16 Christmases and 16 of my mother's birthdays.
"My advice to anyone who wants to take their chances is, don't do it."
Narco X is available online or from Amazon.com.