The nervous system helps the body maintain homeostasis by