Why failure teaches success