diff --git a/includes/powder.h b/includes/powder.h
index 687690ac6..d7a867b7a 100644
--- a/includes/powder.h
+++ b/includes/powder.h
@@ -381,7 +381,7 @@ static const part_type ptypes[PT_NUM] =
 	{"GLAS",	PIXPACK(0x404040),	0.0f,	0.00f * CFDS,	0.90f,	0.00f,	0.0f,	0.0f,	0.00f,	0.000f	* CFDS,	0,	0,		0,	0,	0,	1,	100,	SC_SOLIDS,		R_TEMP+0.0f	+273.15f,	150,	"Solid. Meltable. Shatters under pressure", TYPE_SOLID | PROP_NEUTPASS | PROP_HOT_GLOW, NULL},
 	{"PTCT",	PIXPACK(0x405050),	0.0f,	0.00f * CFDS,	0.90f,	0.00f,	0.0f,	0.0f,	0.00f,	0.000f	* CFDS,	0,	0,		0,	1,	1,	1,	100,	SC_ELEC,		R_TEMP+0.0f	+273.15f,	251,	"Semi-conductor. Only conducts electricity when cold (Less than 120C)", TYPE_SOLID|PROP_CONDUCTS, NULL},
 	{"BGLA",	PIXPACK(0x606060),	0.4f,	0.04f * CFDS,	0.94f,	0.95f,	-0.1f,	0.3f,	0.00f,	0.000f	* CFDS,	1,	0,		0,	5,	2,	1,	90,		SC_POWDERS,		R_TEMP+0.0f	+273.15f,	150,	"Broken Glass, Heavy particles. Meltable. Bagels.", TYPE_PART | PROP_HOT_GLOW, NULL},
-	{"THDR",	PIXPACK(0xFFFFA0),	0.0f,	0.00f * CFDS,	1.0f,	0.30f,	-0.99f,	0.6f,	0.62f,	0.000f	* CFDS,	0,	0,		0,	0,	0,	1,	1,		SC_ELEC,		9000.0f		+273.15f,	251,	"Lightning! Very hot, inflicts damage upon most materials, transfers current to metals.", TYPE_ENERGY, NULL},
+	{"THDR",	PIXPACK(0xFFFFA0),	0.0f,	0.00f * CFDS,	1.0f,	0.30f,	-0.99f,	0.6f,	0.62f,	0.000f	* CFDS,	0,	0,		0,	0,	0,	1,	1,		SC_ELEC,		9000.0f		+273.15f,	251,	"Lightning! Very hot, inflicts damage upon most materials, transfers current to metals.", TYPE_ENERGY, &update_THDR},
 	{"PLSM",	PIXPACK(0xBB99FF),	0.9f,	0.04f * CFDS,	0.97f,	0.20f,	0.0f,	-0.1f,	0.30f,	0.001f	* CFDS,	0,	0,		0,	0,	0,	1,	1,		SC_GAS,			9000.0f		+273.15f,	115,	"Plasma, extremely hot.", TYPE_GAS, NULL},
 	{"ETRD",	PIXPACK(0x404040),	0.0f,	0.00f * CFDS,	0.90f,	0.00f,	0.0f,	0.0f,	0.00f,	0.000f	* CFDS,	0,	0,		0,	1,	1,	1,	100,	SC_ELEC,		R_TEMP+0.0f	+273.15f,	251,	"Electrode. Creates a surface that allows Plasma arcs. (Use sparingly)", TYPE_SOLID|PROP_CONDUCTS, NULL},
 	{"NICE",	PIXPACK(0xC0E0FF),	0.0f,	0.00f * CFDS,	0.90f,	0.00f,	0.0f,	0.0f,	0.00f,	-0.0005f* CFDS,	0,	0,		0,	0,	20,	1,	100,	SC_SOLIDS,		35.0f,					46,		"Nitrogen Ice.", TYPE_SOLID, NULL},
@@ -465,7 +465,7 @@ static const part_type ptypes[PT_NUM] =
 	{"BOMB",	PIXPACK(0xFFF288),	0.6f,	0.01f * CFDS,	0.98f,	0.95f,	0.0f,	0.1f,	0.00f,	0.000f	* CFDS,	1,	0,		0,	0,	20,	1,	30,		SC_EXPLOSIVE,	R_TEMP-2.0f	+273.15f,	29,		"Bomb.", TYPE_PART, NULL},
 	{"C-5",		PIXPACK(0x2050E0),	0.0f,	0.00f * CFDS,	0.90f,	0.00f,	0.0f,	0.0f,	0.00f,	0.000f	* CFDS,	0,	0,		0,	0,	1,	1,	100,	SC_EXPLOSIVE,	R_TEMP+0.0f	+273.15f,	88,		"Cold explosive", TYPE_SOLID | PROP_NEUTPENETRATE, NULL},
 	{"SING",	PIXPACK(0x242424),	0.7f,	0.36f * CFDS,	0.96f,	0.80f,	0.1f,	0.12f,	0.00f,	-0.001f	* CFDS,	1,	0,		0,	0,	0,	1,	86,		SC_NUCLEAR,		R_TEMP+0.0f	+273.15f,	70,		"Singularity", TYPE_PART, NULL},
-	{"QRTZ",	PIXPACK(0xAADDDD),	0.0f,	0.00f * CFDS,	0.90f,	0.00f,	0.0f,	0.0f,	0.00f,	0.000f	* CFDS,	0,	0,		0,	0,	0,	1,	100,	SC_SOLIDS,		R_TEMP+0.0f	+273.15f,	3,		"Quartz, breakable mineral. Conducts but becomes brittle at lower temperatures.", TYPE_SOLID| PROP_HOT_GLOW, NULL},
+	{"QRTZ",	PIXPACK(0xAADDDD),	0.0f,	0.00f * CFDS,	0.90f,	0.00f,	0.0f,	0.0f,	0.00f,	0.000f	* CFDS,	0,	0,		0,	0,	0,	1,	100,	SC_SOLIDS,		R_TEMP+0.0f	+273.15f,	3,		"Quartz, breakable mineral. Conducts but becomes brittle at lower temperatures.", TYPE_SOLID|PROP_CONDUCTS|PROP_HOT_GLOW, NULL},
 	{"PQRT",	PIXPACK(0x88BBBB),	0.4f,	0.04f * CFDS,	0.94f,	0.95f,	-0.1f,	0.27f,	0.00f,	0.000f	* CFDS,	1,	0,		0,	0,	0,	1,	90,		SC_POWDERS,		R_TEMP+0.0f	+273.15f,	3,		"Broken quartz.", TYPE_PART| PROP_HOT_GLOW, NULL},
 	{"SEED",	PIXPACK(0xFBEC7D),	0.0f,	0.00f * CFDS,	0.90f,	0.00f,	0.0f,	0.0f,	0.00f,	0.000f	* CFDS,	0,	0,		0,	0,	0,	1,	100,	SC_LIFE,		9000.0f,				40,		"B2/S", TYPE_SOLID|PROP_LIFE, NULL},
 	{"MAZE",	PIXPACK(0xA8E4A0),	0.0f,	0.00f * CFDS,	0.90f,	0.00f,	0.0f,	0.0f,	0.00f,	0.000f	* CFDS,	0,	0,		0,	0,	0,	1,	100,	SC_LIFE,		9000.0f,				40,		"B3/S12345", TYPE_SOLID|PROP_LIFE, NULL},
diff --git a/src/elements/thdr.c b/src/elements/thdr.c
index 3e6f2f72f..3d46f9dd4 100644
--- a/src/elements/thdr.c
+++ b/src/elements/thdr.c
@@ -10,7 +10,7 @@ int update_THDR(UPDATE_FUNC_ARGS) {
 				r = pmap[y+ny][x+nx];
 				if ((r>>8)>=NPART || !r)
 					continue;
-				if ((ptypes[r&0xFF].properties&PROP_CONDUCTS) && !((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW) && parts[r>>8].ctype!=PT_SPRK)
+				if ((ptypes[r&0xFF].properties&PROP_CONDUCTS) && parts[r>>8].life==0 && !((r&0xFF)==PT_WATR||(r&0xFF)==PT_SLTW) && parts[r>>8].ctype!=PT_SPRK)
 				{
 					parts[i].type = PT_NONE;
 					parts[r>>8].ctype = parts[r>>8].type;
diff --git a/src/powder.c b/src/powder.c
index 4cabf5a25..4aa106378 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -1071,7 +1071,7 @@ int nearest_part(int ci, int t)
 
 void update_particles_i(pixel *vid, int start, int inc)
 {
-	int i, j, x, y, t, nx, ny, r, a, s, lt, rt, fe, nt, lpv, nearp, pavg, nnx, nny, q, golnum, goldelete, z, ctype, temp, trade, docontinue, nxx, nyy, nxi, nyi;
+	int i, j, x, y, t, nx, ny, r, a, s, lt, rt, fe, nt, lpv, nearp, pavg, nnx, nny, q, golnum, goldelete, z, ctype, temp, trade, docontinue, nxx, nyy, nxi, nyi, ct, conduct_sprk;
 	float mv, dx, dy, ix, iy, lx, ly, d, pp, nrx, nry, dp, rr, rrr;
 	float nn, ct1, ct2;
 	float pt = R_TEMP;
@@ -1339,37 +1339,15 @@ void update_particles_i(pixel *vid, int start, int inc)
 			//printf("parts[%d].type: %d\n", i, parts[i].type);
 
 
-			if (parts[i].life && t!=PT_ACID  && t!=PT_COAL && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH && t!=PT_STKM && t!=PT_STKM2 && t!=PT_FUSE && t!=PT_FSEP && t!=PT_BCOL && t!=PT_GOL && t!=PT_SPNG && t!=PT_DEUT)
+			if (parts[i].life && t!=PT_ACID  && t!=PT_COAL && t!=PT_WOOD && t!=PT_NBLE && t!=PT_STKM && t!=PT_STKM2 && t!=PT_FUSE && t!=PT_FSEP && t!=PT_BCOL && t!=PT_GOL && t!=PT_SPNG && t!=PT_DEUT)
 			{
-				if (!(parts[i].life==10&&(parts[i].type==PT_LCRY||parts[i].type==PT_PCLN||parts[i].type==PT_HSWC||parts[i].type==PT_PUMP)))
+				if (!(parts[i].life==10&&(t==PT_SWCH||t==PT_LCRY||t==PT_PCLN||t==PT_HSWC||t==PT_PUMP)))
 					parts[i].life--;
-				if (parts[i].life<=0 && !(ptypes[t].properties&PROP_CONDUCTS) && t!=PT_ARAY && t!=PT_FIRW && t!=PT_PCLN && t!=PT_HSWC && t!=PT_PUMP && t!=PT_SPRK && t!=PT_LAVA && t!=PT_LCRY && t!=PT_QRTZ && t!=PT_GLOW && t!= PT_FOG && t!=PT_PIPE && t!=PT_FRZW &&(t!=PT_ICEI&&parts[i].ctype!=PT_FRZW)&&t!=PT_INST && t!=PT_SHLD1&& t!=PT_SHLD2&& t!=PT_SHLD3&& t!=PT_SHLD4)
+				if (parts[i].life<=0 && !(ptypes[t].properties&PROP_CONDUCTS) && t!=PT_ARAY && t!=PT_FIRW && t!=PT_SWCH && t!=PT_PCLN && t!=PT_HSWC && t!=PT_PUMP && t!=PT_SPRK && t!=PT_LAVA && t!=PT_LCRY && t!=PT_QRTZ && t!=PT_GLOW && t!= PT_FOG && t!=PT_PIPE && t!=PT_FRZW &&(t!=PT_ICEI&&parts[i].ctype!=PT_FRZW)&&t!=PT_INST && t!=PT_SHLD1&& t!=PT_SHLD2&& t!=PT_SHLD3&& t!=PT_SHLD4)
 				{
 					kill_part(i);
 					continue;
 				}
-				if (parts[i].life<=0 && t==PT_SPRK)
-				{
-					t = parts[i].ctype;
-					if (t!=PT_METL&&t!=PT_IRON&&t!=PT_BMTL&&t!=PT_BRMT&&t!=PT_LRBD&&t!=PT_RBDM&&t!=PT_BTRY&&t!=PT_NBLE&&t!=PT_QRTZ)
-						parts[i].temp = R_TEMP + 273.15f;
-					if (!t)
-						t = PT_METL;
-					parts[i].type = t;
-					parts[i].life = 4;
-					if (t == PT_WATR)
-						parts[i].life = 64;
-					if (t == PT_SLTW)
-						parts[i].life = 54;
-					if (t == PT_SWCH)
-						parts[i].life = 15;
-				}
-			}
-
-			if (t==PT_SPRK&&parts[i].ctype==PT_SPRK)
-			{
-				kill_part(i);
-				continue;
 			}
 
 			x = (int)(parts[i].x+0.5f);
@@ -1675,20 +1653,6 @@ void update_particles_i(pixel *vid, int start, int inc)
 				parts[i].vy = rr*sinf(rrr);
 				create_part(i, x, y, t);
 			}
-			if (t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==1)
-			{
-				nearp = nearest_part(i, PT_ETRD);
-				if (nearp!=-1&&parts_avg(i, nearp, PT_INSL)!=PT_INSL)
-				{
-					create_line((int)parts[i].x, (int)parts[i].y, (int)parts[nearp].x, (int)parts[nearp].y, 0, 0, PT_PLSM);
-					t = parts[i].type = PT_ETRD;
-					parts[i].ctype = PT_NONE;
-					parts[i].life = 20;
-					parts[nearp].type = PT_SPRK;
-					parts[nearp].life = 9;
-					parts[nearp].ctype = PT_ETRD;
-				}
-			}
 
 			if (!legacy_enable)
 			{
@@ -1928,22 +1892,6 @@ void update_particles_i(pixel *vid, int start, int inc)
 							}
 						}
 			}
-			else if (t==PT_NTCT||t==PT_PTCT||t==PT_INWR)
-			{
-				for (nx=-2; nx<3; nx++)
-					for (ny=-2; ny<3; ny++)
-						if (x+nx>=0 && y+ny>0 &&
-						        x+nx<XRES && y+ny<YRES && (nx || ny))
-						{
-							r = pmap[y+ny][x+nx];
-							if ((r>>8)>=NPART || !r)
-								continue;
-							if ((r&0xFF)==PT_SPRK && parts[r>>8].ctype==PT_METL && parts_avg(i, r>>8,PT_INSL)!=PT_INSL)
-							{
-								parts[i].temp = 473.0f;
-							}
-						}
-			}
 			else if (t==PT_YEST)
 			{
 				for (nx=-2; nx<3; nx++)
@@ -2282,41 +2230,6 @@ void update_particles_i(pixel *vid, int start, int inc)
 					t=parts[i].type=PT_NONE;
 				}
 			}
-			else if (t==PT_LCRY)
-			{
-				for (nx=-1; nx<2; nx++)
-					for (ny=-1; ny<2; ny++)
-						if (x+nx>=0 && y+ny>0 &&
-						        x+nx<XRES && y+ny<YRES && (nx || ny))
-						{
-							r = pmap[y+ny][x+nx];
-							if ((r>>8)>=NPART || !r)
-								continue;
-							rt = parts[r>>8].type;
-							if (rt==PT_SPRK)
-							{
-								if (parts[r>>8].ctype==PT_PSCN)
-								{
-									parts[i].life = 10;
-								}
-								else if (parts[r>>8].ctype==PT_NSCN)
-								{
-									parts[i].life = 9;
-								}
-							}
-							if (rt==PT_LCRY)
-							{
-								if (parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0)
-								{
-									parts[i].life = 9;
-								}
-								else if (parts[i].life==0&&parts[r>>8].life==10)
-								{
-									parts[i].life = 10;
-								}
-							}
-						}
-			}
 			else if (t==PT_FRZW)
 			{
 				for (nx=-1; nx<2; nx++)
@@ -2488,111 +2401,6 @@ void update_particles_i(pixel *vid, int start, int inc)
 							}
 						}
 			}
-			else if (t==PT_PCLN)
-			{
-				for (nx=-2; nx<3; nx++)
-					for (ny=-2; ny<3; ny++)
-						if (x+nx>=0 && y+ny>0 &&
-						        x+nx<XRES && y+ny<YRES && (nx || ny))
-						{
-							r = pmap[y+ny][x+nx];
-							if ((r>>8)>=NPART || !r)
-								continue;
-							rt = parts[r>>8].type;
-							if (rt==PT_SPRK)
-							{
-								if (parts[r>>8].ctype==PT_PSCN)
-								{
-									parts[i].life = 10;
-								}
-								else if (parts[r>>8].ctype==PT_NSCN)
-								{
-									parts[i].life = 9;
-								}
-							}
-							if (rt==PT_PCLN)
-							{
-								if (parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0)
-								{
-									parts[i].life = 9;
-								}
-								else if (parts[i].life==0&&parts[r>>8].life==10)
-								{
-									parts[i].life = 10;
-								}
-							}
-						}
-			}
-			else if (t==PT_HSWC)
-			{
-				for (nx=-2; nx<3; nx++)
-					for (ny=-2; ny<3; ny++)
-						if (x+nx>=0 && y+ny>0 &&
-						        x+nx<XRES && y+ny<YRES && (nx || ny))
-						{
-							r = pmap[y+ny][x+nx];
-							if ((r>>8)>=NPART || !r)
-								continue;
-							rt = parts[r>>8].type;
-							if (rt==PT_SPRK)
-							{
-								if (parts[r>>8].ctype==PT_PSCN)
-								{
-									parts[i].life = 10;
-								}
-								else if (parts[r>>8].ctype==PT_NSCN)
-								{
-									parts[i].life = 9;
-								}
-							}
-							if (rt==PT_HSWC)
-							{
-								if (parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0)
-								{
-									parts[i].life = 9;
-								}
-								else if (parts[i].life==0&&parts[r>>8].life==10)
-								{
-									parts[i].life = 10;
-								}
-							}
-						}
-			}
-			else if (t==PT_PUMP)
-			{
-				for (nx=-2; nx<3; nx++)
-					for (ny=-2; ny<3; ny++)
-						if (x+nx>=0 && y+ny>0 &&
-						        x+nx<XRES && y+ny<YRES && (nx || ny))
-						{
-							r = pmap[y+ny][x+nx];
-							if ((r>>8)>=NPART || !r)
-								continue;
-							rt = parts[r>>8].type;
-							if (rt==PT_SPRK)
-							{
-								if (parts[r>>8].ctype==PT_PSCN)
-								{
-									parts[i].life = 10;
-								}
-								else if (parts[r>>8].ctype==PT_NSCN)
-								{
-									parts[i].life = 9;
-								}
-							}
-							if (rt==PT_PUMP)
-							{
-								if (parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0)
-								{
-									parts[i].life = 9;
-								}
-								else if (parts[i].life==0&&parts[r>>8].life==10)
-								{
-									parts[i].life = 10;
-								}
-							}
-						}
-			}
 			else if (t==PT_SHLD1)
 			{
 				for (nx=-1; nx<2; nx++)
@@ -2894,9 +2702,28 @@ void update_particles_i(pixel *vid, int start, int inc)
 								}
 							}
 						}
-			} else if (t==PT_SWCH)
+			}
+			else if (t==PT_LCRY&&parts[i].life==10)
+			{
+				for (nx=-1; nx<2; nx++)
+					for (ny=-1; ny<2; ny++)
+						if (x+nx>=0 && y+ny>0 &&
+						        x+nx<XRES && y+ny<YRES && (nx || ny))
+						{
+							r = pmap[y+ny][x+nx];
+							if ((r>>8)>=NPART || !r)
+								continue;
+							if ((r&0xFF)==PT_LCRY)
+							{
+								if (parts[r>>8].life<10&&parts[r>>8].life>0)
+									parts[i].life = 9;
+								else if (parts[r>>8].life==0)
+									parts[r>>8].life = 10;
+							}
+						}
+			}
+			else if (t==PT_SWCH&&parts[i].life==10)
 			{
-				rt = 3 + (int)pv[y/CELL][x/CELL];
 				for (nx=-2; nx<3; nx++)
 					for (ny=-2; ny<3; ny++)
 						if (x+nx>=0 && y+ny>0 &&
@@ -2905,22 +2732,31 @@ void update_particles_i(pixel *vid, int start, int inc)
 							r = pmap[y+ny][x+nx];
 							if ((r>>8)>=NPART || !r)
 								continue;
-							rt = parts[r>>8].type;
-							if (parts[r>>8].type == PT_SWCH&&parts_avg(i,r>>8,PT_INSL)!=PT_INSL)
+							if ((r&0xFF) == PT_SWCH&&parts_avg(i,r>>8,PT_INSL)!=PT_INSL)
 							{
-								if (parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0)
-								{
+								if (parts[r>>8].life<10&&parts[r>>8].life>0)
 									parts[i].life = 9;
-								}
-								else if (parts[i].life==0&&parts[r>>8].life==10)
-								{
-									parts[i].life = 10;
-								}
+								else if (parts[r>>8].life==0)
+									parts[r>>8].life = 10;
 							}
-							else if (parts[r>>8].type == PT_SPRK && parts[r>>8].ctype==PT_SWCH && parts[i].life<10&&parts_avg(i,r>>8,PT_INSL)!=PT_INSL)
+						}
+			}
+			else if (t==PT_PCLN||t==PT_HSWC||t==PT_PUMP&&parts[i].life==10)
+			{
+				for (nx=-2; nx<3; nx++)
+					for (ny=-2; ny<3; ny++)
+						if (x+nx>=0 && y+ny>0 &&
+						        x+nx<XRES && y+ny<YRES && (nx || ny))
+						{
+							r = pmap[y+ny][x+nx];
+							if ((r>>8)>=NPART || !r)
+								continue;
+							if ((r&0xFF)==t)
 							{
-								parts[r>>8].type = parts[r>>8].ctype;
-								parts[r>>8].life = 9;
+								if (parts[r>>8].life<10&&parts[r>>8].life>0)
+									parts[i].life = 9;
+								else if (parts[r>>8].life==0)
+									parts[r>>8].life = 10;
 							}
 						}
 			}
@@ -2929,6 +2765,169 @@ void update_particles_i(pixel *vid, int start, int inc)
 				{
 					parts[i].life--;
 				}
+			if (t==PT_SPRK) {
+				ct = parts[i].ctype;
+
+				if (parts[i].life<=0)
+				{
+					t = ct;
+					if (t!=PT_METL&&t!=PT_PTCT&&t!=PT_NTCT&&t!=PT_IRON&&t!=PT_BMTL&&t!=PT_BRMT&&t!=PT_LRBD&&t!=PT_RBDM&&t!=PT_BTRY&&t!=PT_NBLE&&t!=PT_QRTZ)
+						parts[i].temp = R_TEMP + 273.15f;
+					if (!t)
+						t = PT_METL;
+					parts[i].type = t;
+					parts[i].life = 4;
+					if (t == PT_WATR)
+						parts[i].life = 64;
+					if (t == PT_SLTW)
+						parts[i].life = 54;
+					if (t == PT_SWCH)
+						parts[i].life = 15;
+				}
+				if (ct==PT_SPRK)
+				{
+					kill_part(i);
+					continue;
+				}
+				else if (ct==PT_ETRD&&parts[i].life==1)
+				{
+					nearp = nearest_part(i, PT_ETRD);
+					if (nearp!=-1&&parts_avg(i, nearp, PT_INSL)!=PT_INSL)
+					{
+						create_line((int)parts[i].x, (int)parts[i].y, (int)parts[nearp].x, (int)parts[nearp].y, 0, 0, PT_PLSM);
+						t = parts[i].type = PT_ETRD;
+						ct = parts[i].ctype = PT_NONE;
+						parts[i].life = 20;
+						parts[nearp].type = PT_SPRK;
+						parts[nearp].life = 9;
+						parts[nearp].ctype = PT_ETRD;
+					}
+				}
+				for (nx=-2; nx<3; nx++)
+					for (ny=-2; ny<3; ny++)
+						if (x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
+						{
+							r = pmap[y+ny][x+nx];
+							if ((r>>8)>=NPART || !r)
+								continue;
+							rt = parts[r>>8].type;
+							conduct_sprk = 1;
+
+
+							pavg = parts_avg(r>>8, i,PT_INSL);
+							if ((rt==PT_SWCH||(rt==PT_SPRK&&parts[r>>8].ctype==PT_SWCH)) && pavg!=PT_INSL)
+							{
+								if (rt==PT_SWCH) {
+									if (ct==PT_PSCN) {
+										if (parts[r>>8].life<10) parts[r>>8].life = 10;
+									}
+									else if (ct==PT_NSCN) parts[r>>8].life = 9;
+									else if (parts[r>>8].life==10) {
+										parts[r>>8].type = PT_SPRK;
+										parts[r>>8].ctype = PT_SWCH;
+										parts[r>>8].life = 4;
+									}
+								}
+								else if (ct==PT_NSCN) { // make sparked SWCH turn off correctly
+									parts[r>>8].type = PT_SWCH;
+									parts[r>>8].ctype = PT_NONE;
+									parts[r>>8].life = 9;
+								}
+							}
+							else if ((ct==PT_PSCN||ct==PT_NSCN) && (rt==PT_PUMP||rt==PT_HSWC||rt==PT_PCLN||(rt==PT_LCRY&&abs(nx)<2&&abs(ny)<2)))
+							{
+								if (ct==PT_PSCN) parts[r>>8].life = 10;
+								else if (ct==PT_NSCN) parts[r>>8].life = 9;
+							}
+
+
+							if (pavg == PT_INSL) conduct_sprk = 0;
+							if (t!=PT_SPRK) conduct_sprk = 0;
+							if (!(ptypes[rt].properties&PROP_CONDUCTS)) conduct_sprk = 0;
+
+							// ct = spark from material, rt = spark to material. Make conduct_sprk = 0 if conduction not allowed
+							if (ct==PT_METL && (rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR||(rt==PT_SPRK&&(parts[r>>8].ctype==PT_NTCT||parts[r>>8].ctype==PT_PTCT)))) {
+								parts[r>>8].temp = 473.0f;
+								if (rt==PT_NTCT||rt==PT_PTCT)
+									conduct_sprk = 0;
+							}
+							if (abs(nx)+abs(ny)>=4 &&ct!=PT_SWCH&&rt!=PT_SWCH)
+								conduct_sprk = 0;
+							if (ct==PT_NSCN&&rt==PT_PSCN)
+								conduct_sprk = 0;
+							if (rt==PT_NTCT) {
+								if (ct==PT_NSCN || ct==PT_NTCT || (ct==PT_PSCN&&parts[r>>8].temp>373.0f)) {}
+								else conduct_sprk = 0;
+							}
+							if (ct==PT_NTCT) {
+								if (rt==PT_PSCN || rt==PT_NTCT || (rt==PT_NSCN&&parts[i].temp>373.0f)) {}
+								else conduct_sprk = 0;
+							}
+							if (rt==PT_PTCT) {
+								if (ct==PT_NSCN || ct==PT_PTCT || (ct==PT_PSCN&&parts[r>>8].temp<373.0f)) {}
+								else conduct_sprk = 0;
+							}
+							if (ct==PT_PTCT) {
+								if (rt==PT_PSCN || rt==PT_PTCT || (rt==PT_NSCN&&parts[i].temp<373.0f)) {}
+								else conduct_sprk = 0;
+							}
+							if (rt==PT_INWR) {
+								if (ct==PT_NSCN || ct==PT_INWR || ct==PT_PSCN) {}
+								else conduct_sprk = 0;
+							}
+							if (ct==PT_INST&&rt!=PT_NSCN) conduct_sprk = 0;
+							if (rt==PT_INST&&ct!=PT_PSCN) conduct_sprk = 0;
+							if (ct==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN||rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR)) conduct_sprk = 0;
+							if (rt==PT_QRTZ) {
+								if ((ct==PT_NSCN||ct==PT_METL||ct==PT_PSCN||ct==PT_QRTZ) && (parts[r>>8].temp<173.15||pv[(y+ny)/CELL][(x+nx)/CELL]>8)) {}
+								else conduct_sprk = 0;
+							}
+							if (conduct_sprk) {
+								if (rt==PT_WATR||rt==PT_SLTW) {
+									if (parts[r>>8].life==0 && (parts[i].life<2 || ((r>>8)<i && parts[i].life<3)))
+									{
+										parts[r>>8].type = PT_SPRK;
+										if (rt==PT_WATR) parts[r>>8].life = 6;
+										else parts[r>>8].life = 5;
+										parts[r>>8].ctype = rt;
+									}
+								}
+								else if (parts[r>>8].life==0 && (parts[i].life<3 || ((r>>8)<i && parts[i].life<4))) {
+									parts[r>>8].life = 4;
+									parts[r>>8].ctype = rt;
+									rt = parts[r>>8].type = PT_SPRK;
+									if (parts[r>>8].temp+10.0f<673.0f&&!legacy_enable&&(rt==PT_METL||rt==PT_BMTL||rt==PT_BRMT||rt==PT_PSCN||rt==PT_NSCN||rt==PT_ETRD||rt==PT_NBLE||rt==PT_IRON))
+										parts[r>>8].temp = parts[r>>8].temp+10.0f;
+								}
+							}
+
+							if (ct==PT_ETRD&&parts[i].life==5)
+							{
+								if (rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN)
+								{
+									t = parts[i].type = PT_ETRD;
+									parts[i].ctype = PT_NONE;
+									parts[i].life = 20;
+									parts[r>>8].type = PT_SPRK;
+									parts[r>>8].life = 4;
+									parts[r>>8].ctype = rt;
+								}
+							}
+							else if (ct==PT_NBLE&&parts[i].life<=1)
+							{
+								parts[i].life = rand()%150+50;
+								t = parts[i].type = PT_PLSM;
+								ct = parts[i].ctype = PT_NBLE;
+								parts[i].temp = 3500;
+								pv[y/CELL][x/CELL] += 1;
+							}
+							else if (ct==PT_SWCH&&parts[i].life<=0)
+							{
+								t = parts[i].type = PT_SWCH;
+								parts[i].life = 14;
+							}
+						}
+			}
 			if (t==PT_FIRE || t==PT_PLSM || t==PT_LAVA || t==PT_SPRK || fe || (t==PT_PHOT&&(1>rand()%10)))
 			{
 				for (nx=-2; nx<3; nx++)
@@ -3012,130 +3011,6 @@ void update_particles_i(pixel *vid, int start, int inc)
 									}
 								}
 							}
-							//Check if there is a SWCH that is currently covered with SPRK
-							//If so check if the current SPRK is covering a NSCN
-							//If so turn the SPRK that covers the SWCH back into SWCH and turn it off
-							if (rt==PT_SPRK && parts[r>>8].ctype == PT_SWCH && t==PT_SPRK)
-							{
-								pavg = parts_avg(r>>8, i,PT_INSL);
-								if (parts[i].ctype == PT_NSCN&&pavg != PT_INSL)
-								{
-									parts[r>>8].type = PT_SWCH;
-									parts[r>>8].ctype = PT_NONE;
-									parts[r>>8].life = 9;
-								}
-							}
-							pavg = parts_avg(i, r>>8,PT_INSL);
-							if (rt==PT_SWCH && t==PT_SPRK)
-							{
-								pavg = parts_avg(r>>8, i,PT_INSL);
-								if (parts[i].ctype == PT_PSCN&&pavg != PT_INSL && parts[r>>8].life<10)
-									parts[r>>8].life = 10;
-								if (parts[i].ctype == PT_NSCN&&pavg != PT_INSL)
-									parts[r>>8].life = 9;
-								if (!(parts[i].ctype == PT_PSCN||parts[i].ctype == PT_NSCN)&&parts[r>>8].life == 10&&pavg != PT_INSL)
-								{
-									parts[r>>8].type = PT_SPRK;
-									parts[r>>8].ctype = PT_SWCH;
-									parts[r>>8].life = 4;
-								}
-							}
-							pavg = parts_avg(i, r>>8,PT_INSL);
-							if (pavg != PT_INSL)
-							{
-								if (t==PT_SPRK && (ptypes[rt].properties&PROP_CONDUCTS) && !(rt==PT_WATR||rt==PT_SLTW||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR) && parts[r>>8].life==0 &&
-								        (parts[i].life<3 || ((r>>8)<i && parts[i].life<4)) && abs(nx)+abs(ny)<4)
-								{
-									if (!(rt==PT_PSCN&&parts[i].ctype==PT_NSCN)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp>=373.0f)&&parts[i].ctype==PT_NTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN&&parts[i].temp<=373.0f)&&parts[i].ctype==PT_PTCT)&&!(rt!=PT_PSCN&&!(rt==PT_NSCN)&&parts[i].ctype==PT_INWR) && pavg != PT_INSL &&!(parts[i].ctype==PT_SWCH&&(rt==PT_PSCN||rt==PT_NSCN))&&!(parts[i].ctype==PT_INST&&rt!=PT_NSCN) )
-									{
-										parts[r>>8].type = PT_SPRK;
-										parts[r>>8].life = 4;
-										parts[r>>8].ctype = rt;
-										if (parts[r>>8].temp+10.0f<673.0f&&!legacy_enable&&!(rt==PT_LRBD||rt==PT_RBDM||rt==PT_NTCT||rt==PT_PTCT||rt==PT_INWR))
-											parts[r>>8].temp = parts[r>>8].temp+10.0f;
-									}
-								}
-								if (t==PT_SPRK && rt==PT_NTCT && parts[r>>8].life==0 &&
-								        (parts[i].life<3 || ((r>>8)<i && parts[i].life<4)) && abs(nx)+abs(ny)<4)
-								{
-									if ((parts[i].ctype==PT_NSCN||parts[i].ctype==PT_NTCT||(parts[i].ctype==PT_PSCN&&parts[r>>8].temp>373.0f))&&pavg != PT_INSL)
-									{
-										parts[r>>8].type = PT_SPRK;
-										parts[r>>8].life = 4;
-										parts[r>>8].ctype = rt;
-									}
-								}
-								if (t==PT_SPRK && rt==PT_PTCT && parts[r>>8].life==0 &&
-								        (parts[i].life<3 || ((r>>8)<i && parts[i].life<4)) && abs(nx)+abs(ny)<4)
-								{
-									if ((parts[i].ctype==PT_NSCN||parts[i].ctype==PT_PTCT||(parts[i].ctype==PT_PSCN&&parts[r>>8].temp<373.0f))&&pavg != PT_INSL)
-									{
-										parts[r>>8].type = PT_SPRK;
-										parts[r>>8].life = 4;
-										parts[r>>8].ctype = rt;
-									}
-								}
-								if (t==PT_SPRK && rt==PT_INWR && parts[r>>8].life==0 &&
-								        (parts[i].life<3 || ((r>>8)<i && parts[i].life<4)) && abs(nx)+abs(ny)<4)
-								{
-									if ((parts[i].ctype==PT_NSCN||parts[i].ctype==PT_INWR||parts[i].ctype==PT_PSCN)&&pavg != PT_INSL)
-									{
-										parts[r>>8].type = PT_SPRK;
-										parts[r>>8].life = 4;
-										parts[r>>8].ctype = rt;
-									}
-								}
-								if (t==PT_SPRK && rt==PT_QRTZ && parts[r>>8].life==0 &&
-								        (parts[i].life<3 || ((r>>8)<i && parts[i].life<4)) && abs(nx)+abs(ny)<4)
-								{
-									if ((parts[i].ctype==PT_NSCN||parts[i].ctype==PT_METL||parts[i].ctype==PT_PSCN||parts[i].ctype==PT_QRTZ)&&pavg != PT_INSL && (parts[r>>8].temp<173.15||pv[(y+ny)/CELL][(x+nx)/CELL]>8))
-									{
-										parts[r>>8].type = PT_SPRK;
-										parts[r>>8].life = 4;
-										parts[r>>8].ctype = rt;
-									}
-								}
-								if (t==PT_SPRK && rt==PT_WATR && parts[r>>8].life==0 &&
-								        (parts[i].life<2 || ((r>>8)<i && parts[i].life<3)) && abs(nx)+abs(ny)<4)
-								{
-									parts[r>>8].type = PT_SPRK;
-									parts[r>>8].life = 6;
-									parts[r>>8].ctype = rt;
-								}
-								if (t==PT_SPRK && rt==PT_SLTW && parts[r>>8].life==0 &&
-								        (parts[i].life<2 || ((r>>8)<i && parts[i].life<3)) && abs(nx)+abs(ny)<4)
-								{
-									parts[r>>8].type = PT_SPRK;
-									parts[r>>8].life = 5;
-									parts[r>>8].ctype = rt;
-								}
-								if (t==PT_SPRK&&parts[i].ctype==PT_ETRD&&parts[i].life==5)
-								{
-									if (rt==PT_METL||rt==PT_ETRD||rt==PT_BMTL||rt==PT_BRMT||rt==PT_LRBD||rt==PT_RBDM||rt==PT_PSCN||rt==PT_NSCN)
-									{
-										t = parts[i].type = PT_ETRD;
-										parts[i].ctype = PT_NONE;
-										parts[i].life = 20;
-										parts[r>>8].type = PT_SPRK;
-										parts[r>>8].life = 4;
-										parts[r>>8].ctype = rt;
-									}
-								}
-
-								if (t==PT_SPRK&&parts[i].ctype==PT_NBLE&&parts[i].life<=1)
-								{
-									parts[i].life = rand()%150+50;
-									parts[i].type = PT_PLSM;
-									parts[i].ctype = PT_NBLE;
-									parts[i].temp = 3500;
-									pv[y/CELL][x/CELL] += 1;
-								}
-								if (t==PT_SPRK&&parts[i].ctype==PT_SWCH&&parts[i].life<=0)
-								{
-									parts[i].type = PT_SWCH;
-									parts[i].life = 14;
-								}
-							}
 						}
 killed:
 				if (parts[i].type == PT_NONE)