what is the general function of the nervous system