diff --git a/src/uncategorized/REFI.tw b/src/uncategorized/REFI.tw
index 6d8adc5050ebf9c152a8f62d8127e932738ab9e8..d2ba783455f0dc5981cbe44141384d8ed2144ad0 100644
--- a/src/uncategorized/REFI.tw
+++ b/src/uncategorized/REFI.tw
@@ -329,14 +329,10 @@ It seems she passed by while you were enjoying the heavily pregnant $subSlave.sl
 
 <<case "boobs">>
 
-<<for $i = 0; $i < $slaves.length; $i++>>
-<<if $boobsID == $slaves[$i].ID>>
-<<set $slaves[$i].vaginalCount += 1>>
+<<set _refi = $slaveIndices[$boobsID]>>
+<<set $slaves[_refi].vaginalCount += 1>>
 <<set $vaginalTotal += 1>>
-<<set $subSlave = $slaves[$i]>>
-<<break>>
-<</if>>
-<</for>>
+<<set $subSlave = $slaves[_refi]>>
 
 /* 000-250-006 */
 <<if $seeImages == 1>>
@@ -355,19 +351,15 @@ $subSlave.slaveName is on lunch duty today. That means that as you eat your work
 
 <<case "submissive">>
 
-<<for $i = 0; $i < $slaves.length; $i++>>
-<<if $subID == $slaves[$i].ID>>
-<<if ($slaves[$i].vagina > -1) && ($slaves[$i].vaginalAccessory != "chastity belt")>>
-<<set $slaves[$i].vaginalCount += 1>>
-<<set $vaginalTotal += 1>>
+<<set _refi = $slaveIndices[$subID]>>
+<<if ($slaves[_refi].vagina > -1) && ($slaves[_refi].vaginalAccessory != "chastity belt")>>
+	<<set $slaves[_refi].vaginalCount += 1>>
+	<<set $vaginalTotal += 1>>
 <<else>>
-<<set $slaves[$i].analCount += 1>>
-<<set $analTotal += 1>>
+	<<set $slaves[_refi].analCount += 1>>
+	<<set $analTotal += 1>>
 <</if>>
-<<set $subSlave = $slaves[$i]>>
-<<break>>
-<</if>>
-<</for>>
+<<set $subSlave = $slaves[_refi]>>
 
 /* 000-250-006 */
 <<if $seeImages == 1>>
@@ -386,14 +378,10 @@ $subSlave.slaveName is lying on the edge of your desk with her body helpless ben
 
 <<case "buttslut">>
 
-<<for $i = 0; $i < $slaves.length; $i++>>
-<<if $buttslutID == $slaves[$i].ID>>
-<<set $slaves[$i].analCount += 1>>
+<<set _refi = $slaveIndices[$buttslutID]>>
+<<set $slaves[_refi].analCount += 1>>
 <<set $analTotal += 1>>
-<<set $subSlave = $slaves[$i]>>
-<<break>>
-<</if>>
-<</for>>
+<<set $subSlave = $slaves[_refi]>>
 
 /* 000-250-006 */
 <<if $seeImages == 1>>
@@ -412,14 +400,10 @@ In the middle of the afternoon, you take a break from work to fuck $subSlave.sla
 
 <<case "cumslut">>
 
-<<for $i = 0; $i < $slaves.length; $i++>>
-<<if $cumslutID == $slaves[$i].ID>>
-<<set $slaves[$i].oralCount += 1>>
+<<set _refi = $slaveIndices[$cumslutID]>>
+<<set $slaves[_refi].oralCount += 1>>
 <<set $oralTotal += 1>>
-<<set $subSlave = $slaves[$i]>>
-<<break>>
-<</if>>
-<</for>>
+<<set $subSlave = $slaves[_refi]>>
 
 /* 000-250-006 */
 <<if $seeImages == 1>>
@@ -438,19 +422,15 @@ You wake up to the sensation of $subSlave.slaveName eagerly sucking your dick. S
 
 <<case "humiliation">>
 
-<<for $i = 0; $i < $slaves.length; $i++>>
-<<if $humiliationID == $slaves[$i].ID>>
-<<if ($slaves[$i].vagina > -1) && ($slaves[$i].vaginalAccessory != "chastity belt")>>
-<<set $slaves[$i].vaginalCount += 1>>
-<<set $vaginalTotal += 1>>
+<<set _refi = $slaveIndices[$humiliationID]>>
+<<if ($slaves[_refi].vagina > -1) && ($slaves[_refi].vaginalAccessory != "chastity belt")>>
+	<<set $slaves[_refi].vaginalCount += 1>>
+	<<set $vaginalTotal += 1>>
 <<else>>
-<<set $slaves[$i].analCount += 1>>
-<<set $analTotal += 1>>
-<</if>>
-<<set $subSlave = $slaves[$i]>>
-<<break>>
+	<<set $slaves[_refi].analCount += 1>>
+	<<set $analTotal += 1>>
 <</if>>
-<</for>>
+<<set $subSlave = $slaves[_refi]>>
 
 /* 000-250-006 */
 <<if $seeImages == 1>>
diff --git a/src/uncategorized/saBeYourHeadGirl.tw b/src/uncategorized/saBeYourHeadGirl.tw
index 352b2aef637d456fdb898cfb0258644be9e9d8ec..6f2dc4987685094b40997fe1ebd6e6a7c988a8c1 100644
--- a/src/uncategorized/saBeYourHeadGirl.tw
+++ b/src/uncategorized/saBeYourHeadGirl.tw
@@ -49,8 +49,8 @@
 				<</if>>	
 			<<else>>
 				<<if totalRelatives($slaves[$i]) > 0>>
-					<<set _sbyhg = $slaves.findIndex(function(s) { return s.ID == $slaves[$i].relationshipTarget; })>>
-					<<if _sbyhg != -1>>
+					<<set _sbyhg = $slaveIndices[$slaves[$i].relationshipTarget]>>
+					<<if def _sbyhg>>
 						<<if $slaves[_sbyhg].mother == $slaves[$i].ID || $slaves[_sbyhg].father == $slaves[$i].ID>>
 							Your Consort has a daughter-wife. This is @@.green;as it should be.@@
 							<<set $rep += 100>>
diff --git a/src/uncategorized/saGuardsYou.tw b/src/uncategorized/saGuardsYou.tw
index 4b299deaffe99958bcb85041927ed5e0f0b229f7..f64a0f1e9c67a8936480066a3937302f68323599 100644
--- a/src/uncategorized/saGuardsYou.tw
+++ b/src/uncategorized/saGuardsYou.tw
@@ -186,8 +186,8 @@ Being continually trusted with your life @@.hotpink;increases her devotion to yo
 		<<unset $subSlave>>
 		<<set _flawedTrainee = 0>>
 		<<if $slaves[$i].relationship > 1>>
-			<<set $subSlave = $slaves.find( function(s) { return s.ID == $slaves[$i].relationshipTarget && s.combatSkill == 0 && bodyguardSuccessorEligible(s); })>>
-			<<if def $subSlave>>
+			<<set $subSlave = getSlave($slaves[$i].relationshipTarget)>>
+			<<if def $subSlave && $subSlave.combatSkill == 0 && bodyguardSuccessorEligible($subSlave)>>
 				She does her best to train $subSlave.slaveName whenever she can, hoping that her
 				<<if $slaves[$i].relationship > 4>>wife<<elseif $slaves[$i].relationship == 4>>lover<<elseif $slaves[$i].relationship == 3>>girlfriend<<else>>best friend<</if>>
 				can be made capable of stepping into her place.
@@ -224,7 +224,7 @@ Being continually trusted with your life @@.hotpink;increases her devotion to yo
 		<<if def $subSlave>>
 			<<if ($slaves[$i].intelligence + $slaves[$i].intelligenceImplant - _flawedTrainee) > random(1,10)>>
 				By the end of the week, she is satisfied that $subSlave.slaveName @@.green;has the combat skill@@ to contribute to your defense.
-				<<set _sgy = $slaves.findIndex( function(s) { return s.ID == $subSlave.ID;} )>>
+				<<set _sgy = $slaveIndices[$subSlave.ID]>>
 				<<set $slaves[_sgy].combatSkill = 1>>
 			<</if>>
 		<<else>>
diff --git a/src/uncategorized/saLongTermEffects.tw b/src/uncategorized/saLongTermEffects.tw
index 3c125f732f44d9a3668d33063d9e3e8f49bb2ec8..a057b1c55ddcdf7064fe5fb9acb892ad04b28347 100644
--- a/src/uncategorized/saLongTermEffects.tw
+++ b/src/uncategorized/saLongTermEffects.tw
@@ -269,7 +269,7 @@
 <<if ($slaves[$i].fetishKnown == 0)>>
 <<if ($slaves[$i].fetish == "humiliation")>>
 <<if random(1,100) > 90>>
-<<if not setup.modestClothes.includes($slaves[$i].clothes)>>
+<<if !setup.modestClothes.includes($slaves[$i].clothes)>>
 	Surprisingly, she takes to her extremely revealing clothing, and gets an obvious thrill from it. @@.lightcoral;She's a humiliation fetishist!@@
 	<<set $slaves[$i].fetishKnown = 1>>
 <</if>>
@@ -3785,7 +3785,7 @@
 		<<if $slaves[$i].pregSource == -1>>
 			<<set $PC.slavesKnockedUp++>>
 		<<elseif $slaves[$i].pregSource > 0>>
-			<<set _babyDaddy = $slaves.findIndex(function(s) { return s.ID == $slaves[$i].pregSource; })>>
+			<<set _babyDaddy = $slaveIndices[$slaves[$i].pregSource]>>
 			<<set $slaves[_babyDaddy].slavesKnockedUp++>>
 		<</if>>
 	<</if>>
@@ -4290,8 +4290,8 @@
 		<<set $slaves[$i].pregType = setPregType($slaves[$i])>>
 		<<set WombImpregnate($slaves[$i], $slaves[$i].pregType, $HeadGirl.ID, 1)>>
 		<<set $activeSlave = $slaves[$i]>><<if $slaves[$i].mpreg == 1>><<AnalVCheck 10>><<else>><<VaginalVCheck 10>><</if>><<set $slaves[$i] = $activeSlave>>
-		<<set _saLTE = $slaves.findIndex(function(s) { return s.ID == $HeadGirl.ID; })>>
-		<<if _saLTE != -1>>
+		<<set _saLTE = $slaveIndices[$HeadGirl.ID]>>
+		<<if def _saLTE>>
 			<<set $slaves[_saLTE] = $HeadGirl>>
 		<</if>>
 
@@ -4358,12 +4358,12 @@
 	<<default>> /* random impregnation chance on other assignments - consider relationships first */
 		<<if (_conceptionSeed > 80) && (($slaves[$i].vaginalCount > 0) || ($slaves[$i].analCount > 0 && $slaves[$i].mpreg > 0))>> /* TODO: compare to previous week totals? */
 			<<for _m = 0; _m < $slaves.length; _m++>>
-				<<if $slaves[$i].relationshipTarget == $slaves[_m].ID>>
-					<<set _tempLover = $slaves[_m]>>
-				<<elseif $slaves[$i].rivalryTarget == $slaves[_m].ID>>
-					<<set _tempRival = $slaves[_m]>>
-				<<elseif $slaves[$i].subTarget == $slaves[_m].ID>>
-					<<set _tempSub = $slaves[_m]>>
+				<<if $slaves[$i].relationshipTarget > 0>>
+					<<set _tempLover = getSlave($slaves[$i].relationshipTarget)>>
+				<<elseif $slaves[$i].rivalryTarget > 0>>
+					<<set _tempRival = getSlave($slaves[$i].rivalryTarget)>>
+				<<elseif $slaves[$i].subTarget > 0>>
+					<<set _tempSub = getSlave($slaves[$i].subTarget)>>
 				<</if>>
 			<</for>>
 			<<if ($PC.dick == 1) && (($slaves[$i].relationship == -3) || ($slaves[$i].relationship == -2)) && ($slaves[$i].eggType == "human")>>
@@ -4952,7 +4952,7 @@
 		<</if>>
 		<<if $slaves[$i].pregKnown == 1>>
 			<<if $slaves[$i].pregSource > 0>>
-				<<set _saLTE = $slaves.find(function(s) { return $slaves[$i].pregSource == s.ID; })>>
+				<<set _saLTE = getSlave($slaves[$i].pregSource)>>
 				<<if def _saLTE>>
 					<<if $slaves[$i].race != _saLTE.race>>
 						Society @@.red;strongly disapproves@@ of your allowing a pure $arcologies[0].FSSupremacistRace slave to be miscegenated by _saLTE.slaveName.
@@ -5002,7 +5002,7 @@
 		<</if>>
 	<<else>>
 		<<if $slaves[$i].pregKnown == 1 && $slaves[$i].pregSource > 0>>
-			<<set _lte = $slaves.findIndex(function(s) { return $slaves[$i].pregSource == s.ID; })>>
+			<<set _lte = getSlave($slaves[$i].pregSource)>>
 			<<if $slaves[_lte].race == $arcologies[0].FSSubjugationistRace>>
 				Society @@.red;strongly disapproves@@ of your allowing $slaves[$i].slaveName to be miscegenated by a $arcologies[0].FSSubjugationistRace subhuman like $slaves[_lte].slaveName.
 				<<FSChangePorn "Subjugationist" -2>>
diff --git a/src/uncategorized/saPleaseYou.tw b/src/uncategorized/saPleaseYou.tw
index a965788da5afbe51daf13bd355927e99acbc2c48..957d119034380947246ce22766ff85eb4a23288d 100644
--- a/src/uncategorized/saPleaseYou.tw
+++ b/src/uncategorized/saPleaseYou.tw
@@ -774,8 +774,8 @@ serves you this week.
 	<<if $slaves[$i].father == -1 && $slaves[$i].mother != -1>>
 		Keeping your own daughter as a personal fucktoy leaves quite a public impression.
 	<<elseif $slaves[$i].father > 0 && $slaves[$i].mother != $slaves[$i].father>>
-		<<set _spy = $slaves.findIndex(function(s) { return s.ID == $slaves[$i].father && (s.assignment == "please you" || s.assignment == "serve in the master suite" || s.assignment == "be your Concubine"); })>>
-		<<if _spy != -1>>
+		<<set _spy = $slaveIndices[$slaves[$i].father]>>
+		<<if def _spy && ($slaves[_spy].assignment == "please you" || $slaves[_spy].assignment == "serve in the master suite" || $slaves[_spy].assignment == "be your Concubine")>>
 			Since you are also keeping $possessive father as a sexual servant, you often use them together, which leaves quite a public impression.
 		<</if>>
 	<</if>>
@@ -783,8 +783,8 @@ serves you this week.
 	<<if $slaves[$i].mother == -1>>
 		Keeping your own daughter as a sexual servant leaves quite a public impression.
 	<<elseif $slaves[$i].mother > 0>>
-		<<set _spy = $slaves.findIndex(function(s) { return s.ID == $slaves[$i].mother && (s.assignment == "please you" || s.assignment == "serve in the master suite" || s.assignment == "be your Concubine"); })>>
-		<<if _spy != -1>>
+		<<set _spy = $slaveIndices[$slaves[$i].mother]>>
+		<<if def _spy && ($slaves[_spy].assignment == "please you" || $slaves[_spy].assignment == "serve in the master suite" || $slaves[_spy].assignment == "be your Concubine")>>
 			Since you are also keeping $possessive mother as a sexual servant, you often use them together, which leaves quite a public impression.
 		<</if>>
 	<</if>>
@@ -825,8 +825,8 @@ serves you this week.
 
 <<else>>
 	<<if ($slaves[$i].relation != 0)>>
-		<<set _spy = $slaves.findIndex(function(s) { return s.ID == $slaves[$i].relationTarget && (s.assignment == "please you" || s.assignment == "serve in the master suite" || s.assignment == "be your Concubine"); })>>
-		<<if _spy != -1>>
+		<<set _spy = $slaveIndices[$slaves[$i].relationTarget]>>
+		<<if def _spy && ($slaves[_spy].assignment == "please you" || $slaves[_spy].assignment == "serve in the master suite" || $slaves[_spy].assignment == "be your Concubine")>>
 			Since you are also keeping $possessive $slaves[_spy].relation as a sexual servant, you often use them together, which leaves quite a public impression.
 		<</if>>
 	<</if>>
diff --git a/src/uncategorized/saRecruitGirls.tw b/src/uncategorized/saRecruitGirls.tw
index b7880d41a24f4f0c5a7293ba41c05049f8920aac..3ad269544d2be615d4f8d27bd4144442e8aa626a 100644
--- a/src/uncategorized/saRecruitGirls.tw
+++ b/src/uncategorized/saRecruitGirls.tw
@@ -627,7 +627,7 @@
 			<</if>>
 		<<else>>
 			<<if $slaves[$i].relation != 0>>
-				<<set _recruiterRelation = $slaves.find(function(s) { return $slaves[$i].relationTarget == s.ID; })>>
+				<<set _recruiterRelation = getSlave($slaves[$i].relationTarget)>>
 				/* availability */
 				<<if isSlaveAvailable(_recruiterRelation)>>
 					/* willingness; protip: relationSHIP optional */
diff --git a/src/uncategorized/saRules.tw b/src/uncategorized/saRules.tw
index 1e130137a83959aab25b5b7fa6c4a42742d233c3..6d641ca755bc47fb38f7fb1709592e87afd57ea3 100644
--- a/src/uncategorized/saRules.tw
+++ b/src/uncategorized/saRules.tw
@@ -1080,7 +1080,7 @@
 			<</if>>
 		<<case "get treatment in the clinic">>
 			<<if $slaves[$i].relationship > 2>>
-				<<set _lover = $slaves.findIndex(function(s) { return s.ID == $slaves[$i].relationshipTarget; })>>
+				<<set _lover = $slaveIndices[$slaves[$i].relationshipTarget]>>
 				<<if !canWalk($slaves[_lover]) || !isSlaveAvailable($slaves[_lover])>>
 					<<set _lover = 0>>
 				<</if>>
diff --git a/src/uncategorized/saServeThePublic.tw b/src/uncategorized/saServeThePublic.tw
index f7a25f363792709ee80df01086d39266a1869781..4ced1e821ad1fb1bf81d8064f5625e1c065d5986 100644
--- a/src/uncategorized/saServeThePublic.tw
+++ b/src/uncategorized/saServeThePublic.tw
@@ -494,25 +494,20 @@ Her appearance attracted $beauty members of the public (<<print Math.trunc($beau
 	<</if>>
 <<else>>
 	<<if $slaves[$i].relation != 0>>
-		<<for $j = 0; $j < $slaves.length; $j++>>
-		<<if $slaves[$j].ID == $slaves[$i].relationTarget>>
-			<<if $slaves[$j].assignment == $slaves[$i].assignment>>
+		<<set $j = $slaveIndices[$slaves[$i].relationTarget]>>
+		<<if $slaves[$j].assignment == $slaves[$i].assignment>>
 			Since her $slaves[$j].relation $slaves[$j].slaveName is a public slut too, she earns extra attention.
 			<<if $arcologies[0].FSEgyptianRevivalist > 20>>
 				Citizens are very excited about being able to participate in incestuous sex like the ancient Egyptians.
 			<<elseif $arcologies[0].FSEgyptianRevivalistIncestPolicy == 1>>
 				Citizens are very excited about being able to participate in incestuous sex.
 			<</if>>
-			<</if>>
-			<<break>>
 		<</if>>
-		<</for>>
 	<</if>>
 <</if>>
 <<if $slaves[$i].relationship > 0>>
-	<<for $j = 0; $j < $slaves.length; $j++>>
-	<<if $slaves[$j].ID == $slaves[$i].relationshipTarget>>
-		<<if $slaves[$j].assignment == $slaves[$i].assignment>>
+	<<set $j = $slaveIndices[$slaves[$i].relationshipTarget]>>	
+	<<if $slaves[$j].assignment == $slaves[$i].assignment>>
 		Her
 		<<if $slaves[$j].relationship <= 1>>
 			friend
@@ -526,22 +521,15 @@ Her appearance attracted $beauty members of the public (<<print Math.trunc($beau
 			slave wife
 			<</if>>
 		$slaves[$j].slaveName is also serving the public and they work well together.
-		<</if>>
-		<<break>>
 	<</if>>
-	<</for>>
 <<elseif $slaves[$i].relationship == -1>>
 	She relies on citizens' desire to fuck her for emotional support, making her an excellent, if occasionally disturbing, slut.
 <</if>>
 <<if $slaves[$i].rivalry != 0>>
-	<<for $j = 0; $j < $slaves.length; $j++>>
-	<<if $slaves[$j].ID == $slaves[$i].rivalryTarget>>
-		<<if $slaves[$j].assignment == $slaves[$i].assignment>>
+	<<set $j = $slaveIndices[$slaves[$i].rivalryTarget]>>	
+	<<if $slaves[$j].assignment == $slaves[$i].assignment>>
 		She's a little less effective due to her mutual dislike with $slaves[$j].slaveName.
-		<</if>>
-		<<break>>
 	<</if>>
-	<</for>>
 <</if>>
 
 <<if $slaves[$i].minorInjury != 0>>
diff --git a/src/uncategorized/saServeYourOtherSlaves.tw b/src/uncategorized/saServeYourOtherSlaves.tw
index d0b392f0947f5ac03965df529b6d3c37306d2f90..88ce144bbd2f88360087abcba209536d48f39806 100644
--- a/src/uncategorized/saServeYourOtherSlaves.tw
+++ b/src/uncategorized/saServeYourOtherSlaves.tw
@@ -2,9 +2,9 @@
 
 <<set _oralUse = 0, _analUse = 0, _vaginalUse = 0, _mammaryUse = 0, _penetrativeUse = 0>>
 
-<<set _dom = $slaves.findIndex(function(s) { return s.ID == $slaves[$i].subTarget; })>>
+<<set _dom = $slaveIndices[$slaves[$i].subTarget]>>
 
-<<if _dom == -1>>
+<<if ndef _dom>>
 
 <<if $slaves[$i].devotion <= 20>>
 	<<if $slaves[$i].trust >= -20>>
diff --git a/src/uncategorized/saWhore.tw b/src/uncategorized/saWhore.tw
index 8c347b4585bee20a80d7fb0c9d8133b6d44cc6c4..6367bd7233ca1237c7929155fbb0a736ddd031eb 100644
--- a/src/uncategorized/saWhore.tw
+++ b/src/uncategorized/saWhore.tw
@@ -496,54 +496,42 @@ Her appearance attracted $beauty customers (<<print Math.trunc($beauty/7)>> a da
 	<</if>>
 <<else>>
 	<<if $slaves[$i].relation != 0>>
-		<<for $j = 0; $j < $slaves.length; $j++>>
-			<<if $slaves[$j].ID == $slaves[$i].relationTarget>>
-				<<if $slaves[$j].assignment == $slaves[$i].assignment>>
-					Since her $slaves[$j].relation $slaves[$j].slaveName is selling herself too, she earns extra ¤ by working with her.
-					<<if $arcologies[0].FSEgyptianRevivalist > 20>>
-						Customers are very enthusiastic about being able to participate in incestuous sex like the ancient Egyptians.
-					<<elseif $arcologies[0].FSEgyptianRevivalistIncestPolicy == 1>>
-						Customers are very enthusiastic about being able to participate in incestuous sex.
-					<</if>>
-				<</if>>
-				<<break>>
+		<<set $j = $slaveIndices[$slaves[$i].relationTarget]>>
+		<<if $slaves[$j].assignment == $slaves[$i].assignment>>
+			Since her $slaves[$j].relation $slaves[$j].slaveName is selling herself too, she earns extra ¤ by working with her.
+			<<if $arcologies[0].FSEgyptianRevivalist > 20>>
+				Customers are very enthusiastic about being able to participate in incestuous sex like the ancient Egyptians.
+			<<elseif $arcologies[0].FSEgyptianRevivalistIncestPolicy == 1>>
+				Customers are very enthusiastic about being able to participate in incestuous sex.
 			<</if>>
-		<</for>>
+		<</if>>
 	<</if>>
 <</if>> /*closes extended family mode */
 <<if $slaves[$i].relationship > 0>>
-	<<for $j = 0; $j < $slaves.length; $j++>>
-		<<if $slaves[$j].ID == $slaves[$i].relationshipTarget>>
-			<<if $slaves[$j].assignment == $slaves[$i].assignment>>
-				Her
-				<<if $slaves[$j].relationship <= 1>>
-					friend
-				<<elseif $slaves[$j].relationship <= 2>>
-					best friend
-				<<elseif $slaves[$j].relationship <= 3>>
-					friend with benefits
-				<<elseif $slaves[$j].relationship <= 4>>
-					lover
-				<<elseif $slaves[$j].relationship > 4>>
-					slave wife
-				<</if>>
-				$slaves[$j].slaveName is also whoring, so she earns a bit more.
-			<</if>>
-			<<break>>
+	<<set $j = $slaveIndices[$slaves[$i].relationshipTarget]>>
+	<<if $slaves[$j].assignment == $slaves[$i].assignment>>
+		Her
+		<<if $slaves[$j].relationship <= 1>>
+			friend
+		<<elseif $slaves[$j].relationship <= 2>>
+			best friend
+		<<elseif $slaves[$j].relationship <= 3>>
+			friend with benefits
+		<<elseif $slaves[$j].relationship <= 4>>
+			lover
+		<<elseif $slaves[$j].relationship > 4>>
+			slave wife
 		<</if>>
-	<</for>>
+		$slaves[$j].slaveName is also whoring, so she earns a bit more.
+	<</if>>
 <<elseif $slaves[$i].relationship == -1>>
 	She relies on customers' desire to fuck her for emotional support, making her an excellent, if occasionally disturbing, whore.
 <</if>>
 <<if $slaves[$i].rivalry != 0>>
-	<<for $j = 0; $j < $slaves.length; $j++>>
-		<<if $slaves[$j].ID == $slaves[$i].rivalryTarget>>
-			<<if $slaves[$j].assignment == $slaves[$i].assignment>>
-				She earns a little less ¤ due to bickering with $slaves[$j].slaveName.
-			<</if>>
-			<<break>>
-		<</if>>
-	<</for>>
+	<<set $j = $slaveIndices[$slaves[$i].rivalryTarget]>>
+	<<if $slaves[$j].assignment == $slaves[$i].assignment>>
+		She earns a little less ¤ due to bickering with $slaves[$j].slaveName.
+	<</if>>
 <</if>>
 
 <<if canTalk($slaves[$i])>>
diff --git a/src/uncategorized/scheduledEvent.tw b/src/uncategorized/scheduledEvent.tw
index 07e6ef1bbf9932ae40ce43e8946695b22670c6e8..ca3c718d7919f38aa0f1da82c6f419bcfb55e31e 100644
--- a/src/uncategorized/scheduledEvent.tw
+++ b/src/uncategorized/scheduledEvent.tw
@@ -3,7 +3,7 @@
 <<set $showEncyclopedia = 0>>
 
 <<if $expired == 1>>
-	<<set $activeSlave = $slaves.find(function(s) { return s.ID == $expiree.ID; }), $expiree = 0>>
+	<<set $activeSlave = getSlave($expiree.ID), $expiree = 0>>
 	<<include "Remove activeSlave">>
 	<<for $i = 0; $i < $slaves.length; $i++>>
 	<<if $slaves[$i].indenture == 0>>
@@ -15,7 +15,7 @@
 <<set $expired = 0>>
 
 <<if $retired == 1>>
-	<<set $activeSlave = $slaves.find(function(s) { return s.ID == $retiree.ID; }), $retiree = 0>>
+	<<set $activeSlave = getSlave($retiree.ID), $retiree = 0>>
 	<<include "Remove activeSlave">>
 	<<for $i = 0; $i < $slaves.length; $i++>>
 	<<if $slaves[$i].indenture < 0>>