How does the immune system help maintain homeostasis