refactoring UndoRedoStack