refactoring

refactor the undo.push and redo.clear