Serving more freshly prepared food in school cafeterias might sound simple. Buy different ingredients, cook more meals from scratch and serve fewer packaged foods.

But what if the school doesn't have enough cooks? Or the kitchen was designed to reheat food rather than prepare it? What if there isn't enough room for new equipment or suppliers don't offer the foods schools need at a price they can afford?

Those are some of the challenges identified in a new study of 20 school food service directors in California's San Joaquin Valley. Published in Public Health Nutrition, the study looked at what schools may need to prepare more food from scratch and rely less on ultraprocessed foods.

The findings are especially timely in California, where a new law will eventually remove certain ultraprocessed foods from public school meals. But the study also offers a broader look at why changing what's on a school lunch tray can require changing much of what happens behind the scenes.

Staffing was one of the biggest concerns.

Many school cafeterias rely on part-time employees who can heat and serve prepared foods but may not have the time or training to cook meals from basic ingredients. Two-thirds of the food service directors who completed the study's survey identified staffing shortages and a lack of money for additional labor as obstacles to doing more scratch cooking.

One food service director put it plainly: “They’re not trained cooks. They’re trained to heat and serve.”

Cooking more food from scratch can mean teaching employees new skills, giving them more hours and providing additional food safety training.

Then there's the kitchen itself.

Some schools have small or outdated kitchens that weren't designed for preparing meals from scratch. Adding equipment isn't always an easy fix. A kitchen may lack the space, ventilation or other features needed to use it.

That helps explain why prepared foods became so useful to schools in the first place.

School districts can receive foods such as meat, cheese and other ingredients through the U.S. Department of Agriculture. Some districts send those foods to manufacturers to be turned into products that are easier to prepare and serve.

One food service director described sending USDA chicken to a manufacturer and getting chicken patties and nuggets back.

For a cafeteria trying to feed hundreds of children with limited staff, time and equipment, that convenience can solve a very real problem.

California is now trying to shift that balance. Under the state's Real Food, Healthy Kids Act, schools will gradually phase out certain ultraprocessed foods. The law doesn't simply ban everything that might be described as ultraprocessed. It sets more specific requirements based on factors including certain additives, added sugars, sodium and saturated fat.

The new study didn't test whether scratch-cooked meals are healthier for children, and it wasn't designed to decide whether individual packaged foods are healthy or unhealthy. Instead, researchers wanted to understand what schools face when they try to cook more meals themselves.

And not every school food director described the transition as a struggle.

Some said grants had helped their districts buy new equipment and prepare more food from scratch. Having a fully equipped kitchen made a major difference. Cooking meals in-house could also give staff more control over ingredients and allow them to prepare foods that better reflect what their students enjoy eating.

That last part matters because making a different lunch doesn't accomplish much if students won't eat it.

Some food service directors said students rejected certain scratch-cooked dishes, leaving more food to be thrown away. Others said students preferred fresher meals.

Schools have found creative ways to figure out what works. Food service directors described taste tests, cooking demonstrations, family cooking events and student recipe competitions. In one district, students submitted nearly 300 recipes for a junior chef competition, with a winning dish making its way onto the school menu.

Familiarity mattered, too.

One food service director described students being less interested in lasagna but enthusiastic about pozole.

“When we give them something as yummy as like lasagna, that’s a foreign concept. But if we have something on the menu like pozole, because it’s ethnically relevant. Oh, they kill it. They’ll just, they’ll clean us out and go, hey, we want more.”

The study has important limitations. It involved only 20 food service directors from one region of California, so their experiences may not reflect those of schools elsewhere. Researchers also noted that people who agreed to participate may have been particularly interested in scratch cooking.

Still, the study highlights something that's easy to overlook when talking about improving children's diets. The food on a cafeteria tray is the end of a much bigger system.

Changing that food may also require enough people to prepare it, kitchens where they can cook it, suppliers that can provide it, budgets that can support it and, ultimately, meals that kids actually want to eat.

The research was supported by the National Institute of Diabetes and Digestive and Kidney Diseases, the National Heart, Lung, and Blood Institute, Stanford Maternal and Child Health Research Institute, the William and Nancy Thompson Family Foundation and Stanford Impact Labs.