added ability to have threads recover from errors.