How does the endocrine system maintain homeostasis?