Added full Undo-Redo functionality