Scientists have discovered that sea star larvae swirl the water around their bodies to suck in pieces of food and propel themselves through the water. The researchers published their findings in the journal Nature Physics.

Baby sea stars bear almost no resemblance to their slow-moving, stelliform parents. Each lumpy little larva is smaller than a grain of rice and spends its days paddling across the open ocean, trying to gobble up enough energy to morph into its next form. It’s a tightrope act: The larvae have to paddle far and fast enough to find food, but not so far and fast that they use up all the energy they currently have.

Researchers at Stanford University’s Prakash Lab were fascinated by the young sea stars’ predicament. They wondered how the larva got its shape and why it moved the way it did. To find out, they brought lots of larvae into the lab and let them loose under microscopes hooked up to video cameras. The researchers tracked the movement of three distinct elements: the sea stars themselves, the water around them, and particles of algae suspended in the water.

They soon realized that they were looking at very accomplished water-benders. The movements of cilia (tiny hairs) on the sea stars’ bodies were creating swirling vortices in the water. All that wiggling seemed like a lot of work. So why were they doing it?

Upon closer inspection, the researchers realized that wiggling allowed the larvae to do less work in the long run. Some of the vortices caught particles of algae and spun it closer to the sea stars’ waiting mouths. Others helped push them forward through the water. The larvae, in other words, had created a life hack, making the water do the work for them.

“Evolution seeks to satisfy basic constraints,” first author William Gilpin said in a statement. “The first solution that works very often wins.”