Describe the three main functions of the spinal cord