what does the endocrine system do and how does it work​