Prokaryotic cells move through liquids or over moist surfaces by swimming, swarming, gliding, twitching or floating. An impressive diversity of motility mechanisms has evolved in prokaryotes. Movement can involve surface appendages, such as flagella that spin, pili that pull and Mycoplasma 'legs' that walk. Internal structures, such as the cytoskeleton and gas vesicles, are involved in some types of motility, whereas the mechanisms of some other types of movement remain mysterious. Regardless of the type of motility machinery that is employed, most motile microorganisms use complex sensory systems to control their movements in response to stimuli, which allows them to migrate to optimal environments.