diff --git a/Source/Plugins/3DFloorMode/BuilderPlug.cs b/Source/Plugins/3DFloorMode/BuilderPlug.cs
index 86c075608e4eb712a26f50ecf7298639385b8ba3..deccc59f17ecc71f413d8853f5f3fb5c6700eb2d 100644
--- a/Source/Plugins/3DFloorMode/BuilderPlug.cs
+++ b/Source/Plugins/3DFloorMode/BuilderPlug.cs
@@ -93,6 +93,7 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
 		private LabelDisplayOption sectorlabeldisplayoption;
 		private LabelDisplayOption slopevertexlabeldisplayoption;
 		private PreferencesForm preferencesform;
+		private bool selectchangedafterundoredo;
 
 		// TMP
 		public List<Line3D> drawlines;
@@ -124,6 +125,7 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
         public float HighlightSlopeRange { get { return highlightsloperange; } }
 		public List<SlopeVertexGroup> SlopeVertexGroups { get { return slopevertexgroups; } set { slopevertexgroups = value; } }
 		public float StitchRange { get { return stitchrange; } }
+		public bool SelectChangedAfterUndoRedo { get { return selectchangedafterundoredo; } internal set { selectchangedafterundoredo = value; } }
 
 		public Sector SlopeDataSector { get { return slopedatasector; } set { slopedatasector = value; } }
 
@@ -471,7 +473,7 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
 			stitchrange = (float)General.Settings.ReadPluginSetting("BuilderModes", "stitchrange", 20);
 			slopevertexlabeldisplayoption = (LabelDisplayOption)General.Settings.ReadPluginSetting("slopevertexlabeldisplayoption", (int)LabelDisplayOption.Always);
 			sectorlabeldisplayoption = (LabelDisplayOption)General.Settings.ReadPluginSetting("sectorlabeldisplayoption", (int)LabelDisplayOption.Always);
-			
+			selectchangedafterundoredo = General.Settings.ReadPluginSetting("BuilderModes", "selectchangedafterundoredo", false);
 		}
 
 		public void StoreSlopeVertexGroupsInSector()
diff --git a/Source/Plugins/3DFloorMode/ThreeDFloorMode.cs b/Source/Plugins/3DFloorMode/ThreeDFloorMode.cs
index 227a22407355dcacaabc86d983ce0470ddd01235..0a4de1d73ed81a9aefd26cd1f46c1574e76ec577 100644
--- a/Source/Plugins/3DFloorMode/ThreeDFloorMode.cs
+++ b/Source/Plugins/3DFloorMode/ThreeDFloorMode.cs
@@ -1321,6 +1321,13 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
 			// Get all 3D floors in case th undo did affect them
 			threedfloors = BuilderPlug.GetThreeDFloors(General.Map.Map.Sectors.ToList());
 
+			// Select changed map elements
+			if (BuilderPlug.Me.SelectChangedAfterUndoRedo)
+			{
+				General.Map.Map.SelectMarkedGeometry(true, true);
+				General.Map.Map.ConvertSelection(SelectionType.Sectors);
+			}
+
 			// Clear labels
 			SetupLabels();
 			UpdateLabels();
@@ -1341,6 +1348,13 @@ namespace CodeImp.DoomBuilder.ThreeDFloorMode
 			// Get all 3D floors in case th redo did affect them
 			threedfloors = BuilderPlug.GetThreeDFloors(General.Map.Map.Sectors.ToList());
 
+			// Select changed map elements
+			if (BuilderPlug.Me.SelectChangedAfterUndoRedo)
+			{
+				General.Map.Map.SelectMarkedGeometry(true, true);
+				General.Map.Map.ConvertSelection(SelectionType.Sectors);
+			}
+
 			// Clear labels
 			SetupLabels();
 			UpdateLabels();
diff --git a/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs
index 7bfb079e61ddc95b4b9f2f93cd1db9e9ba53a237..cd4201110a6512f03b78c4dea763a782b41df56a 100755
--- a/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs
+++ b/Source/Plugins/BuilderModes/ClassicModes/LinedefsMode.cs
@@ -863,6 +863,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			// Recreate the blockmap to not include the potentially un-done lines anymore
 			CreateBlockmap();
 
+			// Select changed map elements
+			if (BuilderPlug.Me.SelectChangedafterUndoRedo)
+			{
+				General.Map.Map.SelectMarkedGeometry(true, true);
+				General.Map.Map.ConvertSelection(SelectionType.Linedefs);
+			}
+
 			// If something is highlighted make sure to update the association so that it contains valid data
 			if (highlighted != null && !highlighted.IsDisposed)
 				highlightasso.Set(highlighted);
@@ -880,6 +887,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			// Recreate the blockmap to include the potentially re-done linedefs again
 			CreateBlockmap();
 
+			// Select changed map elements
+			if (BuilderPlug.Me.SelectChangedafterUndoRedo)
+			{
+				General.Map.Map.SelectMarkedGeometry(true, true);
+				General.Map.Map.ConvertSelection(SelectionType.Linedefs);
+			}
+
 			// If something is highlighted make sure to update the association so that it contains valid data
 			if (highlighted != null && !highlighted.IsDisposed)
 				highlightasso.Set(highlighted);
diff --git a/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs
index 6322237491b0702141f4894f5d39eaf51916500c..a7fd69b848789b924d9ea8b68740157723af7718 100755
--- a/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs
+++ b/Source/Plugins/BuilderModes/ClassicModes/SectorsMode.cs
@@ -1522,6 +1522,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			// Recreate the blockmap to not include the potentially un-done sectors and things anymore
 			CreateBlockmap();
 
+			// Select changed map elements
+			if (BuilderPlug.Me.SelectChangedafterUndoRedo)
+			{
+				General.Map.Map.SelectMarkedGeometry(true, true);
+				General.Map.Map.ConvertSelection(SelectionType.Sectors);
+			}
+
 			// Clear the cache of things that already got their sector determined
 			determinedsectorthings = new ConcurrentDictionary<Thing, bool>();
 
@@ -1551,6 +1558,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			// Recreate the blockmap to include the potentially re-done sectors and things again
 			CreateBlockmap();
 
+			// Select changed map elements
+			if (BuilderPlug.Me.SelectChangedafterUndoRedo)
+			{
+				General.Map.Map.SelectMarkedGeometry(true, true);
+				General.Map.Map.ConvertSelection(SelectionType.Sectors);
+			}
+
 			// Clear the cache of things that already got their sector determined
 			determinedsectorthings = new ConcurrentDictionary<Thing, bool>();
 
diff --git a/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs b/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs
index db959616f69cf8e55fd1b969035e3532e23fd2e4..0067273cc4d6c1c092e45c19fe6492cd250d49db 100755
--- a/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs
+++ b/Source/Plugins/BuilderModes/ClassicModes/ThingsMode.cs
@@ -584,6 +584,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
 		{
 			base.OnUndoEnd();
 
+			// Select changed map elements
+			if (BuilderPlug.Me.SelectChangedafterUndoRedo)
+			{
+				General.Map.Map.SelectMarkedGeometry(true, true);
+				General.Map.Map.ConvertSelection(SelectionType.Things);
+			}
+
 			// If something is highlighted make sure to update the association so that it contains valid data
 			if (highlighted != null && !highlighted.IsDisposed)
 				highlightasso.Set(highlighted);
@@ -598,6 +605,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
 		{
 			base.OnRedoEnd();
 
+			// Select changed map elements
+			if (BuilderPlug.Me.SelectChangedafterUndoRedo)
+			{
+				General.Map.Map.SelectMarkedGeometry(true, true);
+				General.Map.Map.ConvertSelection(SelectionType.Things);
+			}
+
 			// If something is highlighted make sure to update the association so that it contains valid data
 			if (highlighted != null && !highlighted.IsDisposed)
 				highlightasso.Set(highlighted);
diff --git a/Source/Plugins/BuilderModes/ClassicModes/VerticesMode.cs b/Source/Plugins/BuilderModes/ClassicModes/VerticesMode.cs
index 9c306db93cf16bd742d3a400b6c578cffc336bb2..1c5be2bce942845241bd0051fbb11c81fc4d05df 100755
--- a/Source/Plugins/BuilderModes/ClassicModes/VerticesMode.cs
+++ b/Source/Plugins/BuilderModes/ClassicModes/VerticesMode.cs
@@ -569,6 +569,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
 
 			// Recreate the blockmap
 			CreateBlockmap();
+
+			// Select changed map elements
+			if (BuilderPlug.Me.SelectChangedafterUndoRedo)
+			{
+				General.Map.Map.SelectMarkedGeometry(true, true);
+				General.Map.Map.ConvertSelection(SelectionType.Vertices);
+			}
 		}
 
 		public override void OnRedoEnd()
@@ -577,6 +584,13 @@ namespace CodeImp.DoomBuilder.BuilderModes
 
 			// Recreate the blockmap
 			CreateBlockmap();
+
+			// Select changed map elements
+			if (BuilderPlug.Me.SelectChangedafterUndoRedo)
+			{
+				General.Map.Map.SelectMarkedGeometry(true, true);
+				General.Map.Map.ConvertSelection(SelectionType.Vertices);
+			}
 		}
 
 		//mxd
diff --git a/Source/Plugins/BuilderModes/General/BuilderPlug.cs b/Source/Plugins/BuilderModes/General/BuilderPlug.cs
index 185597a7f35503223cc48f3fa7cb3af61c0924e6..63474cdff42eb6fa92845b5561dd666f83db77dd 100755
--- a/Source/Plugins/BuilderModes/General/BuilderPlug.cs
+++ b/Source/Plugins/BuilderModes/General/BuilderPlug.cs
@@ -142,6 +142,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 		private int eventlinelabelstyle; // 0 = Action only, 1 = Action + short arguments, 2 = action + full arguments
 		private bool eventlinedistinctcolors;
 		private bool useoppositesmartpivothandle;
+		private bool selectchangedafterundoredo;
 
 		#endregion
 
@@ -201,6 +202,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 		public int EventLineLabelStyle { get { return eventlinelabelstyle; } internal set { eventlinelabelstyle = value; } }
 		public bool EventLineDistinctColors { get { return eventlinedistinctcolors; } internal set { eventlinedistinctcolors = value; } }
 		public bool UseOppositeSmartPivotHandle { get { return useoppositesmartpivothandle; } internal set { useoppositesmartpivothandle = value; } }
+		public bool SelectChangedafterUndoRedo { get { return selectchangedafterundoredo; } internal set { selectchangedafterundoredo = value; } }
 
 		//mxd. "Make Door" action persistent settings
 		internal MakeDoorSettings MakeDoor;
@@ -309,6 +311,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			eventlinelabelstyle = General.Settings.ReadPluginSetting("eventlinelabelstyle", 2);
 			eventlinedistinctcolors = General.Settings.ReadPluginSetting("eventlinedistinctcolors", true);
 			useoppositesmartpivothandle = General.Settings.ReadPluginSetting("useoppositesmartpivothandle", true);
+			selectchangedafterundoredo = General.Settings.ReadPluginSetting("selectchangedafterundoredo", false);
 		}
 
 		//mxd. Load settings, which can be changed via UI
diff --git a/Source/Plugins/BuilderModes/Interface/PreferencesForm.Designer.cs b/Source/Plugins/BuilderModes/Interface/PreferencesForm.Designer.cs
index 1eef7d70aac4ed34858fea9bb36769a5ee21525f..aa23d90fa9675546f454687e5023cc3c7852da18 100755
--- a/Source/Plugins/BuilderModes/Interface/PreferencesForm.Designer.cs
+++ b/Source/Plugins/BuilderModes/Interface/PreferencesForm.Designer.cs
@@ -43,6 +43,8 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			this.defaultbrightness = new CodeImp.DoomBuilder.Controls.ButtonsNumericTextbox();
 			this.label11 = new System.Windows.Forms.Label();
 			this.groupBox3 = new System.Windows.Forms.GroupBox();
+			this.selectafterundoredo = new System.Windows.Forms.CheckBox();
+			this.useoppositesmartpivothandle = new System.Windows.Forms.CheckBox();
 			this.additivepaintselect = new System.Windows.Forms.CheckBox();
 			this.switchviewmodes = new System.Windows.Forms.CheckBox();
 			this.autodrawonedit = new System.Windows.Forms.CheckBox();
@@ -78,7 +80,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			this.label10 = new System.Windows.Forms.Label();
 			this.label1 = new System.Windows.Forms.Label();
 			this.heightbysidedef = new System.Windows.Forms.ComboBox();
-			this.useoppositesmartpivothandle = new System.Windows.Forms.CheckBox();
 			this.tabs.SuspendLayout();
 			this.taboptions.SuspendLayout();
 			this.groupBox5.SuspendLayout();
@@ -274,6 +275,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			// 
 			// groupBox3
 			// 
+			this.groupBox3.Controls.Add(this.selectafterundoredo);
 			this.groupBox3.Controls.Add(this.useoppositesmartpivothandle);
 			this.groupBox3.Controls.Add(this.additivepaintselect);
 			this.groupBox3.Controls.Add(this.switchviewmodes);
@@ -294,10 +296,30 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			this.groupBox3.TabStop = false;
 			this.groupBox3.Text = " Options ";
 			// 
+			// selectafterundoredo
+			// 
+			this.selectafterundoredo.AutoSize = true;
+			this.selectafterundoredo.Location = new System.Drawing.Point(13, 336);
+			this.selectafterundoredo.Name = "selectafterundoredo";
+			this.selectafterundoredo.Size = new System.Drawing.Size(246, 17);
+			this.selectafterundoredo.TabIndex = 12;
+			this.selectafterundoredo.Text = "Select changed map elements after undo/redo";
+			this.selectafterundoredo.UseVisualStyleBackColor = true;
+			// 
+			// useoppositesmartpivothandle
+			// 
+			this.useoppositesmartpivothandle.AutoSize = true;
+			this.useoppositesmartpivothandle.Location = new System.Drawing.Point(13, 313);
+			this.useoppositesmartpivothandle.Name = "useoppositesmartpivothandle";
+			this.useoppositesmartpivothandle.Size = new System.Drawing.Size(321, 17);
+			this.useoppositesmartpivothandle.TabIndex = 12;
+			this.useoppositesmartpivothandle.Text = "Opposite side/vertex is smart pivot handle on triangular sectors";
+			this.useoppositesmartpivothandle.UseVisualStyleBackColor = true;
+			// 
 			// additivepaintselect
 			// 
 			this.additivepaintselect.AutoSize = true;
-			this.additivepaintselect.Location = new System.Drawing.Point(13, 135);
+			this.additivepaintselect.Location = new System.Drawing.Point(13, 131);
 			this.additivepaintselect.Name = "additivepaintselect";
 			this.additivepaintselect.Size = new System.Drawing.Size(233, 17);
 			this.additivepaintselect.TabIndex = 11;
@@ -307,7 +329,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			// switchviewmodes
 			// 
 			this.switchviewmodes.AutoSize = true;
-			this.switchviewmodes.Location = new System.Drawing.Point(13, 308);
+			this.switchviewmodes.Location = new System.Drawing.Point(13, 290);
 			this.switchviewmodes.Name = "switchviewmodes";
 			this.switchviewmodes.Size = new System.Drawing.Size(317, 17);
 			this.switchviewmodes.TabIndex = 10;
@@ -328,7 +350,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			// syncSelection
 			// 
 			this.syncSelection.AutoSize = true;
-			this.syncSelection.Location = new System.Drawing.Point(13, 283);
+			this.syncSelection.Location = new System.Drawing.Point(13, 267);
 			this.syncSelection.Name = "syncSelection";
 			this.syncSelection.Size = new System.Drawing.Size(295, 17);
 			this.syncSelection.TabIndex = 9;
@@ -338,7 +360,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			// dontMoveGeometryOutsideBounds
 			// 
 			this.dontMoveGeometryOutsideBounds.AutoSize = true;
-			this.dontMoveGeometryOutsideBounds.Location = new System.Drawing.Point(13, 258);
+			this.dontMoveGeometryOutsideBounds.Location = new System.Drawing.Point(13, 244);
 			this.dontMoveGeometryOutsideBounds.Name = "dontMoveGeometryOutsideBounds";
 			this.dontMoveGeometryOutsideBounds.Size = new System.Drawing.Size(323, 17);
 			this.dontMoveGeometryOutsideBounds.TabIndex = 8;
@@ -348,7 +370,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			// autoaligntexturesoncreate
 			// 
 			this.autoaligntexturesoncreate.AutoSize = true;
-			this.autoaligntexturesoncreate.Location = new System.Drawing.Point(13, 233);
+			this.autoaligntexturesoncreate.Location = new System.Drawing.Point(13, 221);
 			this.autoaligntexturesoncreate.Name = "autoaligntexturesoncreate";
 			this.autoaligntexturesoncreate.Size = new System.Drawing.Size(233, 17);
 			this.autoaligntexturesoncreate.TabIndex = 7;
@@ -358,7 +380,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			// autodragonpaste
 			// 
 			this.autodragonpaste.AutoSize = true;
-			this.autodragonpaste.Location = new System.Drawing.Point(13, 208);
+			this.autodragonpaste.Location = new System.Drawing.Point(13, 198);
 			this.autodragonpaste.Name = "autodragonpaste";
 			this.autodragonpaste.Size = new System.Drawing.Size(201, 17);
 			this.autodragonpaste.TabIndex = 6;
@@ -368,7 +390,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			// visualmodeclearselection
 			// 
 			this.visualmodeclearselection.AutoSize = true;
-			this.visualmodeclearselection.Location = new System.Drawing.Point(13, 183);
+			this.visualmodeclearselection.Location = new System.Drawing.Point(13, 176);
 			this.visualmodeclearselection.Name = "visualmodeclearselection";
 			this.visualmodeclearselection.Size = new System.Drawing.Size(231, 17);
 			this.visualmodeclearselection.TabIndex = 5;
@@ -378,7 +400,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			// autoclearselection
 			// 
 			this.autoclearselection.AutoSize = true;
-			this.autoclearselection.Location = new System.Drawing.Point(13, 158);
+			this.autoclearselection.Location = new System.Drawing.Point(13, 153);
 			this.autoclearselection.Name = "autoclearselection";
 			this.autoclearselection.Size = new System.Drawing.Size(241, 17);
 			this.autoclearselection.TabIndex = 4;
@@ -398,7 +420,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			// editnewsector
 			// 
 			this.editnewsector.AutoSize = true;
-			this.editnewsector.Location = new System.Drawing.Point(13, 87);
+			this.editnewsector.Location = new System.Drawing.Point(13, 85);
 			this.editnewsector.Name = "editnewsector";
 			this.editnewsector.Size = new System.Drawing.Size(253, 17);
 			this.editnewsector.TabIndex = 2;
@@ -408,7 +430,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			// additiveselect
 			// 
 			this.additiveselect.AutoSize = true;
-			this.additiveselect.Location = new System.Drawing.Point(13, 112);
+			this.additiveselect.Location = new System.Drawing.Point(13, 108);
 			this.additiveselect.Name = "additiveselect";
 			this.additiveselect.Size = new System.Drawing.Size(207, 17);
 			this.additiveselect.TabIndex = 3;
@@ -710,16 +732,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			this.heightbysidedef.Size = new System.Drawing.Size(309, 21);
 			this.heightbysidedef.TabIndex = 0;
 			// 
-			// useoppositesmartpivothandle
-			// 
-			this.useoppositesmartpivothandle.AutoSize = true;
-			this.useoppositesmartpivothandle.Location = new System.Drawing.Point(13, 333);
-			this.useoppositesmartpivothandle.Name = "useoppositesmartpivothandle";
-			this.useoppositesmartpivothandle.Size = new System.Drawing.Size(321, 17);
-			this.useoppositesmartpivothandle.TabIndex = 12;
-			this.useoppositesmartpivothandle.Text = "Opposite side/vertex is smart pivot handle on triangular sectors";
-			this.useoppositesmartpivothandle.UseVisualStyleBackColor = true;
-			// 
 			// PreferencesForm
 			// 
 			this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@@ -799,5 +811,6 @@ namespace CodeImp.DoomBuilder.BuilderModes
 		private System.Windows.Forms.ComboBox eventlinelabelvisibility;
 		private System.Windows.Forms.ComboBox eventlinelabelstyle;
 		private System.Windows.Forms.CheckBox useoppositesmartpivothandle;
+		private System.Windows.Forms.CheckBox selectafterundoredo;
 	}
 }
\ No newline at end of file
diff --git a/Source/Plugins/BuilderModes/Interface/PreferencesForm.cs b/Source/Plugins/BuilderModes/Interface/PreferencesForm.cs
index 139ae7f0e99f2cb4c469332f34a522a1f98d990a..98457f5450c8d6500c1a5b8c2c24584eb65e6ef1 100755
--- a/Source/Plugins/BuilderModes/Interface/PreferencesForm.cs
+++ b/Source/Plugins/BuilderModes/Interface/PreferencesForm.cs
@@ -68,6 +68,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			eventlinelabelvisibility.SelectedIndex = General.Settings.ReadPluginSetting("eventlinelabelvisibility", 3);
 			eventlinelabelstyle.SelectedIndex = General.Settings.ReadPluginSetting("eventlinelabelstyle", 2);
 			useoppositesmartpivothandle.Checked = General.Settings.ReadPluginSetting("useoppositesmartpivothandle", true);
+			selectafterundoredo.Checked = General.Settings.ReadPluginSetting("selectchangedafterundoredo", false);
 		}
 
 		#endregion
@@ -99,6 +100,7 @@ namespace CodeImp.DoomBuilder.BuilderModes
 			General.Settings.WritePluginSetting("eventlinelabelvisibility", eventlinelabelvisibility.SelectedIndex);
 			General.Settings.WritePluginSetting("eventlinelabelstyle", eventlinelabelstyle.SelectedIndex);
 			General.Settings.WritePluginSetting("useoppositesmartpivothandle", useoppositesmartpivothandle.Checked);
+			General.Settings.WritePluginSetting("selectchangedafterundoredo", selectafterundoredo.Checked);
 			General.Settings.SwitchViewModes = switchviewmodes.Checked; //mxd
 			General.Settings.SplitLineBehavior = (SplitLineBehavior)splitbehavior.SelectedIndex;//mxd