The saying goes that one person’s waste is another’s treasure. For those scientists who study urine the saying is quite literal–pee is a treasure-trove of scientific potential. It can now be used as a source of electric power. Urine-eating bacteria can create a strong enough current to power a cell phone. Medicines derived from urine can help treat infertility and fight symptoms of menopause. Stem cells harvested from urine have been reprogrammed into neurons and even used to grow human teeth.

For modern scientists, the golden liquid can be, well, liquid gold. But a quick look back in history shows that urine has always been important to scientific and industrial advancement, so much so that the ancient Romans not only sold pee collected from public urinals, but those who traded in urine had to pay a tax. So what about pee did preindustrial humans find so valuable? Here are a few examples:

Urine-soaked leather makes it soft: Prior to the ability to synthesize chemicals in the lab, urine was a quick and rich source of urea, a nitrogen-based organic compound. When stored for long periods of time, urea decays into ammonia. Ammonia in water acts as a caustic but weak base. Its high pH breaks down organic material, making urine the perfect substance for ancients to use in softening and tanning animal hides. Soaking animal skins in urine also made it easier for leather workers to remove hair and bits of flesh from the skin.

The cleansing power of pee: If you’ve investigated the ingredients in your household cleaners, you may have noticed a prevalent ingredient: ammonia. As a base, ammonia is a useful cleanser because dirt and grease–which are slightly acidic–get neutralized by the ammonia. Even though early Europeans knew about soap, many launderers preferred to use urine for its ammonia to get tough stains out of cloth. In fact, in ancient Rome, vessels for collecting urine were commonplace on streets–passers-by would relieve themselves into them and when the vats were full their contents were taken to a fullonica (a laundry), diluted with water and poured over dirty clothes. A worker would stand in the tub of urine and stomp on the clothes, similar to modern washing machine’s agitator.

Even after making soap became more prevalent, urine–known as chamber lye for the chamber pots it was collected in–was often used as a soaking treatment for tough stains.

Urine not only made your whites cleaner, but your colors brighter: Natural dyes from seeds, leaves, flowers, lichens, roots, bark and berries can leach out of a cloth if it or the dyebath aren’t treated with mordant, which helps to bind the dye to the cloth. It works like this: molecules of dye called chromophores get wrapped inside a more complex molecule or a group of molecules; this shell housing the dye then binds to the cloth. The central nugget of dye is then visible but is protected from bleeding away by the molecules surrounding it. Stale urine–or more precisely the ammonia in it–is a good mordant. Molecules of ammonia can form a web around chromophores, helping to develop the color of dyes as well as to bind it to cloth.

Specific chamberpots dedicated to urine helped families collect their pee for use as mordants. Urine was so important to the textile industry of 16th century England that casks of it–an estimated amount equivalent to the urine stream of 1000 people for an entire year–were shipped from across the country to Yorkshire, where it was mixed with alum to form an even stronger mordant than urine alone.

Pee makes things go boom: Had enough with cleansing, tanning, and dyeing? Then why not use your pee to make gunpowder! Gunpowder recipes call for charcoal and sulfur in small quantities, both of which for aren’t too hard to find. But the main ingredient–potassium nitrate, also called saltpeter–was only synthesized on a large-scale in the early 20th century. Prior to that, makers of gunpowder took advantage of the nitrogen naturally found in pee to make the key ingredient for ballistic firepower.

As detailed in the manual Instructions for the Manufacture of Saltpetre, written by physician and geologist Joseph LeConte in 1862, a person hoping to make gunpowder quickly would need “a good supply of thoroughly rotted manure of the richest kind” which is then mixed with ash, leaves and straw in a pit. “The heap is watered every week with the richest kinds of liquid manure, such as urine, dung-water, water of privies, cess-pools, drains, &c. The quantity of liquid should be such as to keep the heap always moist, but not wet,” he wrote. The mixture is stirred every week, and after a several months no more pee is added. Then “As the heap ripens, the nitre is brought to the surface by evaporation, and appears as a whitish efflorescence, detectible by the taste.”

Different regions of the world had their own recipes for gunpowder, but the scientific principle at work is the same: Ammonia from stagnant pee reacts with oxygen to form nitrates. These nitrates–negatively charged nitrogen-bearing ions–then search for positively charged metal ions in the pee-poo-ash slurry to bind with. Thanks to the ash, potassium ions are in abundance, and voila! After a little filtering, you’ve made potassium nitrate.

Urine gives you a whiter smile: Urine was a key ingredient in many early medicines and folk remedies of dubious effectiveness. But one use–and those who’ve tried it say it works–is as a type of mouthwash. While “urine-soaked grin” isn’t the insult of choice these days, a verse by Roman poet Catullus reads:

Egnatius, because he has snow-white teeth, smiles all the time. If you’re a defendant in court, when the counsel draws tears, he smiles: if you’re in grief at the pyre of pious sons, the lone lorn mother weeping, he smiles. Whatever it is, wherever it is, whatever he’s doing, he smiles: he’s got a disease, neither polite, I would say, nor charming. So a reminder to you, from me, good Egnatius. If you were a Sabine or Tiburtine or a fat Umbrian, or plump Etruscan, or dark toothy Lanuvian, or from north of the Po, and I’ll mention my own Veronese too, or whoever else clean their teeth religiously, I’d still not want you to smile all the time: there’s nothing more foolish than foolishly smiling. Now you’re Spanish: in the country of Spain what each man pisses, he’s used to brushing his teeth and red gums with, every morning, so the fact that your teeth are so polished just shows you’re the more full of piss.

The poem not only reveals that Catullus wasn’t a fan of Egnatius, but that Romans used urine to clean and whiten their teeth, transforming morning breath into a different smell entirely. The active ingredient? You guessed it: ammonia, which lifted stains away.

But perhaps one of the most critical uses of urine in history was its role in making the above home remedies obsolete. Urea, the nitrogen bearing compound in urine, was the first organic substance created from inorganic starting materials. In 1828, German chemist Friedrich Wöhler mixed silver cyanate with ammonium chloride and obtained a white crystalline material that his tests proved was identical to urea. His finding disproved a hypothesis of many leading scientists and thinkers of the time, which held that living organisms were made up of substances entirely different than inanimate objects like rocks or glass. In a note to a colleague, Wöhler wrote, “I can no longer, so to speak, hold my chemical water and must tell you that I can make urea without needing a kidney, whether of man or dog; the ammonium salt of cyanic acid is urea.”

Wöhler’s discovery showed that not only could organic chemicals be transformed and produced in the lab, but that humans were part of nature, rather than separate from it. In doing so, he began the field of organic chemistry. Organic chemistry has given us modern medicines, materials such as plastic and nylon, compounds including synthetic ammonia and potassium nitrate…and, of course, a way to clean our clothes or fire a gun without using our own (or someone else’s) pee.