Today’s mindfulness industry is a multi-billion-dollar global business, and at its root is a sincere desire to live our best, most carefully considered life.

You’re wrapping up a morning run when one of your hamstring muscles balls into an angry fist of pain. Or it’s the middle of the night, and a sudden spasm grips your calf and forces you out of bed.

While they’re common—affecting roughly 37% of the population—muscle cramps have long been shrouded in mystery. For a long time, experts believed that muscle fatigue or some sort of fluid imbalance—brought on either by dehydration or inadequate amounts of electrolytes in the blood—could disrupt muscle homeostasis in ways that triggered involuntary activity. This theory was based on some well-established muscle cramp trends, including the fact that intense exercise can produce a cramp, and that cramps are more common in summer than in winter.

But new research complicates these old theories. “Marathon runners who cramp in competition do not differ in their serum electrolytes from those who do not,” explains Michael Behringer, MD, PhD, a professor of sports science at Goethe University in Frankfurt, Germany. Behringer says it’s possible that a drop in electrolytes—sweating out stuff like magnesium, potassium, or sodium—could produce fluid imbalances that contribute to cramping. But there’s clearly more to it than that, because simply ingesting more electrolytes is an ineffective treatment “in most cases,” Behringer says.

Cramps occur when something to do with those electrical currents goes haywire.

Researchers who study muscle cramps say it’s helpful to understand exactly what’s happening when a cramp occurs. “They are not a muscle disorder, but rather they are a disorder of motor neurons,” says Scott Garrison, MD, PhD, an associate professor of family medicine at the University of Alberta who has studied muscle cramps.

Like the light fixtures in your house, your muscles run on electricity. And the electrical impulses that turn your muscles on and off travel to them via wires—or neurons—that are housed in your spinal cord. Cramps occur when something to do with those electrical currents goes haywire.

Behringer says the stuff going haywire may involve the Golgi tendon organ (GTO), a structure of the nervous system found throughout the body at the intersection of muscle fibers and tendons. He explains that the GTO plays a kind of activity-dampening role—limiting the kind of “excitability” that produces muscle contraction. In some circumstances, the GTO’s control is muffled, and so there may be an imbalance in the amount of electrical information reaching the alpha motor neuron (basically, the muscle’s on/off switch) in the spinal cord.

But why do some people experience cramps while others don’t? Behringer points to something called the “cramp threshold,” which is the amount of electrical stimulation needed to trigger a cramp in a given individual. The cramp threshold seems to vary from person to person. If you’re someone with a very low threshold, exercise and sweat-induced fluid imbalances—or spending time with your muscles in contracted positions—could produce cramps.

Any condition that disrupts or kills off motor neuron activity could also lead to the kind of electrical discombobulation that causes muscle cramps. This is partially why muscle cramps are common symptoms of degenerative neurological conditions like ALS. They are also common in patients with Type 2 diabetes, a condition that can cause nerve damage. Aging can also contribute to cramps. “Around the same time that we start losing our motor neurons”—roughly, a person’s early fifties—rest cramps start to get more common,” Garrison says.

So, what’s an effective remedy? Garrison has examined the science on electrolyte supplementation—specifically, taking magnesium—to combat cramps in older adults and found no evidence that it works. While it’s possible that taking magnesium, potassium, or other electrolytes could help some younger cramp sufferers, there hasn’t been much compelling evidence to support this. (Still, heavy exercisers should note that sweating a lot and drinking only water to rehydrate can throw off electrolyte and fluid balances. Behringer points out that for people with low cramp thresholds, these sorts of imbalances could trigger cramps.)

“Stretching the affected muscle while you cramp probably helps abort a cramp,” says Garrison, highlighting the most common improvised cure. But “prophylactic stretching” before bedtime or other times when you tend to cramp doesn’t seem to do much good, he adds. He mentions vitamin D supplementation as another remedy that’s being studied, though research so far hasn’t turned up a clear benefit.

Some of Behringer’s research has found that electrical stimulation can increase a person’s cramp threshold in ways that significantly reduce cramps. “This change was not only seen in healthy people, but also in people with increased tendency for muscle cramps,” he says. This form of therapy is still being studied, however, and isn’t yet available outside research settings.

Other experts are examining the effectiveness of drugs that close off aspects of a muscle’s electrical activity. One of these drugs, mexiletine, is a sodium-channel blocker that appears to lower the kind of muscle “overexcitability” that leads to cramps, says Michael Weiss, MD, director of the Neuromuscular Diseases Division in the Department of Neurology at the University of Washington. Weiss says this may prove effective for patients with cramps stemming from nerve diseases like ALS.

But for the average cramp sufferer, remedies are hard to come by. “I usually tell patients to start with a lot of stretching and also to hydrate,” Weiss says. “But the evidence for just about any medication for muscle cramps is pretty weak.”

This story was originally published on Medium.