Factors affecting immune function