what is the function and structure of the nervous system