Myxococcus xanthus creates complex and dynamic multicellular patterns as it swarms. The cells have two polar gliding engines: pulling type IV pili at their leading pole and pushing slime secretory nozzles at their lagging pole. Evidence is presented that slime secretion is vital for cell survival and that the peptidoglycan/cytoskeleton serves as a template to keep both engines oriented in the same direction. Swarming requires that each cell periodically reverse its gliding direction. For the leading pole to become the trailing pole, old engines are inactivated at both ends while new engines are being created at both ends. Reversal is initiated by a small G-protein reversal switch; a pulse of frzE approximately P from a reversal clock triggers MglA to bind GTP. Mgl.GTP then recognizes the engines that are currently in use and inactivates both of them. Meanwhile, new engines appear as instructed by the template, and the cell starts to glide in the opposite direction.