Add history to undo