What is the function of the nervous system in animals?