Added undo and redo support