When we think about our weight it’s often tied to how much fat we have in our bodies.

But in early 2016, scientists debunked body-mass index (BMI), a calculation of someone’s percentage of body fat based on their height and weight, as a measure (paywall) of overall health. The authors argued that having a high BMI didn’t necessarily mean that patients faced the same health risks that obesity can lead to; conversely, having a low BMI didn’t mean that patients were healthier.

We all need some fat. It’s an important component of cell membranes, a place to store energy and some vitamins, and it’s used to make different hormones we need to transmit messages throughout the body.

Yet higher percentages of body fat above 25% for men and 30% for women can be a health hazard. This is especially the case if it’s stored in our upper bodies or around our internal organs, which can cause myriad problems ranging from increased risk of diabetes, heart disease, and cancer.

If you want to shed fat, it’s important to understand just how the fat cells in our bodies work.

In it for the long haul

In 2008, Kirsty Spalding, a molecular biologist studying fat at the Karolinska Institute in Sweden, made a surprising discovery (paywall): As adults, we keep the same number of fat cells throughout our lives, regardless of whether we gain or lose weight over time.

“It’s as if we’re programmed, in a way, to have this number of fat cells.”

Spalding explained that from infancy to our early 20s, the number of fat cells in our bodies increase. Once we hit our mid-20s, though, we maintain the number of fat cells we have. Though some cells may die, our bodies are quick to replace them. “It’s as if we’re programmed, in a way, to have this number of fat cells,” she said. Scientists still aren’t sure why some people have more fat cells than others. (They also don’t know whether or not our bodies replace fat cells after undergoing liposuction.)

These fat cells alone aren’t a bad thing. When fat becomes a part of our bodies, it’s called adipose tissue. Stephen Neabore, a physician at Barnard Medical Center, said that this tissue is comparable to an organ because of all the jobs it carries out.

Over half of our brains are made of fat, and fatty acids contribute to our nerve development and function. We also need fat to develop hormones, which serve as the body’s chemical signals between different types of tissues. It provides cushioning for our internal organs, almost like shock absorbers, while we do things like run or jump. Additionally, some kinds of fat can act as insulation from the cold, especially in infants.

Fat is also a convenient way to store a lot of energy in a small space. Chemically, the fat we eat (usually in the form of fatty acids) are chains of hydrogen and carbon attached to a sugar-alcohol molecule. The energy we get from fat—usually around nine calories per gram—comes from the way that our bodies break down the bonds that hold the chains together. Other sources of food, like carbohydrates and proteins, only contain about four calories per gram. Neabore explained that fat around our tummies, thighs, and buttocks is often a healthy reserve of energy.

When we gain weight, we store the extra lipids we don’t use in our fat cells, which make them grow in size.

To a certain extent, our weight is related to both the number and the size of our fat cells: When we gain weight, we store the extra lipids we don’t use in our fat cells, which make them grow in size. As we lose it, we shrink these cells, but never disappear. This means that two people with similar body shapes could have drastically different numbers of fat cells, depending on how many lipids are stored in those cells.

In light of Spalding’s team’s discovery, this means that it can be difficult to keep weight off once we’ve lost it. ”If you can’t get rid of these cells, you’re just going to have these cells sitting there, constantly saying they want to be bigger,” she said.

Spalding explained that one of the hormones that fat cells produce is called leptin, which signals to our brains that we should stop eating. As they shrink, they produce less of this hormone, which means we may be inclined to eat more, growing the fat cells to their “happy size,” as Spalding put it. The best thing to do is to make sure kids maintain a healthy weight, since those who overweight are more likely (paywall) to be overweight as adults.

The right foods to strike a balance

Our primary resting energy source is a chemical called glycogen, which is a chain of sugars our bodies can make from food. One of the many jobs of our liver is to store glycogen for later use. Neabore said, “During the day when we eat, most of the simple sugars—or complex sugars, either way—work to refill our glycogen stores…When your liver is all the way full, the rest of what you’re trying to contribute will eventually get turned into fat.”

Weight loss is attributed to fat cells shrinking, not losing them entirely.

When we engage in an activity that requires energy, our bodies to use chemicals from the food we eat. It’s easiest to break down carbohydrates, but once we’ve gone through all the energy we can get from carbs (after roughly 20 to 45 minutes of exercise), our bodies move on to consuming fat, in the form of extra lipids, from our adipose tissue. Burning these lipids is what causes us to lose weight—assuming we don’t consume more to replace it. Weight loss is attributed to fat cells shrinking, not losing them entirely.

For the general population trying to maintain a healthy weight, (excluding those suffering from eating disorders or malnutrition) Neabore recommends a plant-based diet. This includes grains, fruits, vegetables, nuts, seeds, and beans.

“Fat is one of the basic building blocks of food, and all naturally occurring foods are made of some combination of [fat, carbohydrates, and protein],” he said. We’re able to get all of the nutrients we need from plants. Neabore says that if you’re trying to lose fat, it’s a good idea to avoid foods that are high in fat, which tend to include animal products, like beef. Though foods like meat and fish can also be nutritious, “you want to let your body burn off the fat it already has, and you don’t want to add more to your stockpile.”