The nervous system controls all activities of the body and is divided into the central nervous system and peripheral nervous system. The central nervous system includes the brain and spinal cord and is formed of neurons and neuroglia. It processes sensory input and coordinates motor output. The peripheral nervous system includes nerves arising from the brain and spinal cord, and is divided into the somatic and autonomic nervous systems. The somatic system controls skeletal muscles and the autonomic system regulates involuntary functions like heart rate.