Split the handling of soft and hard failures into separate functions. No functional changes intended.