implements edit history if has error and spec refactoring.