Refactor error correction.