The pineal gland and thymus gland are important endocrine glands. The pineal gland is located in the brain and produces melatonin, which regulates circadian rhythm and inhibits growth before puberty. The thymus gland is located in the chest and plays a key role in immune function by producing T cells and educating lymphocytes. Both glands are most active during childhood and gradually shrink and become less important later in life.