The nervous system is divided into the central nervous system and peripheral nervous system. The central nervous system consists of the brain and spinal cord and contains gray matter and white matter. The peripheral nervous system is made up of nerves that branch throughout the body. The nervous system detects environmental changes and coordinates the body's actions and sensory information through transmitting signals via neurons. It is composed of neurons, which are the basic functional units, and neuroglia, which provide structure and support. The nervous system functions through nerve impulses that travel along neurons via action potentials and neurotransmitters to transmit signals between neurons.