Back in 1704, in Torryburn on the south west Fife coast, they had a problem disposing of toxic material - it was what you might call a toxic witch problem.
Lilias Adie, a poor woman who confessed to being a witch and having sex with the devil, died in prison before she could be tried, sentenced and burned.
So they buried her deep in the sticky, sopping wet mud of the foreshore - between the high tide and low tide mark - and they put a heavy flat stone over her.
In previous cases, people wanted rid of dead witches as cheaply as possible - dumping them naked in pits at the foot of the gallows. Why go to such bother to bury Lilias?
One possibility is that Lilias killed herself.
Right up to the 19th Century suicide victims were buried this way on the shore, outside consecrated ground.
This seems strange and barbaric to us now, but it was believed that suicide was a terrible crime against God, inspired by the devil.
Worse, it was believed people who died in this way were in danger of becoming revenants - corpses of bad people who had died a bad death, who then came back from the grave to torment the living.
This has a strange and terrible relevance to witchcraft.
Demonologists believed that such walking corpses were real and possessed by the devil, who animated them to do things like have sex with witches.
Lilias herself had confessed publicly to having sex with the devil.
All her friends and neighbours would have believed this was done by the devil putting on such a decaying corpse, just taken from its grave, to copulate with her.
Folk belief said that certain bodies were much more likely to do this - executed people, suicides, witches.
So now you see the problem, whichever way you look it Lilias is either (a) a suicide or (b) a witch, and even worse (c) possibly both.
She was not only given the burial common for suicides but the large stone was placed over her, another folk remedy for revenants, to weigh them down so they can't get up and come back.
After they buried her, the good folk of Torryburn must have breathed a contented sigh of relief like scientists entombing nuclear waste. They had made Lilias safe for the centuries, or so they believed.
Unfortunately they hadn't made Lilias safe from them.
By the 19th Century beliefs had changed, and some enterprising locals dug up Lilias to sell bits of her to the local antiquarians.
Their biggest prize, her skull, went to St Andrews University Museum where it was photographed more than 100 years ago.
You can still see the photographs today in National Library of Scotland - showing that poor Lilias, who was probably in her 70s when she died, had extremely prominent buck teeth.
But sometime in the 20th Century the skull went missing and all inquiries to trace it have so far failed.
So what's left on that lonely beach?
Our programme went to take a look for the stone - armed with 19th Century descriptions of the area that mentioned "the great stone doorstep that lies over the rifled grave of Lilly Eadie", and a rock with "the remains of an iron ring".
In the small group of rocks near the railway bridge, we found a seaweed-covered stone which fitted the doorstep description.
Fife archaeologist Douglas Speirs, who examined and cleaned it, confirmed the slab was not natural to the beach but quarried and deliberately placed there.
It had in its middle a small dimple which might have been mistaken as the socket for an iron ring. This, we think, is Lillias's stone, but is there anything left of Lilias there?
Speirs pointed out that 19th Century curiosity-seekers were unlikely to have lifted the entire body.
In the days when "reading someone's bumps on the head" was thought to be science, the skull was the thing.
Maybe a few other bits were taken too, but it's unlikely that the whole body went.
And if parts of her are left, the preservation in the area is excellent, she is unlikely to have rotted away.
Without archaeological investigation, no-one can know for sure, but it's likely that this is the only known witch's grave of its type in Scotland and that parts of Lilias are still in there.