Solves issue of undo/redo appears multiple time