diff --git a/devTools/FC.d.ts b/devTools/FC.d.ts
index d51a3cd533dd8b4c8341f8dd7b9147e65839013a..bbaee44babb1af4a845284118b9112eaf7a0a492 100644
--- a/devTools/FC.d.ts
+++ b/devTools/FC.d.ts
@@ -40,6 +40,30 @@ declare namespace App {
 				}
 			}
 		}
+
+		class JobDesc {
+			position: string;
+			assignment: string;
+			publicSexUse: boolean = false;
+			fuckdollAccepted: boolean = false;
+			broodmotherAccepted?: boolean;
+			/** workers can take part time jobs in addition to their main (full-time) one */
+			partTime?:boolean = false;
+		}
+
+		class ManagerJobDesc extends JobDesc {
+			shouldWalk: boolean = true;
+			shouldHold: boolean = true;
+			shouldSee: boolean = true;
+			shouldHear: boolean = true;
+			shouldTalk: boolean = true;
+			shouldThink: boolean = true;
+			requiredDevotion:number = 50;
+			/** Applicable careers */
+			careers:string[] = [];
+			/** Applicable skill name */
+			skill:string = null;
+		}
 	}
 
 	namespace Debug {}
@@ -252,6 +276,9 @@ declare namespace App {
 	namespace UI {
 		namespace DOM {
 			namespace Widgets { }
+
+			function makeElement<K extends keyof HTMLElementTagNameMap>(tag: K, content: string | Node, classNames: string | string[]): HTMLElementTagNameMap[K];
+			function appendNewElement<K extends keyof HTMLElementTagNameMap>(tag: K, parent: ParentNode, content?: string | Node, classNames?: string | string[]): HTMLElementTagNameMap[K];
 		}
 		namespace View { }
 		namespace SlaveSummary {
@@ -532,7 +559,11 @@ declare namespace FC {
 		hackingReputation: number;
 	}
 
-	type SlaveStateOrZero = SlaveState | 0;
+	enum NoObject {
+		Value = 0
+	};
+
+	type SlaveStateOrZero = SlaveState | NoObject;
 
 	type DefaultGameStateVariables = typeof App.Data.defaultGameStateVariables;
 	type ResetOnNGPVariables = typeof App.Data.resetOnNGPlus;
diff --git a/js/002-config/fc-js-init.js b/js/002-config/fc-js-init.js
index 46f365198dcfdfa0882712bc48cbcdf7d423aaa6..cf1138f24622a69085d7d703629036d1fd330c35 100644
--- a/js/002-config/fc-js-init.js
+++ b/js/002-config/fc-js-init.js
@@ -23,6 +23,7 @@ App.Debug = {};
 App.Desc = {};
 App.Encyclopedia = {};
 App.Encyclopedia.Entries = {};
+App.EndWeek = {};
 App.Entity = {};
 App.Entity.Utils = {};
 App.Events = {};
@@ -61,8 +62,3 @@ App.UI.SlaveInteract = {};
 App.UI.View = {};
 App.Update = {};
 App.Utils = {};
-
-Object.defineProperty(App, "activeSlave", {
-	get: () => State.variables.activeSlave,
-	set: (slave) => { State.variables.activeSlave = slave; }
-});
diff --git a/js/003-data/constants.js b/js/003-data/constants.js
new file mode 100644
index 0000000000000000000000000000000000000000..15b8cbfd7aa82bd7c7dee5260ef15a6530bc7e88
--- /dev/null
+++ b/js/003-data/constants.js
@@ -0,0 +1,65 @@
+globalThis.LivingRule = Object.freeze({LUXURIOUS: 'luxurious', NORMAL: 'normal', SPARE: 'spare'});
+globalThis.Job = Object.freeze({
+	// Penthouse Assignments
+	REST: 'rest',
+	FUCKTOY: 'please you',
+	CLASSES: 'take classes',
+	HOUSE: 'be a servant',
+	WHORE: 'whore',
+	PUBLIC: 'serve the public',
+	SUBORDINATE: 'be a subordinate slave',
+	MILKED: 'get milked',
+	GLORYHOLE: 'work a glory hole',
+	CONFINEMENT: 'stay confined',
+	// Leadership Assignments
+	BODYGUARD: 'guard you',
+	HEADGIRL: 'be your Head Girl',
+	RECRUITER: 'recruit girls',
+	AGENT: 'be your agent',
+	AGENTPARTNER: 'live with your agent',
+	// Facility Assignments
+	ARCADE: 'be confined in the arcade',
+	MADAM: 'be the Madam',
+	BROTHEL: 'work in the brothel',
+	WARDEN: 'be the Wardeness',
+	CELLBLOCK: 'be confined in the cellblock',
+	DJ: 'be the DJ',
+	CLUB: 'serve in the club',
+	NURSE: 'be the Nurse',
+	CLINIC: 'get treatment in the clinic',
+	MILKMAID: 'be the Milkmaid',
+	DAIRY: 'work in the dairy',
+	FARMER: 'be the Farmer',
+	FARMYARD: 'work as a farmhand',
+	HEADGIRLSUITE: 'live with your Head Girl',
+	CONCUBINE: 'be your Concubine',
+	MASTERSUITE: 'serve in the master suite',
+	MATRON: 'be the Matron',
+	NURSERY: 'work as a nanny',
+	TEACHER: 'be the Schoolteacher',
+	SCHOOL: 'learn in the schoolroom',
+	STEWARD: 'be the Stewardess',
+	QUARTER: 'work as a servant',
+	ATTENDANT: 'be the Attendant',
+	SPA: 'rest in the spa',
+	// Does this one exist?
+	BABY_FACTORY: 'labor in the production line',
+	// Other
+	CHOICE: 'choose her own job',
+	// Pseudo-jobs
+	LURCHER: '@Lurcher',
+	PIT: '@Pit',
+	IMPORTED: '@be imported',
+	TANK: '@lay in tank'
+});
+
+globalThis.PersonalAttention = Object.freeze({
+	TRADE: 'trading',
+	WAR: 'warfare',
+	SLAVING: 'slaving',
+	ENGINEERING: 'engineering',
+	MEDICINE: 'medicine',
+	MAID: 'upkeep',
+	HACKING: 'hacking',
+	SUPPORTHG: 'HG'
+});
diff --git a/js/003-data/gameVariableData.js b/js/003-data/gameVariableData.js
index c48fd73fcf03afa07776f075d359876360d0e56e..e34ca4371b2945d124876d9a2de98fdb4bf94a51 100644
--- a/js/003-data/gameVariableData.js
+++ b/js/003-data/gameVariableData.js
@@ -157,6 +157,7 @@ App.Data.defaultGameStateVariables = {
 	sortSlavesOrder: "descending",
 	summaryStats: 0,
 	surnameOrder: 0,
+	/** @type {Object.<string, string>} */
 	tabChoice: {Main: "all"},
 	universalRulesAssignsSelfFacility: 0,
 	universalRulesBirthing: 0,
@@ -328,32 +329,6 @@ App.Data.resetOnNGPlus = {
 	assignmentRecords: {},
 	marrying: [], // array of slave being married this week
 	organs: [],
-	/** @type {number[]} */
-	ArcadeiIDs: [],
-	/** @type {number[]} */
-	BrothiIDs: [],
-	/** @type {number[]} */
-	CellBiIDs: [],
-	/** @type {number[]} */
-	CliniciIDs: [],
-	/** @type {number[]} */
-	ClubiIDs: [],
-	/** @type {number[]} */
-	DairyiIDs: [],
-	/** @type {number[]} */
-	FarmyardiIDs: [],
-	/** @type {number[]} */
-	HGSuiteiIDs: [],
-	/** @type {number[]} */
-	MastSiIDs: [],
-	/** @type {number[]} */
-	SchlRiIDs: [],
-	/** @type {number[]} */
-	ServQiIDs: [],
-	/** @type {number[]} */
-	SpaiIDs: [],
-	/** @type {number[]} */
-	NurseryiIDs: [],
 	corp: App.Data.CorpInitData,
 	dividendTimer: 0,
 	personalShares: 0,
@@ -670,8 +645,8 @@ App.Data.resetOnNGPlus = {
 	upgradeMultiplierMedicine: 0,
 	upgradeMultiplierTrade: 0,
 	nationalities: {},
-	/** @type {Object.<string, number[]>} */
-	JobIDArray: {},
+	/** @type {Object.<string, Set<number>>} */
+	JobIDMap: {},
 	averageTrust: 0,
 	averageDevotion: 0,
 	enduringTrust: 0,
@@ -963,6 +938,9 @@ App.Data.resetOnNGPlus = {
 	whoreBudget: {
 		lowerClass: 7, middleClass: 40, upperClass: 200, topClass: 1500
 	},
+	sexDemandResult: {
+		lowerClass: 0, middleClass: 0, upperClass: 0, topClass: 0
+	},
 	arcadePrice: 2,
 	clubSlaveSexAmount: 0,
 
@@ -1100,6 +1078,7 @@ App.Data.resetOnNGPlus = {
 	week: 1,
 
 	weddingPlanned: 0,
+	/** @type {string|Array<{ID:number, trainingRegimen:string}>} */
 	personalAttention: "sex",
 	/** @type {FC.SlaveStateOrZero}  */
 	HeadGirl: 0,
diff --git a/js/003-data/miscData.js b/js/003-data/miscData.js
index e3740bebef322bfab476200717537e06ab9786e7..ae4d4a74c44123d709b3fe9434af2ef0929ab070 100644
--- a/js/003-data/miscData.js
+++ b/js/003-data/miscData.js
@@ -1524,7 +1524,7 @@ App.Data.misc = {
 		"": {"mixed race": 1, "white": 9} /* default mix */
 	},
 
-	servantMilkersJobs: ["be a servant", "be a subordinate slave", "please you", "recruit girls", "rest", "stay confined", "take classes", "work as a servant"],
+	servantMilkersJobs: [Job.HOUSE, Job.SUBORDINATE, Job.FUCKTOY, Job.RECRUITER, Job.REST, Job.CONFINEMENT, Job.CLASSES, Job.QUARTER],
 
 	pettyCriminalPool: ["armed robbery", "arson", "assault", "battery", "blackmail", "burglary", "cat burglar", "child abuse", "child molestation", "domestic abuse", "illegal immigrant", "manslaughter", "mule", "murder", "petty theft", "pickpocketing", "rape", "robbery", "tax evasion", "theft"],
 
@@ -2567,9 +2567,12 @@ App.Data.misc = {
 		},
 	],
 
-	facilityCareers: ["be confined in the arcade", "be confined in the cellblock", "be the Attendant", "be the DJ", "be the Farmer", "be the Madam", "be the Matron", "be the Milkmaid", "be the Nurse", "be the Schoolteacher", "be the Stewardess", "be the Wardeness", "be your Concubine", "get treatment in the clinic", "learn in the schoolroom", "live with your Head Girl", "rest in the spa", "serve in the club", "serve in the master suite", "work as a farmhand", "work as a nanny", "work as a servant", "work in the brothel", "work in the dairy"],
+	facilityCareers: [Job.ARCADE, Job.CELLBLOCK, Job.ATTENDANT, Job.DJ, Job.FARMER, Job.MADAM, Job.MATRON, Job.MILKMAID, Job.NURSE, Job.TEACHER, Job.STEWARD, Job.WARDEN, Job.CONCUBINE, Job.CLINIC, Job.SCHOOL, Job.HEADGIRLSUITE, Job.SPA, Job.CLUB, Job.MASTERSUITE, Job.FARMYARD, Job.NURSERY, Job.QUARTER, Job.BROTHEL, Job.DAIRY],
 
-	facilityHeads: ["be the Attendant", "be the DJ", "be the Farmer", "be the Madam", "be the Matron", "be the Milkmaid", "be the Nurse", "be the Schoolteacher", "be the Stewardess", "be the Wardeness", "be your Concubine"],
+	facilityHeads: [Job.ATTENDANT, Job.DJ, Job.FARMER, Job.MADAM, Job.MATRON, Job.MILKMAID, Job.NURSE, Job.TEACHER, Job.STEWARD, Job.WARDEN, Job.CONCUBINE],
+
+	healthRecoveringAssignments: [Job.REST, Job.CLINIC],
+	whoringAssignments: [Job.WHORE, Job.BROTHEL, Job.PUBLIC, Job.CLUB],
 
 	secExCombatPrestige: ["$He is well known for being a great commander.", "$He is famous for being an incredible commander.", "$He is known as a legendary commander all over the world."],
 
diff --git a/js/utils.js b/js/utils.js
index 0f2594c5b465de848d6467e92182059ce22bb10a..5d07c92d81f95f54b76fe5c56c5e40156eaccc71 100644
--- a/js/utils.js
+++ b/js/utils.js
@@ -94,7 +94,7 @@ function hashPush(object, ...rest) {
 }
 
 /**
- * @param {[]} array
+ * @param {any[]} array
  * @returns {{}}
  */
 function weightedArray2HashMap(array) {
diff --git a/src/002-config/Serializable.js b/src/002-config/Serializable.js
index 8bad01a68b2146f4c16853f58da166558a2103cf..16ce68b8cb970d595693990ed0ebbb1a59818814 100644
--- a/src/002-config/Serializable.js
+++ b/src/002-config/Serializable.js
@@ -3,8 +3,6 @@
  *
  * All subclasses HAVE to implement get className(), _cleanUpConfigScheme() and clone(),
  * in the SAME WAY they are implemented here.
- *
- * @type {App.Entity.Serializable}
  */
 App.Entity.Serializable = class {
 	/**
diff --git a/src/002-config/fc-version.js b/src/002-config/fc-version.js
index 29e758ebb74fc57968a4e1450ef65dd189769808..1293db3e986a6e5023ee66f8f1ecccae094b444b 100644
--- a/src/002-config/fc-version.js
+++ b/src/002-config/fc-version.js
@@ -1,7 +1,7 @@
 App.Version = {
 	base: "0.10.7.1", // The vanilla version the mod is based off of, this should never be changed.
 	pmod: "3.5.0",
-	release: 1070,
+	release: 1071,
 };
 
 /* Use release as save version */
diff --git a/src/004-base/proxies.js b/src/004-base/000-proxies.js
similarity index 100%
rename from src/004-base/proxies.js
rename to src/004-base/000-proxies.js
diff --git a/src/004-base/facility.js b/src/004-base/facility.js
index 164512d72f6428e295216beb99071e409f97174e..29347048819cdc9cd9265a9c01e243ad670d25de 100644
--- a/src/004-base/facility.js
+++ b/src/004-base/facility.js
@@ -1,45 +1,10 @@
-
-App.Data.JobDesc = class {
-	constructor() {
-		this.position = "";
-		this.assignment = "";
-		this.publicSexUse = false;
-		this.fuckdollAccepted = false;
-		/** @type {boolean|undefined} */
-		this.broodmotherAccepted = false;
-		/** workers can take part time jobs in addition to their main (full-time) one */
-		this.partTime = false;
-	}
-};
-
-App.Data.ManagerJobDesc = class extends App.Data.JobDesc {
-	constructor() {
-		super();
-		this.shouldWalk = true;
-		this.shouldHold = true;
-		this.shouldSee = true;
-		this.shouldHear = true;
-		this.shouldTalk = true;
-		this.shouldThink = true;
-		this.requiredDevotion = 50;
-		/**
-		 * Applicable careers
-		 * @type {string[]} */
-		this.careers = [];
-		/**
-		 * Applicable skill name
-		 * @type {string} */
-		this.skill = null;
-	}
-};
-
 App.Data.FacilityDesc = class {
 	constructor() {
 		/** Base name for state variables */
 		this.baseName = "";
 		/** Generic name for UI (Brothel, Club, etc.)
 		 * If null, baseName is used instead
-		*/
+		 */
 		this.genericName = "";
 		/** @type {Object.<string, App.Data.JobDesc>} */
 		this.jobs = {};
@@ -68,7 +33,7 @@ App.Entity.Facilities.Job = class {
 	checkRequirements(slave) {
 		let r = [];
 		if (this.desc.publicSexUse &&
-			(slave.breedingMark === 1 && State.variables.propOutcome === 1 && State.variables.eugenicsFullControl !== 1 && State.variables.arcologies[0].FSRestart !== "unset")) {
+			(slave.breedingMark === 1 && V.propOutcome === 1 && V.eugenicsFullControl !== 1 && V.arcologies[0].FSRestart !== "unset")) {
 			r.push(`${slave.slaveName} is for private use only.`);
 		}
 		if (!this.desc.fuckdollAccepted && slave.fuckdoll > 0) {
@@ -99,13 +64,22 @@ App.Entity.Facilities.Job = class {
 		return this.checkRequirements(slave);
 	}
 
+	/**
+	 * Is slave with the given ID already assigned to this job
+	 * @param {number} id
+	 * @returns {boolean}
+	 */
+	hasEmployeeWithId(id) {
+		return this.employeesIDs().has(id);
+	}
+
 	/**
 	 * Is slave already assigned to this job
 	 * @param {App.Entity.SlaveState} slave
 	 * @returns {boolean}
 	 */
 	isEmployed(slave) {
-		return slave.assignment === this.desc.assignment;
+		return this.hasEmployeeWithId(slave.ID);
 	}
 
 	/**
@@ -153,24 +127,15 @@ App.Entity.Facilities.Job = class {
 	 * @returns {App.Entity.SlaveState[]}
 	 */
 	employees() {
-		return State.variables.slaves.filter( s => s.assignment === this.desc.assignment);
-	}
-
-	/**
-	 * Indices in the slaves array for all slaves that are employed at this job
-	 * @returns {number[]}
-	 */
-	employeesIndices() {
-		return State.variables.slaves.reduce(
-			(acc, cur, idx) => { if (cur.assignment === this.desc.assignment) { acc.push(idx); } return acc; }, []);
+		return [...this.employeesIDs()].map(id => slaveStateById(id));
 	}
 
 	/**
 	 * IDs for all slaves that are employed at this job
-	 * @returns {number[]}
+	 * @returns {Set<number>}
 	 */
-	employeesIds() {
-		return this.employees().map(s => s.ID);
+	employeesIDs() {
+		return V.JobIDMap[this.desc.assignment];
 	}
 
 	/**
@@ -203,7 +168,7 @@ App.Entity.Facilities.Job = class {
 		return `${slave.slaveName} must be either more fearful of you or devoted to you.`;
 	}
 
-	/** @private */
+	/** @protected */
 	get _facilityHasFreeSpace() {
 		return this.facility.hasFreeSpace;
 	}
@@ -252,21 +217,17 @@ App.Entity.Facilities.ManagingJob = class extends App.Entity.Facilities.Job {
 	 * @returns {boolean}
 	 */
 	slaveHasExperience(slave) {
-		return (this.desc.skill !== null && slave.skill[this.desc.skill] >= State.variables.masteredXP) ||
+		return (this.desc.skill !== null && slave.skill[this.desc.skill] >= V.masteredXP) ||
 			(typeof slave.career === 'string' && this.desc.careers.includes(slave.career));
 	}
 
 	/** @returns {App.Entity.SlaveState} */
 	get currentEmployee() {
-		let obj = slaveStateById(V[`${capFirstChar(this.desc.position)}ID`]);
-		// TODO Remove when all facility head migrate to IDs
-		if (!obj) {
-			obj = V[capFirstChar(this.desc.position)];
-		}
-		return obj === undefined || obj === 0 ? null : obj;
+		const employees = this.employees();
+		return employees.length > 0 ? employees[0] : null;
 	}
 
-	/** @private */
+	/** @protected */
 	get _facilityHasFreeSpace() {
 		return true;
 	}
@@ -309,10 +270,20 @@ App.Entity.Facilities.Facility = class {
 	/** Facility display name
 	 * @returns {string} */
 	get name() {
-		const res = State.variables[this.desc.baseName + "Name"];
+		const res = V[this.desc.baseName + "Name"];
 		return res !== undefined ? res : 'the ' + this.genericName;
 	}
 
+	get nameCaps() {
+		const res = V[this.desc.baseName + "NameCaps"];
+		return res ? res : this.name.replace("the ", "The ");
+	}
+
+	get UIName() {
+		const nameCaps = this.nameCaps;
+		return nameCaps === "The " + this.genericName ? this.genericName : nameCaps;
+	}
+
 	/** Facility generic name ("Brothel", "Schoolroom", etc.)
 	 * @returns {string} */
 	get genericName() {
@@ -335,6 +306,10 @@ App.Entity.Facilities.Facility = class {
 		return this._jobs[name || this.desc.defaultJob];
 	}
 
+	get jobs() {
+		return Object.values(this._jobs);
+	}
+
 	get manager() {
 		return this._manager;
 	}
@@ -342,7 +317,7 @@ App.Entity.Facilities.Facility = class {
 	/** Facility slave capacity
 	 * @returns {number} */
 	get capacity() {
-		return State.variables[this.desc.baseName];
+		return V[this.desc.baseName];
 	}
 
 	get established() {
@@ -352,12 +327,40 @@ App.Entity.Facilities.Facility = class {
 	/** Number of already hosted slaves
 	 * @returns {number} */
 	get hostedSlaves() {
-		const job = this.job();
-		return job ? job.employeesIds().length : 0;
+		return this.jobs.reduce((acc, job) => { return acc + job.employeesIDs().size; }, 0);
+	}
+
+	/**
+	 * Count of employees plus manager altogether
+	 * @returns {number}
+	 */
+	get totalEmployeesCount() {
+		return this.hostedSlaves + (this.manager.currentEmployee ? 1 : 0);
+	}
+
+	/**
+	 * @returns {number} count of non slave occupants (e.g. bioreactors in the dairy)
+	 */
+	get nonEmployeeOccupantsCount() {
+		return 0;
+	}
+
+	/**
+	 * @returns {number} total count of facility places taken by employees and other beings (e.g. bioreactors in the dairy)
+	 */
+	get totalOccupants() {
+		return this.hostedSlaves + this.nonEmployeeOccupantsCount;
+	}
+	get hasEmployees() {
+		return this.jobs.some(j => j.employeesIDs().size > 0);
 	}
 
 	get hasFreeSpace() {
-		return this.capacity > this.hostedSlaves;
+		return this.capacity > this.totalOccupants;
+	}
+
+	get freeSpace() {
+		return this.capacity > 0 ? this.capacity - this.totalOccupants : 0;
 	}
 
 	/**
@@ -365,7 +368,7 @@ App.Entity.Facilities.Facility = class {
 	 * @returns {number}
 	 */
 	option(name) {
-		return State.variables[this.desc.baseName + name];
+		return V[this.desc.baseName + name];
 	}
 
 	/**
@@ -386,9 +389,15 @@ App.Entity.Facilities.Facility = class {
 		job = job || this.desc.defaultJob;
 		const j = this.job(job);
 		if (j === undefined) {
-			console.log(`Can't find job ${job} at ${this.name}.`); // eslint-disable-line no-console
+			if (this.jobs.length === 0) {
+				const err = `${this.genericName} facility has no jobs for slaves`;
+				console.warn(err);
+				return [err];
+			} else {
+				console.warn(`Can't find job ${job} at ${this.name}.`); // eslint-disable-line no-console
+			}
 		}
-		// if there are more than one jobs at this facility, test them too
+		// if there are more than one job at this facility, test them too
 		if (Object.keys(this.desc.jobs).length > 1 && this.isHosted(slave)) {
 			return [`${slave.slaveName} is already assigned to ${slave.assignment} at ${this.name}.`];
 		}
@@ -401,13 +410,7 @@ App.Entity.Facilities.Facility = class {
 	 * @returns {boolean}
 	 */
 	isHosted(slave) {
-		for (const j in this._jobs) {
-			if (this._jobs[j].isEmployed(slave)) {
-				return true;
-			}
-		}
-
-		return false;
+		return this.jobs.some(job => job.isEmployed(slave));
 	}
 
 	/**
@@ -493,32 +496,30 @@ App.Entity.Facilities.Facility = class {
 	 * @returns {App.Entity.SlaveState[]}
 	 */
 	employees() {
-		if (Object.keys(this._jobs).length === 1) {
-			return this.job().employees();
-		}
-		/** @type {App.Entity.Facilities.Job[]} */
-		let jobArray = [];
-		for (const jn in this._jobs) {
-			jobArray.push(this._jobs[jn]);
+		const jobArray = this.jobs;
+		if (jobArray.length === 1) {
+			return jobArray[0].employees();
 		}
-		return State.variables.slaves.filter(s => jobArray.some(j => j.isEmployed(s)));
+		return V.slaves.filter(s => jobArray.some(j => j.isEmployed(s)));
 	}
 
 	/**
-	 * Indices in the slaves array for all slaves that are employed at this job
-	 * @returns {number[]}
+	 * IDs for all slaves that are employed at this facility (excluding the manager)
+	 * @returns {Set<number>}
 	 */
-	employeesIndices() {
-		if (Object.keys(this._jobs).length === 1) {
-			return this.job().employeesIndices();
+	employeesIDs() {
+		const jobArray = Object.values(this._jobs);
+		if (jobArray.length === 1) {
+			return this.job().employeesIDs();
 		}
-		/** @type {App.Entity.Facilities.Job[]} */
-		let jobArray = [];
-		for (const jn in this._jobs) {
-			jobArray.push(this._jobs[jn]);
+		const res = new Set();
+		for (const j of jobArray) {
+			const ids = j.employeesIDs();
+			for (const id of ids) {
+				res.add(id);
+			}
 		}
-		return State.variables.slaves.reduce(
-			(acc, cur, idx) => { if (jobArray.some(j => j.isEmployed(cur))) { acc.push(idx); } }, []);
+		return res;
 	}
 
 	/**
@@ -566,32 +567,21 @@ App.Entity.Facilities.FacilitySingleJob = class extends App.Entity.Facilities.Jo
 				assignmentTransition(slave, assignment, targetPassage || passage());
 			}, linkText);
 	}
-
-	/** @returns {number[]} */
-	employeesIndices() {
-		const si = V.slaveIndices;
-		const ids = V[this._employeeIDsVariableName]; // updated by assignJob()/removeJob()
-		return ids.map(id => si[id]);
-	}
-
-	employeesIds() {
-		return State.variables[this._employeeIDsVariableName]; // updated by assignJob()/removeJob();
-	}
-
-	/** @returns {App.Entity.SlaveState[]} */
-	employees() {
-		/** @type {App.Entity.SlaveState[]} */
-		const slaves = State.variables.slaves;
-		return this.employeesIndices().map(ind => slaves[ind]);
-	}
-
-	/** @private */
-	get _employeeIDsVariableName() {
-		return this.facility.genericName + "iIDs";
-	}
 };
 
 App.Entity.Facilities.SingleJobFacility = class extends App.Entity.Facilities.Facility {
+	/**
+	 * @param {App.Data.FacilityDesc} desc defines state variable for this facility
+	 * @param {Object.<string, App.Entity.Facilities.Job>} [jobs] job object that are not default
+	 * @param {App.Entity.Facilities.ManagingJob} [manager]
+	 */
+	constructor(desc, jobs, manager) {
+		super(desc, jobs, manager);
+		if (this.jobs.length !== 1) {
+			throw `SingleJobFacility accepts only a single job, but ${this.jobs.length} were provided`;
+		}
+		this._job = this.job(); // cache the only job
+	}
 	/**
 	 * @override
 	 * @protected
@@ -600,7 +590,11 @@ App.Entity.Facilities.SingleJobFacility = class extends App.Entity.Facilities.Fa
 	_createJob() {
 		return new App.Entity.Facilities.FacilitySingleJob();
 	}
+
+	get facilityJob() {
+		return this._job;
+	}
 };
 
-/** Instances of all facility objects */
+/** Instances of all facility objects  */
 App.Entity.facilities = {};
diff --git a/src/Corporation/corporate.js b/src/Corporation/corporate.js
index 432c470483304b8b167a24c0c7db83b5154ed0bc..9c35f74a7003e7431e0457ce7ea8c97819cc0c12 100644
--- a/src/Corporation/corporate.js
+++ b/src/Corporation/corporate.js
@@ -330,7 +330,7 @@ App.Corporate.Init = function() {
 			const divisionOverhead = Object.values(this.maintenanceCategories).reduce((r, categoryLedger) => r + categoryLedger.cost, 0);
 			const corpMaintInfo = App.Corporate.maintenance.corporate;
 			let corpOverhead = Math.pow(Math.max(divCount - corpMaintInfo.freeDivisions, 0), 2) * corpMaintInfo.divisionCost;
-			let retval = (divisionOverhead + corpOverhead) * 1 - (5 - State.variables.baseDifficulty) / 8;
+			let retval = (divisionOverhead + corpOverhead) * 1 - (5 - V.baseDifficulty) / 8;
 			return Math.trunc(retval);
 		}
 		get canExpandNow() { return this._var.canExpandNow; }
diff --git a/src/Mods/SecExp/js/secExp.js b/src/Mods/SecExp/js/secExp.js
index cb791e3e7ebb4383b4058096748669727db31033..5ebfc32068c602f2667a912a6c35838aba91983f 100644
--- a/src/Mods/SecExp/js/secExp.js
+++ b/src/Mods/SecExp/js/secExp.js
@@ -3,7 +3,6 @@ globalThis.SecExpBase = function() {
 };
 
 App.SecExp.upkeep = function(input = '') {
-	const V = State.variables;
 	let value = 0;
 	if (input === 'edictsCash') {
 		const vars = ['slaveWatch', 'subsidyChurch', 'martialSchool',
@@ -422,7 +421,6 @@ App.SecExp.Check = (function() {
 
 			V.SecExp.core.trade = V.SecExp.core.trade || 0;
 			if (passage() === "Acquisition" || V.SecExp.core.trade === 0) {
-				const V = State.variables;
 				let init = jsRandom(20, 30);
 				if (V.terrain === "urban") {
 					init += jsRandom(10, 10);
@@ -728,7 +726,7 @@ App.SecExp.unit = (function() {
 	};
 
 	function description(input, unitType = '') {
-		const V = State.variables; let r = ``;
+		let r = ``;
 		if (V.SecExp.settings.unitDescriptions === 0) {
 			if (unitType !== "Bots") {
 				r += `\n<strong>${input.platoonName}</strong> `;
diff --git a/src/Mods/SpecialForce/SpecialForce.js b/src/Mods/SpecialForce/SpecialForce.js
index 0e0aac5c4e79fc0fefd56cfcbb7ce33ab22619e6..205e8ee1df8a2656e75f1a5a034982bd40889e2f 100644
--- a/src/Mods/SpecialForce/SpecialForce.js
+++ b/src/Mods/SpecialForce/SpecialForce.js
@@ -2806,7 +2806,7 @@ App.SF.progress = function(x, max) {
 		z, i;
 	if (max === undefined) {
 		Math.clamp(x, 0, 10);
-		if (State.variables.SF.Size < 30) {
+		if (V.SF.Size < 30) {
 			z = 5 - x;
 			for (i = 0; i < x; i++) {
 				out += `█⏐`;
diff --git a/src/arcologyBuilding/base.js b/src/arcologyBuilding/base.js
index 0fb3408564c523fd5aa67e1b53b66ce603ea2d19..8f1e33500bb6a3c598bf8d6eb0cf54eaed64ddc6 100644
--- a/src/arcologyBuilding/base.js
+++ b/src/arcologyBuilding/base.js
@@ -54,6 +54,25 @@ App.Arcology.defaultBuilding = function(terrain = "default") {
  */
 App.Arcology.sectionOrder = ["fountain", "penthouse", "spire", "shops", "ravine-markets", "apartments", "markets", "manufacturing"];
 
+/**
+ * @param {App.Entity.Facilities.Facility} facility
+ * @param {string} [passageName]
+ * @param {string} [statsStr]
+ * @return {Node}
+ */
+App.Arcology.facilityCellContent = function(facility, passageName, statsStr) {
+	const res = document.createDocumentFragment();
+	res.append(App.UI.DOM.passageLink(facility.UIName, passageName || facility.genericName));
+	const stats = document.createElement("span");
+	stats.style.whiteSpace = "nowrap";
+	stats.textContent = statsStr ? statsStr : ` (${facility.employeesIDs().size}/${facility.capacity})`;
+	if (facility.manager && facility.manager.currentEmployee) {
+		stats.textContent += ", L";
+	}
+	res.append(stats);
+	return res;
+};
+
 App.Arcology.Section = class extends App.Entity.Serializable {
 	/**
 	 * @param {string} id unique ID
diff --git a/src/arcologyBuilding/manufacturing.js b/src/arcologyBuilding/manufacturing.js
index 8c71a05c843f916fb572e887916d555481d8438a..2130b2e24cc081d3c6ac92f4c0e42634cdaa5bbe 100644
--- a/src/arcologyBuilding/manufacturing.js
+++ b/src/arcologyBuilding/manufacturing.js
@@ -49,22 +49,11 @@ App.Arcology.Cell.Manufacturing = class extends App.Arcology.Cell.BaseCell {
 	 */
 	cellContent(path) {
 		if (this.type === "Dairy") {
-			const fragment = document.createDocumentFragment();
-			fragment.append(App.UI.DOM.passageLink(dairyUIName(), "Dairy"),
-				` (${V.DairyiIDs.length}${V.bioreactorsXY + V.bioreactorsXX + V.bioreactorsHerm + V.bioreactorsBarren > 0 ? "+" : ""}/${V.dairy})`);
-			if (V.Milkmaid) {
-				fragment.append(",L");
-			}
-			return fragment;
+			return App.Arcology.facilityCellContent(App.Entity.facilities.dairy, null,
+				` (${App.Entity.facilities.dairy.employeesIDs().size}${V.bioreactorsXY + V.bioreactorsXX + V.bioreactorsHerm + V.bioreactorsBarren > 0 ? "+" : ""}/${App.Entity.facilities.dairy.capacity})`);
 		}
 		if (this.type === "Farmyard") {
-			const fragment = document.createDocumentFragment();
-			fragment.append(App.UI.DOM.passageLink("Farmyard", "Farmyard"),
-				` (${V.FarmyardiIDs.length}/${V.farmyard})`);
-			if (V.Farmer) {
-				fragment.append(",L");
-			}
-			return fragment;
+			return App.Arcology.facilityCellContent(App.Entity.facilities.farmyard);
 		}
 		switch (this.type) {
 			case "Manufacturing":
diff --git a/src/arcologyBuilding/markets.js b/src/arcologyBuilding/markets.js
index 6028c0618f8cf31ff89962dd2b175a9bcf1b4bbf..0210f6ff8b62d4b6cb56881d2e9158a8918b613a 100644
--- a/src/arcologyBuilding/markets.js
+++ b/src/arcologyBuilding/markets.js
@@ -42,15 +42,13 @@ App.Arcology.Cell.Market = class extends App.Arcology.Cell.BaseCell {
 	 */
 	cellContent(path) {
 		if (this.type === "Arcade") {
-			const fragment = document.createDocumentFragment();
-			fragment.append(App.UI.DOM.passageLink(arcadeUIName(), "Arcade"),
-				` (${V.ArcadeiIDs.length}/${V.arcade})`);
-			return fragment;
+			return App.Arcology.facilityCellContent(App.Entity.facilities.arcade);
 		}
 		if (this.type === "Pit") {
+			const pit = App.Entity.facilities.pit;
 			const fragment = document.createDocumentFragment();
-			fragment.append(App.UI.DOM.passageLink(pitUIName(), "Pit"),
-				`(${V.fighterIDs.length})`);
+			fragment.append(App.UI.DOM.passageLink(pit.UIName, "Pit"),
+				`(${pit.employeesIDs().size})`);
 			return fragment;
 		}
 		switch (this.type) {
diff --git a/src/arcologyBuilding/penthouse.js b/src/arcologyBuilding/penthouse.js
index 819e4b71992cb04d315855b77896f958583d0d88..945dad029aad83ee2d3f5043e0de247dfc0370b0 100644
--- a/src/arcologyBuilding/penthouse.js
+++ b/src/arcologyBuilding/penthouse.js
@@ -36,16 +36,27 @@ App.Arcology.Cell.Penthouse = class extends App.Arcology.Cell.BaseCell {
 
 		let wrapper = getWrapper(fragment);
 
-		if (V.masterSuite) {
-			wrapper.append(createFacilityDiv(App.UI.DOM.passageLink(masterSuiteUIName(), "Master Suite"),
-				`(${V.MastSiIDs.length}/${V.masterSuite}${V.Concubine ? ", C" : ""})`));
+		const fcs = App.Entity.facilities;
+
+		/**
+		 * @param {App.Entity.Facilities.Facility} facility
+		 * @param {string} [passageName]
+		 * @param {string} [leaderAbbr]
+		 */
+		function addFacility(facility, passageName, leaderAbbr = 'L') {
+			if (facility.established) {
+				wrapper.append(createFacilityDiv(App.UI.DOM.passageLink(facility.UIName, passageName || facility.genericName),
+					`(${facility.employeesIDs().size}/${facility.capacity}${facility.manager.employeesIDs().size > 0 ? `, ${leaderAbbr}` : ""})`));
+			}
 		}
 
-		if (V.HGSuite) {
-			const link = App.UI.DOM.passageLink(headGirlSuiteUIName(), "Head Girl Suite");
+		addFacility(fcs.masterSuite, fcs.masterSuite.genericName, "C");
+
+		if (fcs.headGirlSuite.established) {
+			const link = App.UI.DOM.passageLink(fcs.headGirlSuite.UIName, "Head Girl Suite");
 
 			if (V.HeadGirl !== 0) {
-				wrapper.append(createFacilityDiv(link, `(HG${V.HGSuiteiIDs.length > 0 ? ", 1" : ""})`));
+				wrapper.append(createFacilityDiv(link, `(HG${fcs.headGirlSuite.employeesIDs().size > 0 ? ", 1" : ""})`));
 			} else {
 				wrapper.append(createFacilityDiv(link));
 			}
@@ -61,39 +72,23 @@ App.Arcology.Cell.Penthouse = class extends App.Arcology.Cell.BaseCell {
 			}
 		}
 
-		if (V.servantsQuarters) {
-			wrapper.append(createFacilityDiv(App.UI.DOM.passageLink(servantQuartersUIName(), "Servants' Quarters"),
-				`(${V.ServQiIDs.length}/${V.servantsQuarters}${V.Stewardess ? ", L" : ""})`));
-		}
+		addFacility(fcs.servantsQuarters);
+		addFacility(fcs.spa);
 
-		if (V.spa) {
-			wrapper.append(createFacilityDiv(App.UI.DOM.passageLink(spaUIName(), "Spa"),
-				`(${V.SpaiIDs.length}/${V.spa}${S.Attendant ? ", L" : ""})`));
+		if (fcs.nursery.established) {
+			const n = fcs.nursery;
+			wrapper.append(createFacilityDiv(App.UI.DOM.passageLink(n.UIName, "Nursery"),
+				`(${numberWithPluralOne(n.capacity - V.nurseryBabies, "empty room")}, ${n.employeesIDs().size}/${V.nurseryNannies}${V.Matron ? ", L" : ""})`));
 		}
 
-		if (V.nursery) {
-			wrapper.append(createFacilityDiv(App.UI.DOM.passageLink(nurseryUIName(), "Nursery"),
-				`(${numberWithPluralOne(V.nursery - V.nurseryBabies, "empty room")}, ${V.NurseryiIDs.length}/${V.nurseryNannies}${V.Matron ? ", L" : ""})`));
-		}
-
-		if (V.clinic) {
-			wrapper.append(createFacilityDiv(App.UI.DOM.passageLink(clinicUIName(), "Clinic"),
-				`(${V.CliniciIDs.length}/${V.clinic}${V.Nurse ? ", L" : ""})`));
-		}
-
-		if (V.schoolroom) {
-			wrapper.append(createFacilityDiv(App.UI.DOM.passageLink(schoolRoomUIName(), "Schoolroom"),
-				`(${V.SchlRiIDs.length}/${V.schoolroom}${V.Schoolteacher ? ", L" : ""})`));
-		}
-
-		if (V.cellblock) {
-			wrapper.append(createFacilityDiv(App.UI.DOM.passageLink(cellblockUIName(), "Cellblock"),
-				`(${V.CellBiIDs.length}/${V.cellblock}${V.Wardeness ? ", L" : ""})`));
-		}
+		addFacility(fcs.clinic);
+		addFacility(fcs.schoolroom);
+		addFacility(fcs.cellblock);
 
 		if (V.incubator) {
-			const link = App.UI.DOM.passageLink(incubatorUIName(), "Incubator");
-			const desc = `(${numberWithPluralOne(V.incubator - V.tanks.length, "empty tank")})`;
+			const inc = App.Entity.facilities.incubator;
+			const link = App.UI.DOM.passageLink(inc.UIName, "Incubator");
+			const desc = `(${numberWithPluralOne(inc.capacity - V.tanks.length, "empty tank")})`;
 
 			if (V.readySlaves > 0) {
 				wrapper.append(createFacilityDiv(link, desc, App.UI.DOM.makeElement("span", "[!]", "noteworthy")));
diff --git a/src/arcologyBuilding/shops.js b/src/arcologyBuilding/shops.js
index 96d6b106b784a637a681ac02408e27022e0345b1..6ba963794dca7d41a670451e86b419a2bb6a543b 100644
--- a/src/arcologyBuilding/shops.js
+++ b/src/arcologyBuilding/shops.js
@@ -38,22 +38,9 @@ App.Arcology.Cell.Shop = class extends App.Arcology.Cell.BaseCell {
 	 */
 	cellContent(path) {
 		if (this.type === "Brothel") {
-			const fragment = document.createDocumentFragment();
-			fragment.append(
-				App.UI.DOM.passageLink(brothelUIName(), "Brothel"),
-				` (${V.BrothiIDs.length}/${V.brothel})`);
-			if (V.Madam) {
-				fragment.append(",L");
-			}
-			return fragment;
+			return App.Arcology.facilityCellContent(App.Entity.facilities.brothel);
 		} else if (this.type === "Club") {
-			const fragment = document.createDocumentFragment();
-			fragment.append(App.UI.DOM.passageLink(clubUIName(), "Club"),
-				` (${V.ClubiIDs.length}/${V.club})`);
-			if (V.DJ) {
-				fragment.append(",L");
-			}
-			return fragment;
+			return App.Arcology.facilityCellContent(App.Entity.facilities.club);
 		} else {
 			return App.Arcology.getCellLink(path, this.type);
 		}
diff --git a/src/art/artJS.js b/src/art/artJS.js
index a52575cb1d236eb928820cf29550d7eb12920231..00bc04a24dcb8ddb85b89a658c528237e607696a 100644
--- a/src/art/artJS.js
+++ b/src/art/artJS.js
@@ -37,7 +37,7 @@ globalThis.SlaveArt = function(artSlave, artSize, UIDisplay) {
  * @returns {DocumentFragment|HTMLElement}
  */
 App.Art.SlaveArtElement = function(artSlave, artSize, UIDisplay) {
-	const imageChoice = State.variables.imageChoice;
+	const imageChoice = V.imageChoice;
 	if (artSlave.custom.image !== null && artSlave.custom.image.filename !== "") {
 		return App.Art.customArtElement(artSlave, artSize);
 	} else if (imageChoice === 1) { /* VECTOR ART BY NOX/DEEPMURK */
diff --git a/src/art/vector/VectorArtJS.js b/src/art/vector/VectorArtJS.js
index 47d89e44a3cb61d4b3aa34128392f25624642a6f..174b06e769819c9f2d1114841983da7e2cf6c5c2 100644
--- a/src/art/vector/VectorArtJS.js
+++ b/src/art/vector/VectorArtJS.js
@@ -309,7 +309,7 @@ App.Art.vectorArtElement = (function() {
 		penisArt = document.createDocumentFragment();
 		if (penisSize === undefined) {
 			penisDrawtime = -1; /* no penis to draw */
-		} else if (State.variables.showClothingErection) {
+		} else if (V.showClothingErection) {
 			penisDrawtime = 0; /* default is to draw before boobs/belly */
 			switch (slave.clothes) {
 				/* BULGE OUTFITS WITH ERECTION: LONG OUTFITS */
diff --git a/src/data/backwardsCompatibility/backwardsCompatibility.js b/src/data/backwardsCompatibility/backwardsCompatibility.js
index d3e7d3c15ff8618ab22f9cbdfaaf6a1ea854a2c5..75ad567df681ed06f0a4869ed8673bb0b1ee391f 100644
--- a/src/data/backwardsCompatibility/backwardsCompatibility.js
+++ b/src/data/backwardsCompatibility/backwardsCompatibility.js
@@ -166,7 +166,7 @@ App.Update.globalVariables = function(node) {
 
 	// Jobs
 	{
-		V.JobIDArray = resetJobIDArray();
+		V.JobIDMap = makeJobIdMap();
 	}
 	// Reminders
 	{
@@ -1170,6 +1170,7 @@ App.Update.slaveVariables = function(node) {
 
 		V.slaves[bci] = Slave;
 	}
+	V.slaveIndices = slaves2indices();
 	node.append(`Done!`);
 };
 
diff --git a/src/data/backwardsCompatibility/datatypeCleanup.js b/src/data/backwardsCompatibility/datatypeCleanup.js
index c7d950bdbd1cd8ab3e7df0dee0dae4f5a5f2b1a6..c08fd9325c4e8f783d7e131888154c81c562239a 100644
--- a/src/data/backwardsCompatibility/datatypeCleanup.js
+++ b/src/data/backwardsCompatibility/datatypeCleanup.js
@@ -2011,7 +2011,6 @@ globalThis.FacilityDatatypeCleanup = (function() {
 
 	function FacilityDatatypeCleanup() {
 		/* common variables */
-		FacilityIDArrayCleanup();
 		FutureSocieties.DecorationCleanup();
 		FacilityNameCleanup();
 		/* facility specific variables */
@@ -2029,42 +2028,13 @@ globalThis.FacilityDatatypeCleanup = (function() {
 		HeadGirlSuiteDatatypeCleanup();
 		NurseryDatatypeCleanup();
 
-		V.Recruiter = V.slaves.find(s => s.assignment === "recruit girls") || 0;
-		V.Bodyguard = V.slaves.find(s => s.assignment === "guard you") || 0;
+		V.Recruiter = V.slaves.find(s => s.assignment === Job.RECRUITER) || 0;
+		V.Bodyguard = V.slaves.find(s => s.assignment === Job.BODYGUARD) || 0;
 
 		replaceSlaveStateWithId("Lurcher");
 		replaceSlaveStateWithId("Stud");
 	}
 
-	function FacilityIDArrayCleanup() {
-		function helperFunction(facilityIDArray) {
-			if (!Array.isArray(facilityIDArray)) {
-				return [];
-			} else if (typeof facilityIDArray[0] === "object") {
-				return facilityIDArray.map(a => a.ID);
-			} else {
-				const si = V.slaveIndices;
-				return facilityIDArray.filter(id => si.hasOwnProperty(id));
-			}
-		}
-
-		V.slaveIndices = slaves2indices();
-
-		V.BrothiIDs = helperFunction(V.BrothiIDs);
-		V.DairyiIDs = helperFunction(V.DairyiIDs);
-		V.ClubiIDs = helperFunction(V.ClubiIDs);
-		V.ServQiIDs = helperFunction(V.ServQiIDs);
-		V.SchlRiIDs = helperFunction(V.SchlRiIDs);
-		V.SpaiIDs = helperFunction(V.SpaiIDs);
-		V.CliniciIDs = helperFunction(V.CliniciIDs);
-		V.ArcadeiIDs = helperFunction(V.ArcadeiIDs);
-		V.CellBiIDs = helperFunction(V.CellBiIDs);
-		V.MastSiIDs = helperFunction(V.MastSiIDs);
-		V.HGSuiteiIDs = helperFunction(V.HGSuiteiIDs);
-		V.NurseryiIDs = helperFunction(V.NurseryiIDs);
-		V.FarmyardiIDs = helperFunction(V.FarmyardiIDs);
-	}
-
 	function FacilityNameCleanup() {
 		V.arcologies[0].name = V.arcologies[0].name || "Arcology X-4";
 		V.brothelName = V.brothelName || "the Brothel";
@@ -2118,7 +2088,7 @@ globalThis.FacilityDatatypeCleanup = (function() {
 		}
 		V.brothelBoost.eligible = Math.clamp(+V.brothelBoost.eligible, 0, 10) || 0;
 		/* madam */
-		V.Madam = V.slaves.find(s => s.assignment === "be the Madam") || 0;
+		V.Madam = V.slaves.find(s => s.assignment === Job.MADAM) || 0;
 		V.MadamIgnoresFlaws = Math.clamp(+V.MadamIgnoresFlaws, 0, 1) || 0;
 	}
 
@@ -2148,7 +2118,7 @@ globalThis.FacilityDatatypeCleanup = (function() {
 		V.bioreactorsXY = Math.max(+V.bioreactorsXY, 0) || 0;
 		V.bioreactorsBarren = Math.max(+V.bioreactorsBarren, 0) || 0;
 		/* milkmaid */
-		V.Milkmaid = V.slaves.find(s => s.assignment === "be the Milkmaid") || 0;
+		V.Milkmaid = V.slaves.find(s => s.assignment === Job.MILKMAID) || 0;
 		V.milkmaidImpregnates = Math.clamp(+V.milkmaidImpregnates, 0, 1) || 0;
 	}
 
@@ -2157,7 +2127,7 @@ globalThis.FacilityDatatypeCleanup = (function() {
 		V.farmyardBreeding = Math.clamp(+V.farmyardBreeding, 0, 1) || 0;
 		V.farmyardShows = Math.clamp(+V.farmyardShows, 0, 1) || 0;
 		/* farmer */
-		V.Farmer = V.slaves.find(s => s.assignment === "be the Farmer") || 0;
+		V.Farmer = V.slaves.find(s => s.assignment === Job.FARMER) || 0;
 	}
 
 	function ClubDatatypeCleanup() {
@@ -2173,7 +2143,7 @@ globalThis.FacilityDatatypeCleanup = (function() {
 		V.club = Math.max(+V.club, 0) || 0;
 		V.clubUpgradePDAs = Math.clamp(+V.clubUpgradePDAs, 0, 1) || 0;
 		/* madam */
-		V.DJ = V.slaves.find(s => s.assignment === "be the DJ") || 0;
+		V.DJ = V.slaves.find(s => s.assignment === Job.DJ) || 0;
 		V.DJignoresFlaws = Math.clamp(+V.DJignoresFlaws, 0, 1) || 0;
 	}
 
@@ -2182,7 +2152,7 @@ globalThis.FacilityDatatypeCleanup = (function() {
 		V.servantsQuarters = Math.max(+V.servantsQuarters, 0) || 0;
 		V.servantsQuartersUpgradeMonitoring = Math.clamp(+V.servantsQuartersUpgradeMonitoring, 0, 1) || 0;
 		/* stewardess */
-		V.Stewardess = V.slaves.find(s => s.assignment === "be the Stewardess") || 0;
+		V.Stewardess = V.slaves.find(s => s.assignment === Job.STEWARD) || 0;
 		V.stewardessImpregnates = Math.clamp(+V.stewardessImpregnates, 0, 1) || 0;
 	}
 
@@ -2193,7 +2163,7 @@ globalThis.FacilityDatatypeCleanup = (function() {
 		V.schoolroomUpgradeLanguage = Math.clamp(+V.schoolroomUpgradeLanguage, 0, 1) || 0;
 		V.schoolroomUpgradeRemedial = Math.clamp(+V.schoolroomUpgradeRemedial, 0, 1) || 0;
 		/* schoolteacher */
-		V.Schoolteacher = V.slaves.find(s => s.assignment === "be the Schoolteacher") || 0;
+		V.Schoolteacher = V.slaves.find(s => s.assignment === Job.TEACHER) || 0;
 	}
 
 	function SpaDatatypeCleanup() {
@@ -2215,7 +2185,7 @@ globalThis.FacilityDatatypeCleanup = (function() {
 		V.clinicInflateBelly = Math.clamp(+V.clinicInflateBelly, 0, 1) || 0;
 		V.clinicSpeedGestation = Math.clamp(+V.clinicSpeedGestation, 0, 1) || 0;
 		/* nurse */
-		V.Nurse = V.slaves.find(s => s.assignment === "be the Nurse") || 0;
+		V.Nurse = V.slaves.find(s => s.assignment === Job.NURSE) || 0;
 	}
 
 	function ArcadeDatatypeCleanup() {
@@ -2232,7 +2202,7 @@ globalThis.FacilityDatatypeCleanup = (function() {
 		V.cellblock = Math.max(+V.cellblock, 0) || 0;
 		V.cellblockUpgrade = Math.clamp(+V.cellblockUpgrade, 0, 1) || 0;
 		/* wardeness */
-		V.Wardeness = V.slaves.find(s => s.assignment === "be the Wardeness") || 0;
+		V.Wardeness = V.slaves.find(s => s.assignment === Job.WARDEN) || 0;
 		V.cellblockWardenCumsInside = Math.clamp(+V.cellblockWardenCumsInside, 0, 1) || 0;
 	}
 
@@ -2246,12 +2216,12 @@ globalThis.FacilityDatatypeCleanup = (function() {
 		V.masterSuitePregnancyFertilityDrugs = Math.clamp(+V.masterSuitePregnancyFertilityDrugs, 0, 1) || 0;
 		V.masterSuiteHyperPregnancy = Math.clamp(+V.masterSuiteHyperPregnancy, 0, 1) || 0;
 		/* concubine */
-		V.Concubine = V.slaves.find(s => s.assignment === "be your Concubine") || 0;
+		V.Concubine = V.slaves.find(s => s.assignment === Job.CONCUBINE) || 0;
 	}
 
 	function HeadGirlSuiteDatatypeCleanup() {
 		/* headgirl */
-		V.HeadGirl = V.slaves.find(s => s.assignment === "be your Head Girl") || 0;
+		V.HeadGirl = V.slaves.find(s => s.assignment === Job.HEADGIRL) || 0;
 		V.HGSuiteEquality = Math.clamp(+V.HGSuiteEquality, 0, 1) || 0;
 		if (V.HGSuiteSurgery !== 0) {
 			V.HGSuiteSurgery = 1;
@@ -2266,7 +2236,7 @@ globalThis.FacilityDatatypeCleanup = (function() {
 
 	function NurseryDatatypeCleanup() {
 		/* matron */
-		V.Matron = V.slaves.find(s => s.assignment === "be the Matron") || 0;
+		V.Matron = V.slaves.find(s => s.assignment === Job.MATRON) || 0;
 	}
 })();
 
@@ -2407,8 +2377,8 @@ App.Entity.Utils.RARuleDatatypeCleanup = function() {
 				// now if newAssignments is empty, we add all facility heads and special slaves
 				if (newAssignments.length === 0) {
 					fwh.forEach(f => newAssignments.push(f.manager.assignment));
-					newAssignments.push("recruit girls");
-					newAssignments.push("guard you");
+					newAssignments.push(Job.RECRUITER);
+					newAssignments.push(Job.BODYGUARD);
 				}
 				cond.assignment = newAssignments;
 			}
@@ -2616,8 +2586,7 @@ App.Entity.Utils.RARuleDatatypeCleanup = function() {
 }();
 
 App.Entity.Utils.validateRules = function() {
-	/** @type {App.RA.Rule[]} */
-	const rules = State.variables.defaultRules;
+	const rules = V.defaultRules;
 
 	function testObject(o, path) {
 		for (const p in o) {
@@ -2631,7 +2600,6 @@ App.Entity.Utils.validateRules = function() {
 		}
 	}
 
-	/** @type {App.RA.Rule} */
 	for (const rule of rules) {
 		try {
 			testObject(rule.set, "set");
diff --git a/src/data/newGamePlus.js b/src/data/newGamePlus.js
index 6da636ff813798e75a3524f61af44f653ea99935..f5a569ea612662e0a39f428dcde935087e67530a 100644
--- a/src/data/newGamePlus.js
+++ b/src/data/newGamePlus.js
@@ -55,7 +55,7 @@ App.Data.NewGamePlus = (function() {
 
 	function slaveLoopInit() {
 		const ngUpdateGenePool = function(genePool = []) {
-			const transferredSlaveIds = (State.variables.slaves || [])
+			const transferredSlaveIds = (V.slaves || [])
 				.filter(s => s.ID >= NGPOffset)
 				.map(s => s.ID - NGPOffset);
 			return genePool
@@ -70,7 +70,7 @@ App.Data.NewGamePlus = (function() {
 		const ngUpdateMissingTable = function(missingTable) {
 			const newTable = {};
 
-			(State.variables.slaves || [])
+			(V.slaves || [])
 				.forEach(s => ([s.pregSource + NGPOffset, s.mother + NGPOffset, s.father + NGPOffset]
 					.filter(i => (i in missingTable))
 					.forEach(i => {
@@ -81,11 +81,11 @@ App.Data.NewGamePlus = (function() {
 			return newTable;
 		};
 
-		V.slaves.deleteWith((s) => s.assignment !== "be imported");
+		V.slaves.deleteWith((s) => s.assignment !== Job.IMPORTED);
 
 		for (let slave of V.slaves) {
 			slave.ID += NGPOffset;
-			slave.assignment = "rest";
+			slave.assignment = Job.REST;
 			slave.weekAcquired = 0;
 			slave.newGamePlus = 1;
 			slave.mother = ngpSlaveID(slave.mother);
diff --git a/src/debugging/debugJS.js b/src/debugging/debugJS.js
index 87387e4ecc83960db3b92bb8f41dda16a14a4af1..ed7a4c0283ba7f59e16a15e26154e20f49387c80 100644
--- a/src/debugging/debugJS.js
+++ b/src/debugging/debugJS.js
@@ -121,6 +121,6 @@ App.Debug.dumpGameState = function() {
 
 App.Debug.slaveSummaryText = function(idx) {
 	let span = document.createElement("span");
-	span.appendChild(App.UI.SlaveSummary.render(State.variables.slaves[idx]));
+	span.appendChild(App.UI.SlaveSummary.render(V.slaves[idx]));
 	return span.outerHTML;
 };
diff --git a/src/debugging/profileInclude.js b/src/debugging/profileInclude.js
index c390d6d7da595f49aacaf50df149da15746785f9..eee4ed807d930bdd584c9941f7fdde123b8dc491 100644
--- a/src/debugging/profileInclude.js
+++ b/src/debugging/profileInclude.js
@@ -137,6 +137,9 @@ globalThis.ProfileInclude = (function() {
 				Macro.add('include', {handler: builtinIncludeHandler});
 				builtinIncludeHandler = null;
 			}
-		}
+		},
+
+		IncludeBegins: IncludeBegins,
+		IncludeEnds: IncludeEnds
 	};
 })();
diff --git a/src/endWeek/endWeek.js b/src/endWeek/endWeek.js
index 75628dd7e5096897f3094570adce1bbf20aa501f..1e73bc013cb49d1211703049b9c1610265d68083 100644
--- a/src/endWeek/endWeek.js
+++ b/src/endWeek/endWeek.js
@@ -50,7 +50,7 @@ globalThis.endWeek = (function() {
 				V.inflatedSlavesCum++;
 			}
 		}
-		if (s.assignment === "be a subordinate slave" && s.subTarget === 0) {
+		if (s.assignment === Job.SUBORDINATE && s.subTarget === 0) {
 			V.subSlaves++;
 		}
 		s.lastWeeksCashIncome = 0;
diff --git a/src/endWeek/healthFunctions.js b/src/endWeek/healthFunctions.js
index 7ed343eae1b1d75f6d5250f54b00c3981806ded8..48ee559311dbc89d872029efb18817a11986db10 100644
--- a/src/endWeek/healthFunctions.js
+++ b/src/endWeek/healthFunctions.js
@@ -71,7 +71,7 @@ globalThis.illness = function(slave) {
 	let sicknessDegree = ["fine", "minor illness", "illness", "bad illness", "severe illness", "life-threatening illness"];
 
 	// On the macro side of things disease could also happen to the arcology's population as the arcology becomes crowded, killing citizens and putting slaves at greater risk of getting ill. Again with upgrades/policies to mitigate the issue made available TODO?
-	if (slave.assignment === "live with your agent" || slave.assignment === "be your agent") {
+	if (slave.assignment === Job.AGENTPARTNER || slave.assignment === Job.AGENT) {
 		if (H.illness !== 0) {
 			H.illness = 0;
 		}
@@ -79,11 +79,11 @@ globalThis.illness = function(slave) {
 	} // Let's make sure agents don't get sick and accidentally die, they should take care of themselves
 	if (slave.fuckdoll !== 0) {
 		assignBonus += 50;
-	} else if (slave.assignment === "get treatment in the clinic") {
+	} else if (slave.assignment === Job.CLINIC) {
 		assignBonus += 40;
-	} else if (slave.assignment === "rest in the spa" || slave.assignment === "rest") {
+	} else if (slave.assignment === Job.SPA || slave.assignment === Job.REST) {
 		assignBonus += 20;
-	} else if ((slave.assignment === "serve in the master suite" || slave.assignment === "please you") && V.PC.skill.medicine >= 40) {
+	} else if ((slave.assignment === Job.MASTERSUITE || slave.assignment === Job.FUCKTOY) && V.PC.skill.medicine >= 40) {
 		assignBonus += 10;
 	} else if (setup.nurseCareers.includes(slave.career) || slave.skill.nurse >= 100 || slave.intelligence + slave.intelligenceImplant > 95) { // Let slaves with experience or brains use it
 		assignBonus += 10;
@@ -122,7 +122,7 @@ globalThis.illness = function(slave) {
 
 		// When ill, a slave has a 60% chance of getting better the next week at complete default, 70% with a favorable assignment, 80% with curatives, 90% with both measures active and additional benefits depending on the nurse on duty
 		if (H.illness > 0 && ((health_adjusted + age_modifier) / 3) + bonus_modifiers > 40 / curativesBonus) {
-			if (nurse_effectiveness > 30 && (jsRandom(1, 2) === 2 || slave.assignment === "get treatment in the clinic") && H.illness > 1) { // A particularly effective nurse can improve illness faster
+			if (nurse_effectiveness > 30 && (jsRandom(1, 2) === 2 || slave.assignment === Job.CLINIC) && H.illness > 1) { // A particularly effective nurse can improve illness faster
 				H.illness -= 2;
 				r += ` ${V.Nurse.slaveName} <span class="green">successfully treats</span> ${his} illness.`;
 			} else {
@@ -133,7 +133,7 @@ globalThis.illness = function(slave) {
 				r += ` ${He} no longer <span class="green">shows any signs</span> of ${his} previous sickness.`;
 			}
 		} else if (H.illness === 0) {
-			if (["guard you", "be the DJ", "be the Madam", "be confined in the arcade", "work a glory hole", "serve in the club", "serve the public", "whore", "work in the brothel"].includes(slave.assignment)) { // Limit to outside jobs only
+			if ([Job.BODYGUARD, Job.DJ, Job.MADAM, Job.ARCADE, Job.GLORYHOLE, Job.CLUB, Job.PUBLIC, Job.WHORE, Job.BROTHEL].includes(slave.assignment)) { // Limit to outside jobs only
 				if (((Math.min(health_adjusted, 50) + age_modifier) / 3) + bonus_modifiers < 30 / Math.min(curativesBonus + 1, 2)) { // Chance of getting ill 30% at complete default, 20% with a favourable assignment, 15% with curatives or preventatives, 10% with both measures active and a small benefit from effective Nurse screening
 					getIll(slave);
 					r += ` ${He} has come down with <span class="red">${addA(sicknessDegree[H.illness])}.</span>`;
@@ -158,7 +158,7 @@ globalThis.getIll = function(slave) {
 	const illness = jsRandom(1, 6) + jsRandom(1, 6) + jsRandom(1, 6) - Math.trunc(slave.chem / 150) + Math.trunc(H.condition / 20);
 	if (V.seeIllness !== 0) {
 		if (slave.curatives !== 1 && slave.inflationType !== "curative") {
-			if (slave.assignment !== "get treatment in the clinic") {
+			if (slave.assignment !== Job.CLINIC) {
 				if (illness < 4) {
 					H.illness = 5; // 1.8% chance
 				} else if (illness < 5) {
@@ -184,7 +184,7 @@ globalThis.getIll = function(slave) {
 globalThis.passIllness = function(slave1, slave2) {
 	if (V.seeIllness !== 0) {
 		if (slave1.curatives !== 1) {
-			if (slave1.assignment !== "get treatment in the clinic") {
+			if (slave1.assignment !== Job.CLINIC) {
 				slave1.health.illness = ill;
 			}
 		}
@@ -215,8 +215,8 @@ globalThis.nurseEffectiveness = function(slave) {
 	const clinicScreening = 1; // Assumes the clinic is set to screening all slaves to improve their chances of staying healthy. Turning it off would allow the nurse to focus on just her patients in the clinic -- TODO
 	if (V.Nurse !== 0) {
 		const nurseSkill = setup.nurseCareers.includes(V.Nurse.career) ? 200 : V.Nurse.skill.nurse;
-		let nurseEffectiveness = Math.trunc((nurseSkill * clinicUpgrade / Math.max((V.CliniciIDs.length * 10 + (V.slaves.length * 2) * clinicScreening), 1)) * 20);
-		if (H.illness > 1 && slave.assignment === "get treatment in the clinic") {
+		let nurseEffectiveness = Math.trunc((nurseSkill * clinicUpgrade / Math.max((App.Entity.facilities.clinic.employeesIDs().size * 10 + (V.slaves.length * 2) * clinicScreening), 1)) * 20);
+		if (H.illness > 1 && slave.assignment === Job.CLINIC) {
 			if (nurseEffectiveness < 20) {
 				return nurseEffectiveness;
 			} else if (nurseSkill > 80) {
@@ -282,15 +282,15 @@ globalThis.endWeekHealthDamage = function(slave) {
 	if (H.shortDamage > 0) {
 		shortToCondition += Math.max(Math.trunc(H.shortDamage * 0.5), 1); // 50% of short term damage gets transferred
 		H.shortDamage -= shortToCondition;
-		if (slave.assignment === "get treatment in the clinic") {
+		if (slave.assignment === Job.CLINIC) {
 			H.shortDamage = Math.trunc(H.shortDamage * 0.5); // An additional 50% of short term damage reduction (75% total) for getting treatment in the clinic
-		} else if (slave.assignment === "rest" || slave.assignment === "rest in the spa") {
+		} else if (slave.assignment === Job.REST || slave.assignment === Job.SPA) {
 			H.shortDamage = Math.trunc(H.shortDamage * 0.75); // An additional 25% of short term damage reduction (62.5% total) for resting
 		}
 		if (slave.curatives > 0 || slave.ID === -1) { // transferred damage is half if on preventatives/curatives or target is the player
 			shortToCondition = Math.trunc(shortToCondition * 0.5);
 		}
-		if (slave.assignment === "get treatment in the clinic") {
+		if (slave.assignment === Job.CLINIC) {
 			shortToCondition = Math.trunc(shortToCondition * 0.75);
 		}
 		shortToLong += Math.trunc(shortToCondition * 0.1); // 10% of transferred damage gets added to long term damage, minimum of 20 short term damage before any long term damage is accumulated
@@ -340,9 +340,9 @@ globalThis.willWorkToDeath = function(slave) {
 		return true;
 	} else if (slave.fetish === "mindbroken") {
 		return true;
-	} else if (V.Madam !== 0 && (slave.assignment === "work in the brothel" || (slave.assignment === "whore" && V.brothel > 0 && V.universalRulesFacilityWork === 1 && V.brothelSpots > 0))) {
+	} else if (V.Madam !== 0 && (slave.assignment === Job.BROTHEL || (slave.assignment === Job.WHORE && V.brothel > 0 && V.universalRulesFacilityWork === 1 && V.brothelSpots > 0))) {
 		return true;
-	} else if (V.DJ !== 0 && (slave.assignment === "serve in the club" || (slave.assignment === "serve the public" && V.club > 0 && V.universalRulesFacilityWork === 1 && V.clubSpots > 0))) {
+	} else if (V.DJ !== 0 && (slave.assignment === Job.CLUB || (slave.assignment === Job.PUBLIC && V.club > 0 && V.universalRulesFacilityWork === 1 && V.clubSpots > 0))) {
 		return true;
 	}
 	return false;
@@ -395,23 +395,23 @@ globalThis.tired = function(slave) {
 				}
 				assignment -= Math.trunc(skillBonus / 10); // Maximum of 20 extra points of negative tiredness due to attendant skill
 			}
-		} else if (["rest", "get treatment in the clinic"].includes(slave.assignment)) {
+		} else if ([Job.REST, Job.CLINIC].includes(slave.assignment)) {
 			assignment -= 40; // Major tired reduction due to a solid week of rest
-		} else if (["guard you"].includes(slave.assignment)) {
+		} else if ([Job.BODYGUARD].includes(slave.assignment)) {
 			assignment += 18; // A tough assignment with a girl that doesn't use her provided room unless it is attached to yours.
-		} else if (["be your Head Girl"].includes(slave.assignment)) {
+		} else if ([Job.HEADGIRL].includes(slave.assignment)) {
 			assignment += 22; // Always busy. Could benefit from a helper...
-		} else if (["be the Matron", "be the Stewardess", "be the Milkmaid", "be the Farmer", "be the DJ", "be the Madam", "be the Schoolteacher", "be the Wardeness", "be the Nurse"].includes(slave.assignment)) { // Heads are very busy, but always have luxurious conditions, so it balances out, save for the exceptions
+		} else if (App.Data.misc.facilityHeads.includes(slave.assignment)) { // Heads are very busy, but always have luxurious conditions, so it balances out, save for the exceptions
 			assignment += 15;
-		} else if ([Job.ATTENDANT, "be your Concubine"].includes(slave.assignment)) { // Cushy head positions
+		} else if ([Job.ATTENDANT, Job.CONCUBINE].includes(slave.assignment)) { // Cushy head positions
 			assignment += 5;
-		} else if (["recruit girls"].includes(slave.assignment)) {
+		} else if ([Job.RECRUITER].includes(slave.assignment)) {
 			if (H.tired > 80) { // I'll take it easy a week to better recruit the next.
 				assignment -= 20;
 			} else {
 				assignment += 10;
 			}
-		} else if (["live with your Head Girl"].includes(slave.assignment)) {
+		} else if ([Job.HEADGIRLSUITE].includes(slave.assignment)) {
 			if (slave.health.tired > 60) {
 				assignment += 2;
 			} else if (slave.devotion > 20) {
@@ -419,7 +419,7 @@ globalThis.tired = function(slave) {
 			} else {
 				assignment += 10;
 			}
-		} else if (["get milked"].includes(slave.assignment)) {
+		} else if ([Job.MILKED].includes(slave.assignment)) {
 			if (slave.devotion > 20) {
 				assignment += 2;
 			} else {
@@ -428,7 +428,7 @@ globalThis.tired = function(slave) {
 			if (slave.balls > 0) {
 				assignment += 1;
 			}
-		} else if (["work in the dairy"].includes(slave.assignment)) {
+		} else if ([Job.DAIRY].includes(slave.assignment)) {
 			if (V.dairyRestraintsSetting > 1) {
 				// assignment += 100; // Full industrial Dairy is exhausting
 			} else if (V.dairyRestraintsSetting > 0) {
@@ -443,8 +443,8 @@ globalThis.tired = function(slave) {
 					assignment += 1;
 				}
 			}
-		} else if (["be confined in the cellblock", "stay confined"].includes(slave.assignment)) { // Generally not tiring unless a Wardeness is present, in which case she uses sleep deprivation to break slaves.
-			if (slave.assignment === "be confined in the cellblock" && V.Wardeness !== 0 && slave.fetish !== "mindbroken") {
+		} else if ([Job.CELLBLOCK, Job.CONFINEMENT].includes(slave.assignment)) { // Generally not tiring unless a Wardeness is present, in which case she uses sleep deprivation to break slaves.
+			if (slave.assignment === Job.CELLBLOCK && V.Wardeness !== 0 && slave.fetish !== "mindbroken") {
 				if (V.Wardeness.fetish === "mindbroken") {
 					if (H.tired > 80) {
 						assignment -= 8;
@@ -471,14 +471,14 @@ globalThis.tired = function(slave) {
 			} else {
 				assignment -= 8;
 			}
-		} else if (["be confined in the arcade"].includes(slave.assignment)) {
+		} else if ([Job.ARCADE].includes(slave.assignment)) {
 			assignment += 35;
 			if (V.arcadeUpgradeHealth === 2) {
 				assignment -= 60;
 			} else if (V.arcadeUpgradeHealth === 1) {
 				assignment -= 30;
 			}
-		} else if (["work a glory hole", "work as a farmhand"].includes(slave.assignment)) { // Hard assignments
+		} else if ([Job.GLORYHOLE, Job.FARMYARD].includes(slave.assignment)) { // Hard assignments
 			if (slaveResting(slave)) {
 				assignment -= 20;
 				V.slaveUsedRest = 1;
@@ -489,7 +489,7 @@ globalThis.tired = function(slave) {
 			} else {
 				assignment += 20;
 			}
-		} else if (["serve in the club", "serve the public", "whore", "work in the brothel"].includes(slave.assignment)) { // Moderate assignments
+		} else if (App.Data.misc.whoringAssignments.includes(slave.assignment)) { // Moderate assignments
 			if (slaveResting(slave)) {
 				assignment -= 20;
 				V.slaveUsedRest = 1;
@@ -500,7 +500,7 @@ globalThis.tired = function(slave) {
 			} else {
 				assignment += 15;
 			}
-		} else if (["please you", "be a servant", "work as a servant"].includes(slave.assignment)) { // Easy assignments
+		} else if ([Job.FUCKTOY, Job.HOUSE, Job.QUARTER].includes(slave.assignment)) { // Easy assignments
 			if (slaveResting(slave)) {
 				assignment -= 20;
 				V.slaveUsedRest = 1;
@@ -511,7 +511,7 @@ globalThis.tired = function(slave) {
 			} else {
 				assignment += 11;
 			}
-		} else if (["learn in the schoolroom", "take classes", "serve in the master suite"].includes(slave.assignment)) { // Trivial assignments
+		} else if ([Job.SCHOOL, Job.CLASSES, Job.MASTERSUITE].includes(slave.assignment)) { // Trivial assignments
 			if (slave.health.tired > 80) {
 				assignment += 2;
 			} else if (slave.devotion > 20) {
@@ -522,7 +522,7 @@ globalThis.tired = function(slave) {
 		}
 
 		// Living Conditions
-		if ((slave.assignment === "guard you" && V.dojo === 2) || (slave.assignment === "be your Head Girl" && V.HGSuite === 1)) {
+		if ((slave.assignment === Job.BODYGUARD && V.dojo === 2) || (slave.assignment === Job.HEADGIRL && V.HGSuite === 1)) {
 			livingRules -= 20;
 		} else if (slave.rules.living === "luxurious") {
 			livingRules -= 15;
@@ -602,7 +602,7 @@ globalThis.tired = function(slave) {
 
 		// Health
 		health = Math.trunc((H.shortDamage / 2 - H.condition / 10) * (1 + normalRandInt(0, 5) / 100)); // Current condition reduces tiredness, health damage increases tiredness
-		if (slave.assignment === "rest" || slave.assignment === "get treatment in the clinic" || slave.assignment === "rest in the spa") {
+		if (slave.assignment === Job.REST || slave.assignment === Job.CLINIC || slave.assignment === Job.SPA) {
 			health = Math.max(0, health); // break vicious cycle - no additional tiredness accumulates from bad health for slaves assigned to rest
 		}
 		*/
@@ -612,7 +612,7 @@ globalThis.tired = function(slave) {
 
 		// day of rest
 		if (slave.rules.rest === "mandatory") {
-			if (["work a glory hole", "work as a farmhand", "serve in the club", "serve the public", "whore", "work in the brothel", "be a subordinate slave", "be a servant", "work as a servant", "please you", "serve in the master suite"].includes(slave.assignment) || (V.dairyRestraintsSetting < 2 && slave.assignment === "work in the dairy")) {
+			if ([Job.GLORYHOLE, Job.FARMYARD, Job.CLUB, Job.PUBLIC, Job.WHORE, Job.BROTHEL, Job.SUBORDINATE, Job.HOUSE, Job.QUARTER, Job.FUCKTOY, Job.MASTERSUITE].includes(slave.assignment) || (V.dairyRestraintsSetting < 2 && slave.assignment === Job.DAIRY)) {
 				restRules -= 20;
 			}
 		}
@@ -621,11 +621,11 @@ globalThis.tired = function(slave) {
 		H.tired += tiredChange;
 
 		// HG special cases
-		if (slave.assignment === "be your Head Girl") {
+		if (slave.assignment === Job.HEADGIRL) {
 			if (V.HGSlaveSuccess === 1) {
 				H.tired -= 5;
 			}
-			if (V.personalAttention === "HG") {
+			if (V.personalAttention === PersonalAttention.SUPPORTHG) {
 				H.tired -= 10;
 			}
 		}
@@ -681,7 +681,7 @@ globalThis.tiredFucks = function(slave) {
 		if (slave.fetish === "masochist" || slave.fetish === "humiliation") {
 			acceptance += Math.trunc(slave.fetishStrength / 10);
 		}
-		if (slave.assignment === "work a glory hole") {
+		if (slave.assignment === Job.GLORYHOLE) {
 			if ((acceptance > 20 && slave.devotion > 20) || slave.sexualFlaw === "self hating") {
 				slave.health.tired += Math.trunc(slave.sexAmount * (1 + normalRandInt(0, 5) / 100) / 100);
 			} else {
diff --git a/src/endWeek/minorInjuryResponse.js b/src/endWeek/minorInjuryResponse.js
index 70da875fbe75700f18153db69118236f17bb5970..4b61210ecddc785fbac1043e8d2253a514efbc5b 100644
--- a/src/endWeek/minorInjuryResponse.js
+++ b/src/endWeek/minorInjuryResponse.js
@@ -3,8 +3,8 @@
  * @returns {string}
  */
 globalThis.minorInjuryResponse = function(slave) {
-	const arcology = State.variables.arcologies[0];
-	const arcologyUpgrade = State.variables.arcologyUpgrade;
+	const arcology = V.arcologies[0];
+	const arcologyUpgrade = V.arcologyUpgrade;
 	const {he, himself, He} = getPronouns(slave);
 	let r = "";
 	let trackedCategory = "";
diff --git a/src/endWeek/saAgent.js b/src/endWeek/saAgent.js
new file mode 100644
index 0000000000000000000000000000000000000000..e5baecee930f5867ccf54682314a2e979604ffe8
--- /dev/null
+++ b/src/endWeek/saAgent.js
@@ -0,0 +1,550 @@
+/**
+ * @param {App.Entity.SlaveState} slave
+ */
+App.SlaveAssignment.agent = function(slave) {
+	const gigantomastiaMod = slave.geneticQuirks.gigantomastia === 2 ? (slave.geneticQuirks.macromastia === 2 ? 3 : 2) : 1;
+
+	if (slave.boobsImplantType === "string") {
+		slave.boobsImplant += 50;
+		slave.boobs += 50;
+		if (slave.boobs > 50000) {
+			slave.boobs -= 100;
+			slave.boobsImplant -= 100;
+			if (slave.geneMods.NCS === 1) {
+				slave.boobs -= 100;
+				slave.boobsImplant -= 100;
+			}
+		}
+	}
+
+	if (slave.geneMods.NCS === 1) { /* NCS is blocking boob expansion. */
+		if (slave.boobsImplant > 1000) {
+			if ((slave.boobs - slave.boobsImplant < 1000) && (random(1, 100) > 60)) {
+				slave.boobs += 50;
+			}
+		} else if (slave.boobsImplant > 600) {
+			if ((slave.boobs - slave.boobsImplant < 500) && (random(1, 100) > 60)) {
+				slave.boobs += 50;
+			}
+		} else if (slave.boobsImplant > 0) {
+			if ((slave.boobs - slave.boobsImplant < 300) && (random(1, 100) > 60)) {
+				slave.boobs += 50;
+			}
+		}
+	}
+	if (slave.geneticQuirks.macromastia === 2 && slave.geneticQuirks.gigantomastia === 2) {
+		if (slave.boobs < 100000 && slave.weight >= -95) {
+			slave.boobs += 30;
+		}
+	} else if (slave.geneticQuirks.gigantomastia === 2) {
+		if (slave.boobs < 25000 && slave.weight >= -95) {
+			slave.boobs += 20;
+		}
+	} else if (slave.geneticQuirks.macromastia === 2) {
+		if (slave.boobs < 5000 && slave.weight >= -95) {
+			slave.boobs += 10;
+		}
+	}
+	if (slave.buttImplantType === "string") {
+		slave.buttImplant += .25;
+		slave.butt += .25;
+		if ((slave.butt > 10)) {
+			slave.butt -= 1, slave.buttImplant -= 1;
+			if (slave.geneMods.NCS === 1) {
+				slave.butt -= 1, slave.buttImplant -= 1;
+			}
+		}
+	}
+	if (slave.geneticQuirks.rearLipedema === 2 && slave.butt < 20) {
+		slave.butt += .1;
+	}
+
+	if (slave.genes === "XX") {
+		if (slave.ovaries === 1 || slave.mpreg === 1) {
+			if (slave.balls > 0 && slave.ballType !== "sterile") {
+				if (slave.hormoneBalance > 20) {
+					slave.hormoneBalance -= 1;
+				} else if (slave.hormoneBalance < 20) {
+					slave.hormoneBalance += 1;
+				}
+			} else {
+				if (slave.hormoneBalance > 60) {
+					slave.hormoneBalance -= 1;
+				} else if (slave.hormoneBalance < 60) {
+					slave.hormoneBalance += 1;
+				}
+			}
+		} else {
+			if (slave.balls > 0 && slave.ballType !== "sterile") {
+				if (slave.hormoneBalance > -20) {
+					slave.hormoneBalance -= 1;
+				} else if (slave.hormoneBalance < -20) {
+					slave.hormoneBalance += 1;
+				}
+			} else {
+				if (slave.hormoneBalance > 20) {
+					slave.hormoneBalance -= 1;
+				} else if (slave.hormoneBalance < 20) {
+					slave.hormoneBalance += 1;
+				}
+			}
+		}
+	} else if (slave.genes === "XY") {
+		if (slave.ovaries === 1 || slave.mpreg === 1) {
+			if (slave.balls > 0 && slave.ballType !== "sterile") {
+				if (slave.hormoneBalance > 20) {
+					slave.hormoneBalance -= 1;
+				} else if (slave.hormoneBalance < 20) {
+					slave.hormoneBalance += 1;
+				}
+			} else {
+				if (slave.hormoneBalance > 40) {
+					slave.hormoneBalance -= 1;
+				} else if (slave.hormoneBalance < 40) {
+					slave.hormoneBalance += 1;
+				}
+			}
+		} else {
+			if (slave.balls > 0 && slave.ballType !== "sterile") {
+				if (slave.hormoneBalance > -40) {
+					slave.hormoneBalance -= 1;
+				} else if (slave.hormoneBalance < -40) {
+					slave.hormoneBalance += 1;
+				}
+			} else {
+				if (slave.hormoneBalance > 20) {
+					slave.hormoneBalance -= 1;
+				} else if (slave.hormoneBalance < 20) {
+					slave.hormoneBalance += 1;
+				}
+			}
+		}
+	}
+
+	/* puberty - not announced for allowing surprise pregnancy */
+	if (slave.ovaries === 1 || slave.mpreg === 1) {
+		if (slave.pubertyXX === 0) {
+			if (slave.physicalAge >= slave.pubertyAgeXX) {
+				slave.pubertyXX = 1;
+				if (slave.geneticQuirks.gigantomastia === 3 && random(1, 100) < slave.hormoneBalance) {
+					slave.geneticQuirks.gigantomastia = 2;
+				}
+				if (slave.geneticQuirks.macromastia === 3 && random(1, 100) < slave.hormoneBalance) {
+					slave.geneticQuirks.macromastia = 2;
+				}
+			}
+		}
+	}
+	if (slave.balls > 0 && slave.ballType !== "sterile") {
+		if (slave.pubertyXY === 0) {
+			if (slave.physicalAge >= slave.pubertyAgeXY) {
+				slave.pubertyXY = 1;
+			}
+		}
+	}
+
+	if (slave.inflation > 0) {
+		slave.inflation = 0, slave.inflationType = "none", slave.inflationMethod = 0, slave.milkSource = 0;
+	}
+
+	if (slave.preg > 0) { // EFFECTS OF PREGNANCY
+		if (slave.preg === slave.pregData.normalBirth / 8) { /* !!! Very bad condition logic - with pregnancy control drugs can be not triggered. Or may be trigged by broodmother several times. Need to be reworked. !!! */
+			if (slave.pregSource === -1) {
+				V.PC.counter.slavesKnockedUp++;
+			} else if (slave.pregSource > 0) {
+				const babyDaddy = findFather(slave.pregSource);
+				if (babyDaddy) {
+					const adjust = babyDaddy.counter.slavesKnockedUp++;
+					adjustFatherProperty(babyDaddy, "slavesKnockedUp", adjust);
+				}
+			}
+		}
+		if (slave.preg >= slave.pregData.normalBirth / 4) {
+			if (slave.geneticQuirks.gigantomastia === 3 && random(1, 200) < slave.hormoneBalance) {
+				slave.geneticQuirks.gigantomastia = 2;
+			}
+			if (slave.geneticQuirks.macromastia === 3 && random(1, 200) < slave.hormoneBalance) {
+				slave.geneticQuirks.macromastia = 2;
+			}
+			let boobTarget = 0;
+			if (slave.geneMods.NCS === 1) {
+				/* Sort-of No-op, NCS prevents boob growth */
+				boobTarget = 0;
+			} else if (slave.physicalAge >= 18) {
+				if (slave.pregType >= 50) {
+					boobTarget = 10000;
+				} else if (slave.pregType >= 30) {
+					boobTarget = 5000;
+				} else if (slave.pregType >= 10) {
+					boobTarget = 2000;
+				} else {
+					boobTarget = 1000;
+				}
+			} else if (slave.physicalAge >= 13) {
+				if (slave.pregType >= 50) {
+					boobTarget = 5000;
+				} else if (slave.pregType >= 30) {
+					boobTarget = 3200;
+				} else if (slave.pregType >= 10) {
+					boobTarget = 1800;
+				} else {
+					boobTarget = 800;
+				}
+			} else if (slave.physicalAge >= 8) {
+				if (slave.pregType >= 50) {
+					boobTarget = 1800;
+				} else if (slave.pregType >= 30) {
+					boobTarget = 1400;
+				} else if (slave.pregType >= 10) {
+					boobTarget = 1000;
+				} else {
+					boobTarget = 600;
+				}
+			} else {
+				if (slave.pregType >= 50) {
+					boobTarget = 1000;
+				} else if (slave.pregType >= 30) {
+					boobTarget = 800;
+				} else if (slave.pregType >= 10) {
+					boobTarget = 600;
+				} else {
+					boobTarget = 400;
+				}
+			}
+			boobTarget *= gigantomastiaMod;
+			if (slave.pregType >= 30) {
+				if (slave.weight <= 65) {
+					slave.weight += 1;
+				}
+				if ((slave.geneMods.NCS === 0) && (random(1, 100) > 60)) {
+					if ((slave.boobs - slave.boobsImplant) < boobTarget) {
+						slave.boobs += 200;
+						if (slave.boobShape !== "saggy" && slave.preg > slave.pregData.normalBirth / 1.25 && (slave.breastMesh !== 1)) {
+							slave.boobShape = "saggy";
+						}
+					}
+					if (slave.hips < 2) {
+						slave.hips += 1;
+					}
+					if (slave.butt < 14) {
+						slave.butt += 1;
+					}
+				}
+			} else if ((slave.geneMods.NCS === 0) && (slave.pregType >= 10)) {
+				if (random(1, 100) > 80 && ((slave.boobs - slave.boobsImplant) < boobTarget)) {
+					slave.boobs += 100;
+					if (slave.boobShape !== "saggy" && (slave.breastMesh !== 1)) {
+						if (slave.preg > random(slave.pregData.normalBirth / 1.25, slave.pregData.normalBirth * 2)) {
+							slave.boobShape = "saggy";
+						}
+					}
+				}
+			} else if (((slave.geneMods.NCS === 0) && ((slave.boobs - slave.boobsImplant) < boobTarget))) {
+				if (random(1, 100) > 80) {
+					slave.boobs += 50;
+					if (slave.boobShape !== "saggy" && slave.preg > random(slave.pregData.normalBirth / 1.25, slave.pregData.normalBirth * 2.5) && (slave.breastMesh !== 1)) {
+						slave.boobShape = "saggy";
+					}
+				}
+			}
+			if (slave.geneMods.NCS === 1) {
+				/* No-op, we don't grow hips on NCS */
+			} else if (slave.preg > slave.pregData.normalBirth / 1.25 && slave.physicalAge >= 18 && slave.hips === 1 && slave.hipsImplant === 0 && random(1, 100) > 90) {
+				slave.hips += 1;
+			} else if (slave.preg > slave.pregData.normalBirth / 1.42 && slave.physicalAge >= 18 && slave.hips === 0 && slave.hipsImplant === 0 && random(1, 100) > 70) {
+				slave.hips += 1;
+			}
+			if (slave.bellyPreg >= 1500) {
+				if (setup.fakeBellies.includes(slave.bellyAccessory)) {
+					slave.bellyAccessory = "none";
+				}
+				if ((slave.preg > slave.pregData.normalBirth / 2) && (slave.lactation === 0) && slave.health.condition >= -20 && slave.weight > -30) {
+					if (slave.preg > random(slave.pregData.normalBirth / 2.22, slave.pregData.normalBirth / 1.33)) {
+						slave.lactation = 1;
+					}
+				}
+				if (slave.lactation === 1) {
+					slave.lactationDuration = 2;
+				}
+			}
+		} // closes .preg >= 10
+	} // END PREG EFFECTS
+
+	if (slave.belly >= 1000000) {
+		if (slave.bellySag < 50) {
+			slave.bellySag += 1;
+			if (slave.preg > 0) {
+				slave.bellySagPreg += 1;
+			}
+		} else if (slave.preg > 0 && slave.bellySagPreg < 20) {
+			slave.bellySagPreg += 1;
+		}
+		if (slave.pregControl === "speed up") {
+			slave.bellySag += 5, slave.bellySagPreg += 5;
+		}
+		if (slave.geneMods.rapidCellGrowth === 1) {
+			slave.bellySag += 3;
+			if (slave.preg > 0) {
+				slave.bellySagPreg += 3;
+			}
+		}
+	} else if (slave.belly >= 750000) {
+		if (slave.bellySag < 30) {
+			slave.bellySag += 0.7;
+			if (slave.preg > 0) {
+				slave.bellySagPreg += 0.7;
+			}
+		} else if (slave.preg > 0 && slave.bellySagPreg < 30) {
+			slave.bellySagPreg += 0.7;
+		}
+		if (slave.pregControl === "speed up") {
+			slave.bellySag += 2, slave.bellySagPreg += 2;
+		}
+		if (slave.geneMods.rapidCellGrowth === 1) {
+			slave.bellySag += 1;
+			if (slave.preg > 0) {
+				slave.bellySagPreg += 1;
+			}
+		}
+	} else if (slave.belly >= 600000) {
+		if (slave.bellySag < 20) {
+			slave.bellySag += 0.5;
+			if (slave.preg > 0) {
+				slave.bellySagPreg += 0.5;
+			}
+		} else if (slave.preg > 0 && slave.bellySagPreg < 20) {
+			slave.bellySagPreg += 0.5;
+		}
+		if (slave.pregControl === "speed up") {
+			slave.bellySag += 1;
+			slave.bellySagPreg += 1;
+		}
+		if (slave.geneMods.rapidCellGrowth === 1) {
+			slave.bellySag += 1;
+			if (slave.preg > 0) {
+				slave.bellySagPreg += 1;
+			}
+		}
+	} else if (slave.belly >= 450000) {
+		if (slave.bellySag < 15) {
+			slave.bellySag += 0.4;
+			if (slave.preg > 0) {
+				slave.bellySagPreg += 0.4;
+			}
+		} else if (slave.preg > 0 && slave.bellySagPreg < 15) {
+			slave.bellySagPreg += 0.4;
+		}
+		if (slave.pregControl === "speed up") {
+			slave.bellySag += 0.6, slave.bellySagPreg += 0.6;
+		}
+		if (slave.geneMods.rapidCellGrowth === 1) {
+			slave.bellySag += 0.5;
+			if (slave.preg > 0) {
+				slave.bellySagPreg += 0.5;
+			}
+		}
+	} else if (slave.belly >= 300000) {
+		if (slave.bellySag < 10) {
+			slave.bellySag += 0.3;
+			if (slave.preg > 0) {
+				slave.bellySagPreg += 0.3;
+			}
+		} else if (slave.preg > 0 && slave.bellySagPreg < 10) {
+			slave.bellySagPreg += 0.3;
+		}
+		if (slave.pregControl === "speed up") {
+			slave.bellySag += 0.5, slave.bellySagPreg += 0.5;
+		}
+		if (slave.geneMods.rapidCellGrowth === 1) {
+			slave.bellySag += 0.5;
+			if (slave.preg > 0) {
+				slave.bellySagPreg += 0.5;
+			}
+		}
+	} else if (slave.belly >= 100000) {
+		if (slave.bellySag < 10) {
+			slave.bellySag += 0.2;
+			if (slave.preg > 0) {
+				slave.bellySagPreg += 0.2;
+			}
+		} else if (slave.preg > 0 && slave.bellySagPreg < 10) {
+			slave.bellySagPreg += 0.2;
+		}
+		if (slave.pregControl === "speed up") {
+			slave.bellySag += 0.3, slave.bellySagPreg += 0.3;
+		}
+		if (slave.geneMods.rapidCellGrowth === 1) {
+			slave.bellySag += 0.3;
+			if (slave.preg > 0) {
+				slave.bellySagPreg += 0.3;
+			}
+		}
+	} else if ((slave.bellyPreg >= 10000) || (slave.bellyImplant >= 10000)) {
+		if (slave.bellySag < 5) {
+			slave.bellySag += 0.1;
+			if (slave.preg > 0) {
+				slave.bellySagPreg += 0.1;
+			}
+		} else if (slave.preg > 0 && slave.bellySagPreg < 5) {
+			slave.bellySagPreg += 0.1;
+		}
+		if (slave.pregControl === "speed up") {
+			slave.bellySag += 0.2, slave.bellySagPreg += 0.2;
+		}
+		if (slave.geneMods.rapidCellGrowth === 1) {
+			slave.bellySag += 0.2;
+			if (slave.preg > 0) {
+				slave.bellySagPreg += 0.2;
+			}
+		}
+	}
+	if (slave.bellySagPreg > slave.bellySag) {
+		slave.bellySagPreg = slave.bellySag;
+	}
+
+	if (slave.bellySag > 0 && slave.belly < 1500 && slave.geneMods.rapidCellGrowth !== 1) {
+		if (slave.muscles > 95) {
+			if (random(1, 100) > 1) {
+				if (slave.bellySagPreg > 0) {
+					slave.bellySag -= 0.5;
+					slave.bellySagPreg -= 0.5;
+					if (slave.bellySag < 0) {
+						slave.bellySag = 0;
+						slave.bellySagPreg = 0;
+					}
+				} else {
+					slave.bellySag -= 0.5;
+					if (slave.bellySag < 0) {
+						slave.bellySag = 0;
+					}
+				}
+			}
+		} else if (slave.muscles >= 30) {
+			if (random(1, 100) > 20) {
+				if (slave.bellySagPreg > 0) {
+					slave.bellySag -= 0.4;
+					slave.bellySagPreg -= 0.4;
+					if (slave.bellySag < 0) {
+						slave.bellySag = 0;
+						slave.bellySagPreg = 0;
+					}
+				} else {
+					slave.bellySag -= 0.4;
+					if (slave.bellySag < 0) {
+						slave.bellySag = 0;
+					}
+				}
+			}
+		} else if (slave.muscles >= 5) {
+			if (random(1, 100) > 40) {
+				if (slave.bellySagPreg > 0) {
+					slave.bellySag -= 0.3;
+					slave.bellySagPreg -= 0.3;
+					if (slave.bellySag < 0) {
+						slave.bellySag = 0;
+						slave.bellySagPreg = 0;
+					}
+				} else {
+					slave.bellySag -= 0.3;
+					if (slave.bellySag < 0) {
+						slave.bellySag = 0;
+					}
+				}
+			}
+		} else {
+			if (random(1, 100) > 60) {
+				if (slave.bellySagPreg > 0) {
+					slave.bellySag -= 0.2;
+					slave.bellySagPreg -= 0.2;
+					if (slave.bellySag < 0) {
+						slave.bellySag = 0;
+						slave.bellySagPreg = 0;
+					}
+				} else {
+					slave.bellySag -= 0.2;
+					if (slave.bellySag < 0) {
+						slave.bellySag = 0;
+					}
+				}
+			}
+		}
+	}
+
+	if ((slave.preg > slave.pregData.minLiveBirth) && (slave.broodmother === 0) && (random(1, 100) < 90)) {
+		slave.counter.birthsTotal += WombBirthReady(slave, slave.pregData.minLiveBirth), WombBirth(slave, slave.pregData.minLiveBirth), WombFlush(slave);
+		if (slave.geneticQuirks.fertility + slave.geneticQuirks.hyperFertility >= 4) {
+			slave.pregWeek = -2;
+		} else if (slave.geneticQuirks.hyperFertility > 1) {
+			slave.pregWeek = -3;
+		} else {
+			slave.pregWeek = -4;
+		}
+		if (slave.birthsTat > -1) {
+			slave.birthsTat++;
+		}
+	} else if ((slave.preg > slave.pregData.normalBirth) && (slave.broodmother === 0)) {
+		slave.counter.birthsTotal += WombBirthReady(slave, slave.pregData.minLiveBirth), WombBirth(slave, slave.pregData.minLiveBirth), WombFlush(slave);
+		if (slave.geneticQuirks.fertility + slave.geneticQuirks.hyperFertility >= 4) {
+			slave.pregWeek = -2;
+		} else if (slave.geneticQuirks.hyperFertility > 1) {
+			slave.pregWeek = -3;
+		} else {
+			slave.pregWeek = -4;
+		}
+		if (slave.birthsTat > -1) {
+			slave.birthsTat++;
+		}
+	} else if ((slave.preg > 37) && (slave.broodmother > 0)) {
+		if (slave.broodmother > 0) {
+			slave.counter.birthsTotal += WombBirthReady(slave, 37), WombBirth(slave, 37), slave.preg = WombMaxPreg(slave);
+		}
+		if (slave.birthsTat > -1) {
+			slave.birthsTat++;
+		}
+	}
+
+	SetBellySize(slave); // Actually it's now better to set belly size without checking of any conditions. Just to be sure. Should correct forgotten variables too.
+
+	if (slave.lactation === 1) {
+		if (slave.fetish !== "boobs") {
+			if (slave.lactationDuration === 0) {
+				slave.boobs -= slave.boobsMilk;
+				slave.boobsMilk = 0;
+				slave.lactation = 0;
+			} else if (slave.lactationDuration === 1) {
+				slave.boobsMilk += 10 * slave.lactationAdaptation;
+				slave.boobs += slave.boobsMilk;
+			} else {
+				slave.lactationDuration--;
+			}
+		} else {
+			slave.lactationDuration = 2;
+		}
+	} else if (slave.lactation === 2) {
+		slave.lactationDuration = 2;
+	} else if (slave.fetish === "boobs" && slave.boobs - slave.boobsImplant >= 2000) {
+		slave.induceLactation += 2;
+		if (slave.lactationDuration >= 20) {
+			slave.induceLactation = 0;
+			slave.lactationDuration = 2;
+			slave.lactation = 1;
+		}
+	}
+
+	if (slave.induceLactation > 0) {
+		slave.induceLactation--;
+	}
+
+	if (slave.geneticQuirks.gigantomastia === 3 && random(70 - slave.physicalAge, 300) < slave.hormoneBalance) {
+		slave.geneticQuirks.gigantomastia = 2;
+	}
+	if (slave.geneticQuirks.macromastia === 3 && random(70 - slave.physicalAge, 300) < slave.hormoneBalance) {
+		slave.geneticQuirks.macromastia = 2;
+	}
+
+	if ((slave.hStyle !== "shaved" && slave.bald !== 1 && slave.haircuts === 0) && (slave.hLength < 150)) {
+		slave.hLength += 1;
+	}
+
+	slave.health.illness = 0;
+};
diff --git a/src/endWeek/saChoosesOwnClothes.js b/src/endWeek/saChoosesOwnClothes.js
index b66a534c12efdef4e463b7a4801d7dae3fef07a6..0e58f445f284b54c5a253b2e9c523adfc09a3f97 100644
--- a/src/endWeek/saChoosesOwnClothes.js
+++ b/src/endWeek/saChoosesOwnClothes.js
@@ -226,7 +226,7 @@ App.SlaveAssignment.choosesOwnClothes = (function() {
 		} else {
 			if (V.arcologies[0].FSChattelReligionist > 0) {
 				clothing.push({text: `and wears a chattel habit to conform to your arcology's culture.`, clothes: "a chattel habit"});
-			} else if (slave.assignment === "be the Nurse") { /* Chooses clothes according to assignment (no exceptions)*/
+			} else if (slave.assignment === Job.NURSE) { /* Chooses clothes according to assignment (no exceptions)*/
 				if (slave.energy > 95 || slave.need > 100) {
 					wardrobeAssignment.push({text: `and wears a slutty nurse outfit to make it clear just how much this nurse needs ${his} daily lay.`, clothes: "a slutty nurse outfit"});
 				} else if (slave.energy > 80) {
@@ -241,7 +241,7 @@ App.SlaveAssignment.choosesOwnClothes = (function() {
 					}
 					wardrobeAssignment.push({text: `and wears a slutty nurse outfit to show to a little skin as ${he} cares for ${his} patients.`, clothes: "a slutty nurse outfit"});
 				}
-			} else if (slave.assignment === "be the Madam") {
+			} else if (slave.assignment === Job.MADAM) {
 				if (slave.energy > 95 || slave.need > 100) {
 					wardrobeAssignment.push({text: `and wears a slutty suit to be certain nothing blocks ${him} from getting the sex ${he} needs.`, clothes: "slutty business attire"});
 				} else if (slave.energy > 80) {
@@ -256,7 +256,7 @@ App.SlaveAssignment.choosesOwnClothes = (function() {
 					}
 					wardrobeAssignment.push({text: `and wears a slutty suit to entice and arouse while still looking managerial.`, clothes: "slutty business attire"});
 				}
-			} else if (slave.assignment === "be the Milkmaid") {
+			} else if (slave.assignment === Job.MILKMAID) {
 				if (slave.energy > 95 || slave.need > 100) {
 					if (isItemAccessible.entry("body oil") === true) {
 						wardrobeAssignment.push({text: `and coats ${himself} with oil to better slip between ${his} cows as ${he} pleasures them.`, clothes: "body oil"});
@@ -277,7 +277,7 @@ App.SlaveAssignment.choosesOwnClothes = (function() {
 					if (isItemAccessible.entry("stretch pants and a crop-top") === true) {
 						wardrobeAssignment.push({text: `and slips into some comfy stretch pants to relax as ${he} works the cows.`, clothes: "stretch pants and a crop-top"});
 					}
-					if (State.variables.cumSlaves > 2) {
+					if (V.cumSlaves > 2) {
 						wardrobeAssignment.push({text: `and wears a slutty nurse outfit to help keep ${his} charges hard.`, clothes: "a slutty nurse outfit"});
 						wardrobeAssignment.push({text: `and wears nothing but sexy lingerie to help keep ${his} charges hard.`, clothes: "attractive lingerie"});
 						wardrobeAssignment.push({text: `and wears the skimpiest bikini on hand to help keep ${his} charges hard.`, clothes: "a string bikini"});
@@ -286,7 +286,7 @@ App.SlaveAssignment.choosesOwnClothes = (function() {
 						}
 					}
 				}
-			} else if (slave.assignment === "be your Head Girl") {
+			} else if (slave.assignment === Job.HEADGIRL) {
 				if (isItemAccessible.entry("a military uniform") === true) {
 					wardrobeAssignment.push({text: `and wears a military uniform to give ${him} that extra touch of authority.`, clothes: "a military uniform"});
 				}
@@ -308,7 +308,7 @@ App.SlaveAssignment.choosesOwnClothes = (function() {
 				} else {
 					wardrobeAssignment.push({text: `and wears a slutty suit to give ${him} an extra touch of authority while keeping ${his} crotch available.`, clothes: "slutty business attire"});
 				}
-			} else if (slave.assignment === "be the Schoolteacher") {
+			} else if (slave.assignment === Job.TEACHER) {
 				if (isItemAccessible.entry("nice business attire") === true) {
 					wardrobeAssignment.push({text: `and wears a handsome suit to give ${him} that teacherly authority.`, clothes: "nice business attire"});
 				}
@@ -324,7 +324,7 @@ App.SlaveAssignment.choosesOwnClothes = (function() {
 				if (isItemAccessible.entry("a maternity dress") === true && slave.belly >= 10000) {
 					wardrobeAssignment.push({text: `and settles for a comfortable maternity dress to support ${his} middle while ${he} lectures in front of the class all week.`, clothes: "a maternity dress"});
 				}
-			} else if (slave.assignment === "be the Wardeness") {
+			} else if (slave.assignment === Job.WARDEN) {
 				if (isItemAccessible.entry("battledress") === true) {
 					wardrobeAssignment.push({text: `and dons battledress, the better to intimidate the prisoners.`, clothes: "battledress"});
 				}
@@ -355,7 +355,7 @@ App.SlaveAssignment.choosesOwnClothes = (function() {
 					wardrobeAssignment.push({text: `and wears a modest swimsuit, since it's all ${he} can wear that won't be ruined by all the moisture in the spa.`, clothes: "a burkini"});
 				}
 				wardrobeAssignment.push({text: `but decides to go nude, since ${he}'ll be spending so much time in the water.`, clothes: "no clothing"});
-			} else if (slave.assignment === "rest") {
+			} else if (slave.assignment === Job.REST) {
 				wardrobeAssignment.push({text: `and wears a comfortable t-shirt and cutoffs to relax.`, clothes: "cutoffs and a t-shirt"});
 				wardrobeAssignment.push({text: `and slips into some attractive lingerie to enjoy ${himself} as ${he} unwinds.`, clothes: "attractive lingerie"});
 				wardrobeAssignment.push({text: `and slips into nothing more than a pair of panties.`, clothes: "panties"});
@@ -369,7 +369,7 @@ App.SlaveAssignment.choosesOwnClothes = (function() {
 				if (slave.fetish === "submissive") {
 					wardrobeAssignment.push({text: `and decides the best way to relax is tied up nice and tight.`, clothes: "shibari ropes"});
 				}
-			} else if (slave.assignment === "get milked" || slave.assignment === "work in the dairy") {
+			} else if (slave.assignment === Job.MILKED || slave.assignment === Job.DAIRY) {
 				wardrobeAssignment.push({text: `and wears sturdy lingerie to offer the best support to ${his} sore, milk-filled udders.`, clothes: "attractive lingerie"});
 				if (isItemAccessible.entry("attractive lingerie for a pregnant woman") === true && slave.belly >= 1500) {
 					wardrobeAssignment.push({text: `and wears lingerie designed for milky mothers.`, clothes: "attractive lingerie for a pregnant woman"});
@@ -387,7 +387,7 @@ App.SlaveAssignment.choosesOwnClothes = (function() {
 					wardrobeAssignment.push({text: `but goes nude. There's no time for clothing, ${his} udders need to be drained now!`, clothes: "no clothing"});
 				}
 				wardrobeAssignment.push({text: `and dons a slutty outfit. If ${his} breasts are going to hang out, might as well wear something to complement them.`, clothes: "a slutty outfit"});
-			} else if (slave.assignment === "guard you") {
+			} else if (slave.assignment === Job.BODYGUARD) {
 				wardrobeAssignment.push({text: `and wears a bodysuit to show off ${his} curves without hindering ${his} deadliness.`, clothes: "a comfortable bodysuit"});
 				if (isItemAccessible.entry("a military uniform") === true) {
 					wardrobeAssignment.push({text: `and wears a military uniform to look the part of the honor guard.`, clothes: "a military uniform"});
@@ -411,7 +411,7 @@ App.SlaveAssignment.choosesOwnClothes = (function() {
 				}
 			} else {
 				/* Chooses clothes according to assignment (exceptions allowed)*/
-				if (slave.assignment === "recruit girls") {
+				if (slave.assignment === Job.RECRUITER) {
 					if (isItemAccessible.entry("a mini dress") === true) {
 						wardrobeAssignment.push({text: `and wears a flattering mini dress to appear sexy and carefree before those desperately seeking a better life.`, clothes: "a mini dress"});
 					}
@@ -433,7 +433,7 @@ App.SlaveAssignment.choosesOwnClothes = (function() {
 					if (isItemAccessible.entry("conservative clothing") === true) {
 						wardrobeAssignment.push({text: `and wears normal clothing to suggest to those desperately seeking a better life that they can find it here with you.`, clothes: "conservative clothing"});
 					}
-				} else if (slave.assignment === "be the DJ") {
+				} else if (slave.assignment === Job.DJ) {
 					wardrobeAssignment.push({text: `and wears clubslut netting to look like the perfect easy club girl.`, clothes: "clubslut netting"});
 					wardrobeAssignment.push({text: `and wears cutoffs and a t-shirt to look like the perfect easy club girl.`, clothes: "cutoffs and a t-shirt"});
 					wardrobeAssignment.push({text: `and wears the slutty outfit ${he} can find to look like the perfect easy club girl.`, clothes: "a slutty outfit"});
@@ -445,7 +445,7 @@ App.SlaveAssignment.choosesOwnClothes = (function() {
 					if (isItemAccessible.entry("harem gauze") === true) {
 						wardrobeAssignment.push({text: `and wears the finest available silks to give ${his} moves a sensual grace.`, clothes: "harem gauze"});
 					}
-				} else if (slave.assignment === "be your Concubine") {
+				} else if (slave.assignment === Job.CONCUBINE) {
 					wardrobeAssignment.push({text: `and goes naked, since it's ${his} honored role to be the chief object of your desire.`, clothes: "no clothing"});
 					wardrobeAssignment.push({text: `and dresses as a slutty nurse as your genitals are always in need of ${his} special treatment.`, clothes: "a slutty nurse outfit"});
 					wardrobeAssignment.push({text: `and dresses as a schoolgirl in the hopes that you teach ${him} how to be a woman.`, clothes: "a schoolgirl outfit"});
@@ -460,7 +460,7 @@ App.SlaveAssignment.choosesOwnClothes = (function() {
 					if (slave.toyHole === "dick" && canPenetrate(slave)) {
 						wardrobeAssignment.push({text: `and slips into a scalemail bikini so ${he} can act the role of your conqueror as ${he} bends you over.`, clothes: "a scalemail bikini"});
 					}
-				} else if (slave.assignment === "be a subordinate slave") {
+				} else if (slave.assignment === Job.SUBORDINATE) {
 					wardrobeAssignment.push({text: `but gives up and goes naked after the other slaves constantly tear whatever ${he}'s wearing off ${him}.`, clothes: "no clothing"});
 					if (isItemAccessible.entry("Western clothing") === true) {
 						wardrobeAssignment.push({text: `and chooses a pair of crotchless chaps so your other slaves don't have to waste time undressing ${him}.`, clothes: "Western clothing"});
@@ -470,15 +470,15 @@ App.SlaveAssignment.choosesOwnClothes = (function() {
 						wardrobeAssignment.push({text: `and chooses to slip on a schoolgirl outfit in the hope that ${he} gets held down and raped.`, clothes: "a schoolgirl outfit"});
 						wardrobeAssignment.push({text: `and chooses to wear the sluttiest outfit available to make it clear what ${he} wants done to ${him}.`, clothes: "a slutty outfit"});
 					}
-				} else if (slave.assignment === "work a glory hole") {
+				} else if (slave.assignment === Job.GLORYHOLE) {
 					wardrobeAssignment.push({text: `but doesn't bother wearing anything, since no one can see ${his} clothing when ${he}'s immured inside a glory hole.`, clothes: "no clothing"});
-				} else if (slave.assignment === "take classes" || slave.assignment === "learn in the schoolroom") {
+				} else if (slave.assignment === Job.CLASSES || slave.assignment === Job.SCHOOL) {
 					wardrobeAssignment.push({text: `and wears a schoolgirl outfit, since it seems most appropriate.`, clothes: "a schoolgirl outfit"});
 					wardrobeAssignment.push({text: `and wears a cheerleader outfit, since ${he} might as well be one of the popular girls.`, clothes: "a cheerleader outfit"});
 					if (isItemAccessible.entry("conservative clothing") === true) {
 						wardrobeAssignment.push({text: `and wears normal clothing to not distract from ${his} lessons.`, clothes: "conservative clothing"});
 					}
-				} else if ((slave.assignment === "whore") || (slave.assignment === "work in the brothel")) {
+				} else if ((slave.assignment === Job.WHORE) || (slave.assignment === Job.BROTHEL)) {
 					if (slave.belly >= 5000 && isItemAccessible.entry("attractive lingerie for a pregnant woman") === true) {
 						wardrobeAssignment.push({text: `and wears pretty lingerie to show off ${his} merchandise and accentuate ${his} pregnancy while still looking a little classy.`, clothes: "attractive lingerie for a pregnant woman"});
 					}
@@ -499,7 +499,7 @@ App.SlaveAssignment.choosesOwnClothes = (function() {
 					if (isItemAccessible.entry("a mini dress") === true) {
 						wardrobeAssignment.push({text: `and wears a flattering mini dress to really strut ${his} stuff.`, clothes: "a mini dress"});
 					}
-				} else if (slave.assignment === "serve the public" || slave.assignment === "serve in the club") {
+				} else if (slave.assignment === Job.PUBLIC || slave.assignment === Job.CLUB) {
 					wardrobeAssignment.push({text: `and wears string lingerie to look fun and fuckable.`, clothes: "a string bikini"});
 					wardrobeAssignment.push({text: `and throws together the sluttiest outfit since if you're going to slut you might as well go all out.`, clothes: "a slutty outfit"});
 					wardrobeAssignment.push({text: `and tosses on a slutty suit that screams ${he} needs a good fuck after a long day.`, clothes: "slutty business attire"});
@@ -512,7 +512,7 @@ App.SlaveAssignment.choosesOwnClothes = (function() {
 					if (slave.bellyPreg >= 10000) {
 						wardrobeAssignment.push({text: `and struggles into a schoolgirl outfit. ${His} gravid belly just screams that ${he} is a slutty little student who cares more for dick than lessons.`, clothes: "a succubus outfit"});
 					}
-				} else if (slave.assignment === "be a servant" || slave.assignment === "work as a servant") {
+				} else if (slave.assignment === Job.HOUSE || slave.assignment === Job.QUARTER) {
 					if (slave.energy > 95 || slave.need > 100) {
 						wardrobeAssignment.push({text: `and wears a skimpy maid outfit hoping that someone sneaks up behind ${him} as ${he} works and fulfills ${his} desires.`, clothes: "a slutty maid outfit"});
 						wardrobeAssignment.push({text: `and wears nothing more than an apron in the hopes that someone sneaks up behind ${him} as ${he} works and fulfills ${his} desires.`, clothes: "an apron"});
diff --git a/src/endWeek/saDrugs.js b/src/endWeek/saDrugs.js
index 4dd9ee17e127ed2d2b6af0f3305f04d55150d4c3..6aa5ee98dba3bc43657e32711d935428dc0b5613 100644
--- a/src/endWeek/saDrugs.js
+++ b/src/endWeek/saDrugs.js
@@ -1524,9 +1524,9 @@ App.SlaveAssignment.drugs = (function() {
 				slave.butt = Math.clamp(slave.butt, 0, 20);
 				break;
 			case "sag-B-gone":
-				if (slave.assignment === "be your concubine") {
+				if (slave.assignment === Job.CONCUBINE) {
 					r += ` Before bed and when you awake, you take the time sensually <span class="coral">massage sag-B-gone into ${his} breasts,</span> which, while enjoyable to the both of you, doesn't seem to be doing much.`;
-				} else if (slave.assignment === "please you") {
+				} else if (slave.assignment === Job.FUCKTOY) {
 					r += ` Whenever you have a free moment you take that time to <span class="coral">massage sag-B-gone into ${his} breasts,</span> which, while enjoyable, doesn't seem to be doing much.`;
 				} else {
 					r += ` ${He} is required to frequently <span class="coral">massage sag-B-gone into ${his} breasts,</span> which, while enjoyable to watch, doesn't seem to be doing much.`;
@@ -1568,7 +1568,7 @@ App.SlaveAssignment.drugs = (function() {
 				break;
 			case "speed up":
 				slave.chem += 2;
-				if ((slave.assignment !== "get treatment in the clinic" || V.Nurse === 0) && slave.geneMods.rapidCellGrowth !== 1) {
+				if ((slave.assignment !== Job.CLINIC || V.Nurse === 0) && slave.geneMods.rapidCellGrowth !== 1) {
 					r += ` ${His} `;
 					if (slave.pregType > 1) {
 						r += `children are`;
@@ -1655,7 +1655,7 @@ App.SlaveAssignment.drugs = (function() {
 		if ((slave.health.condition > 90)) {
 			r += ` ${His} health is already outstanding and cannot be improved with further drug treatment. <span class="yellow">${His} drug regimen has defaulted to preventatives.</span>`;
 			slave.curatives = 1;
-		} else if ((slave.assignment === "rest" || slave.assignment === "rest in the spa") && (slave.fetish !== "mindbroken")) {
+		} else if ((slave.assignment === Job.REST || slave.assignment === Job.SPA) && (slave.fetish !== "mindbroken")) {
 			if (slave.inflationType !== "curative" || slave.inflation === 0) {
 				r += ` The curatives ${he}'s taking synergize with rest, keeping ${him} asleep most of the time. This is an <span class="green">extremely effective health treatment.</span>`;
 			} else {
@@ -1722,7 +1722,7 @@ App.SlaveAssignment.drugs = (function() {
 	function healthAndWellness(slave) {
 		slave.chem = Math.clamp(slave.chem-0.5, 0, 1000);
 		// illness
-		if (slave.curatives < 2 && slave.inflationType !== "curative" && slave.assignment !== "rest in the spa" && slave.assignment !== "rest" && slave.assignment !== "get treatment in the clinic") {
+		if (slave.curatives < 2 && slave.inflationType !== "curative" && slave.assignment !== Job.SPA && slave.assignment !== Job.REST && slave.assignment !== Job.CLINIC) {
 			if (slave.health.illness > 0) {
 				r += ` ${He} is `;
 				if (slave.health.illness > 4) {
@@ -1770,7 +1770,7 @@ App.SlaveAssignment.drugs = (function() {
 		illness(slave);
 		// tiredness
 		if (slave.drugs !== "stimulants" && slave.inflationType !== "stimulant") {
-			if (slave.assignment !== "rest in the spa" && slave.assignment !== "rest" && slave.assignment !== "get treatment in the clinic") {
+			if (slave.assignment !== Job.SPA && slave.assignment !== Job.REST && slave.assignment !== Job.CLINIC) {
 				if (slave.health.tired > 90) {
 					r += ` ${He} has been worked to the bone`;
 					if (slave.devotion < 20) {
diff --git a/src/endWeek/saGetMilked.js b/src/endWeek/saGetMilked.js
index e51c79bacb419a1bf98c20cab7228c430a4b2a33..010c5a1764216d726bcacacf5e4d52ab2d522287 100644
--- a/src/endWeek/saGetMilked.js
+++ b/src/endWeek/saGetMilked.js
@@ -53,7 +53,7 @@ App.SlaveAssignment.getMilked = (function() {
 			}
 		}
 		// Limits penthouse milkers to milk only.
-		if (["be confined in the arcade", "get milked", "work in the dairy"].includes(slave.assignment) || preview) {
+		if ([Job.ARCADE, Job.MILKED, Job.DAIRY].includes(slave.assignment) || preview) {
 			if (slave.balls > 0) {
 				cash += cumStatistics(slave, preview);
 				if (!preview) {
@@ -235,7 +235,7 @@ App.SlaveAssignment.getMilked = (function() {
 		}
 
 		if (slave.lactationAdaptation < 100) {
-			if (slave.assignment === "get milked" || slave.assignment === "work in the dairy") {
+			if (slave.assignment === Job.MILKED || slave.assignment === Job.DAIRY) {
 				r += ` Living as a cow helps ${his} body and mind adapt to producing milk.`;
 				slave.lactationAdaptation += 1;
 			}
@@ -319,7 +319,7 @@ App.SlaveAssignment.getMilked = (function() {
 			}
 		}
 
-		if (slave.assignment === "work in the dairy") {
+		if (slave.assignment === Job.DAIRY) {
 			if (V.dairyFeedersUpgrade === 1) {
 				if (V.dairyFeedersSetting > 0) {
 					milk += (milk * (0.1 * (V.dairyFeedersUpgrade + V.dairyRestraintsSetting + ((50 - slave.physicalAge) / 20))));
@@ -330,7 +330,7 @@ App.SlaveAssignment.getMilked = (function() {
 					}
 				}
 			}
-		} else if (slave.assignment === "be confined in the arcade") {
+		} else if (slave.assignment === Job.ARCADE) {
 			milk *= 0.5;
 		}
 
@@ -590,7 +590,7 @@ App.SlaveAssignment.getMilked = (function() {
 		}
 
 		/* Dairy rework cum half here */
-		if (slave.assignment === "work in the dairy") {
+		if (slave.assignment === Job.DAIRY) {
 			if (V.dairyStimulatorsUpgrade !== 1) {
 				if (V.Milkmaid !== 0) {
 					if (V.Milkmaid.dick > 4 && canAchieveErection(V.Milkmaid)) {
@@ -622,7 +622,7 @@ App.SlaveAssignment.getMilked = (function() {
 		cum = cumAmount(slave);
 
 		/* Dairy rework cum half here */
-		if (slave.assignment === "work in the dairy") {
+		if (slave.assignment === Job.DAIRY) {
 			if (V.dairyStimulatorsUpgrade === 1) {
 				if (V.dairyStimulatorsSetting > 0) {
 					cum += (cum * (0.2 * (V.dairyStimulatorsSetting + V.dairyRestraintsSetting + Math.trunc((50 - slave.physicalAge) / 20))));
@@ -637,7 +637,7 @@ App.SlaveAssignment.getMilked = (function() {
 					cum *= 1.2;
 				}
 			}
-		} else if (slave.assignment === "be confined in the arcade") {
+		} else if (slave.assignment === Job.ARCADE) {
 			cum *= 0.5;
 		}
 
diff --git a/src/endWeek/saGuardYou.js b/src/endWeek/saGuardYou.js
index 441ecc3959058cb6daf2ff618a9cfb45cca86882..d9b27f36408397154a118fee3d625dcf7d1f9e67 100644
--- a/src/endWeek/saGuardYou.js
+++ b/src/endWeek/saGuardYou.js
@@ -258,7 +258,7 @@ App.SlaveAssignment.guardYou = (function() {
 	 */
 	function trainReplacements(slave) {
 		if (slave.devotion > 95 && slave.trust > 50 && slave.skill.combat > 0 && slave.intelligence + slave.intelligenceImplant > 15) {
-			successorCandidates = V.slaves.filter(function(s) { return (assignmentVisible(s) || s.assignment === "be your Concubine" || s.assignment === "be the Wardeness" || s.assignment === "be your Head Girl" || s.assignment === "work as a servant" || s.assignment === "serve in the master suite") && bodyguardSuccessorEligible(s); });
+			successorCandidates = V.slaves.filter(function(s) { return (assignmentVisible(s) || s.assignment === Job.CONCUBINE || s.assignment === Job.WARDEN || s.assignment === Job.HEADGIRL || s.assignment === Job.QUARTER || s.assignment === Job.MASTERSUITE) && bodyguardSuccessorEligible(s); });
 			combatSkilled = successorCandidates.filter(function(s) {  return s.skill.combat > 0; });
 
 			r.push(`${He}'s confident in ${his} martial skills, but smart enough to know that ${he} isn't immortal, and devoted enough to worry about who will protect you should ${he} die.`);
diff --git a/src/endWeek/saInflation.js b/src/endWeek/saInflation.js
index 948363c7cba943e0c145ba2fd3bc98d700195d00..780937d0670cf0dcd3cfdfa2c5018a7c3c4c3d38 100644
--- a/src/endWeek/saInflation.js
+++ b/src/endWeek/saInflation.js
@@ -26,7 +26,7 @@ App.SlaveAssignment.inflation = (function() {
 		gigantomastiaMod = slave.geneticQuirks.gigantomastia === 2 ? (slave.geneticQuirks.macromastia === 2 ? 3 : 2) : 1;
 		rearLipedemaMod = slave.geneticQuirks.rearLipedema === 2 ? 2 : 0;
 		rearLipedemaDivider = rearLipedemaMod === 0 ? 1 : rearLipedemaMod;
-		dairyL = V.DairyiIDs.length;
+		dairyL = App.Entity.facilities.dairy.employeesIDs().size;
 		dupeTextFlag = 0;
 
 		if (slave.inflationMethod === 3) {
@@ -60,9 +60,9 @@ App.SlaveAssignment.inflation = (function() {
 	 *
 	 */
 	function inflationCancellation(slave) {
-		if (slave.assignment === "be confined in the arcade" || slave.assignment === "work in the dairy") {
+		if (slave.assignment === Job.ARCADE || slave.assignment === Job.DAIRY) {
 			slave.inflation = 0, slave.inflationType = "none", slave.inflationMethod = 0, slave.milkSource = 0, SetBellySize(slave);
-		} else if (slave.inflationType === "milk" && (slave.inflationMethod === 1 || slave.inflationMethod === 2) && (dairyL === 0 || V.dairy === 0) && V.arcologies[0].FSPastoralistLaw !== 1 && (slave.assignment !== "be confined in the cellblock" || V.cellblockDecoration !== "Pastoralist")) {
+		} else if (slave.inflationType === "milk" && (slave.inflationMethod === 1 || slave.inflationMethod === 2) && (dairyL === 0 || V.dairy === 0) && V.arcologies[0].FSPastoralistLaw !== 1 && (slave.assignment !== Job.CELLBLOCK || V.cellblockDecoration !== "Pastoralist")) {
 			r.push(`You no longer have a functional dairy. <span class="yellow">${His} inflation regimen has been ended.</span>`);
 			slave.inflation = 0;
 			slave.inflationType = "none";
@@ -204,7 +204,7 @@ App.SlaveAssignment.inflation = (function() {
 				r.push(`${He} makes sure to fill ${his} rear with nearly`);
 				if (slave.inflation === 3) {
 					r.push(`two gallons of a curative solution, leaving ${him} looking ready to burst, whenever ${he} leaks or ${his} body absorbs too much. ${He} keeps ${himself} full for you; the curatives in ${his} gut keeping ${him} healthy despite the pain.`);
-					if ((slave.assignment === "rest" || slave.assignment === "rest in the spa") && slave.fetish !== "mindbroken") {
+					if ((slave.assignment === Job.REST || slave.assignment === Job.SPA) && slave.fetish !== "mindbroken") {
 						r.push(`The curative enema ${he}'s on synergize with rest, keeping ${him} asleep most of the time. This is an <span class="green">extremely effective health treatment,</span> though being filled to ${his} limit doesn't hasten ${his} recovery at all; it's just perverted.`);
 						improveCondition(slave, 4);
 					} else if (slave.health.condition < -20) {
@@ -216,7 +216,7 @@ App.SlaveAssignment.inflation = (function() {
 					improveCondition(slave, 1);
 				} else if (slave.inflation === 2) {
 					r.push(`four liters of a curative solution, leaving ${him} looking pregnant, whenever ${he} leaks or ${his} body absorbs too much. ${He} is full enough to be distended but not enough to grow taut.`);
-					if ((slave.assignment === "rest" || slave.assignment === "rest in the spa") && slave.fetish !== "mindbroken") {
+					if ((slave.assignment === Job.REST || slave.assignment === Job.SPA) && slave.fetish !== "mindbroken") {
 						r.push(`The curative enema ${he}'s on synergize with rest, keeping ${him} asleep most of the time. This is an <span class="green">extremely effective health treatment,</span> though being overfilled doesn't hasten ${his} recovery at all; it's just perverted.`);
 						improveCondition(slave, 4);
 					} else if (slave.health.condition < -20) {
@@ -228,7 +228,7 @@ App.SlaveAssignment.inflation = (function() {
 					improveCondition(slave, 6);
 				} else if (slave.inflation === 1) {
 					r.push(`two liters of a curative solution, leaving ${his} belly noticeably distended, whenever ${he} leaks or ${his} body absorbs too much. ${He} is full enough to be swollen but not enough to visibly jiggle.`);
-					if ((slave.assignment === "rest" || slave.assignment === "rest in the spa") && slave.fetish !== "mindbroken") {
+					if ((slave.assignment === Job.REST || slave.assignment === Job.SPA) && slave.fetish !== "mindbroken") {
 						r.push(`The curative enema ${he}'s on synergize with rest, keeping ${him} asleep most of the time. This is an <span class="green">extremely effective health treatment.</span>`);
 						improveCondition(slave, 4);
 					} else if (slave.health.condition < -20) {
@@ -311,7 +311,7 @@ App.SlaveAssignment.inflation = (function() {
 						}
 						r.push(`with the treatment counteracting their efforts. <span class="yellow">${His} tightening enema regimen has been ended.</span>`);
 						slave.inflation = 0, slave.inflationType = "none", slave.inflationMethod = 0, SetBellySize(slave);
-					} else if (["serve in the club", "work in the brothel"].includes(slave.assignment)) {
+					} else if ([Job.CLUB, Job.BROTHEL].includes(slave.assignment)) {
 						if (slave.vagina >= 0) {
 							r.push(`them,`);
 						} else {
diff --git a/src/endWeek/saPleaseYou.js b/src/endWeek/saPleaseYou.js
index 1b98084e2b4f1514932765d25e820a22065b0bef..98a34f8ac6690af924778a27079524a67e8ec1ba 100644
--- a/src/endWeek/saPleaseYou.js
+++ b/src/endWeek/saPleaseYou.js
@@ -118,7 +118,7 @@ App.SlaveAssignment.pleaseYou = (function() {
 		} else {
 			vaginalUse = jsRandom(3, 7);
 		}
-		if (slave.assignment === "please you") {
+		if (slave.assignment === Job.FUCKTOY) {
 			vaginalUse = Math.ceil(vaginalUse * restEffects(slave, 11));
 		} else {
 			vaginalUse = Math.ceil(vaginalUse * healthPenalty(slave));
@@ -277,7 +277,7 @@ App.SlaveAssignment.pleaseYou = (function() {
 		} else {
 			analUse = jsRandom(3, 7);
 		}
-		if (slave.assignment === "please you") {
+		if (slave.assignment === Job.FUCKTOY) {
 			analUse = Math.ceil(analUse * restEffects(slave, 11));
 		} else {
 			analUse = Math.ceil(analUse * healthPenalty(slave));
@@ -430,7 +430,7 @@ App.SlaveAssignment.pleaseYou = (function() {
 		} else {
 			oralUse = jsRandom(3, 7);
 		}
-		if (slave.assignment === "please you") {
+		if (slave.assignment === Job.FUCKTOY) {
 			oralUse = Math.ceil(oralUse * restEffects(slave, 11));
 		} else {
 			oralUse = Math.ceil(oralUse * healthPenalty(slave));
@@ -681,7 +681,7 @@ App.SlaveAssignment.pleaseYou = (function() {
 		} else {
 			mammaryUse = jsRandom(3, 7);
 		}
-		if (slave.assignment === "please you") {
+		if (slave.assignment === Job.FUCKTOY) {
 			mammaryUse = Math.ceil(mammaryUse * restEffects(slave, 11));
 		} else {
 			mammaryUse = Math.ceil(mammaryUse * healthPenalty(slave));
@@ -901,7 +901,7 @@ App.SlaveAssignment.pleaseYou = (function() {
 		} else {
 			penetrativeUse = jsRandom(3, 7);
 		}
-		if (slave.assignment === "please you") {
+		if (slave.assignment === Job.FUCKTOY) {
 			penetrativeUse = Math.ceil(penetrativeUse * restEffects(slave, 11));
 		} else {
 			penetrativeUse = Math.ceil(penetrativeUse * healthPenalty(slave));
@@ -1385,7 +1385,7 @@ App.SlaveAssignment.pleaseYou = (function() {
 		} else {
 			acts = jsRandom(3, 7);
 		}
-		if (slave.assignment === "please you") {
+		if (slave.assignment === Job.FUCKTOY) {
 			acts = Math.ceil(acts * restEffects(slave, 11));
 		} else {
 			acts = Math.ceil(acts * healthPenalty(slave));
@@ -1493,10 +1493,10 @@ App.SlaveAssignment.pleaseYou = (function() {
 			r.push(`Under your personal supervision, <span class="green">${his} health improves.</span>`);
 			improveCondition(slave, 10);
 		}
-		if (slave.assignment === "serve in the master suite") {
+		if (slave.assignment === Job.MASTERSUITE) {
 			r.push(`${He} has plenty of time to rest during the day to recover from your physically demanding visits, even though ${he} sometimes has to work long nights.`);
 			tired(slave);
-		} else if (slave.assignment === "please you") {
+		} else if (slave.assignment === Job.FUCKTOY) {
 			if (slaveResting(slave)) {
 				r.push(`${He} spends reduced hours serving you in order to <span class="green">offset ${his} lack of rest.</span>`);
 			} else if (slave.health.tired + 11 >= 90 && !willWorkToDeath(slave)) {
@@ -1618,7 +1618,7 @@ App.SlaveAssignment.pleaseYou = (function() {
 			r.push(`Keeping your own ${daughter} as a personal fucktoy leaves quite a public impression.`);
 		} else if (slave.father > 0 && slave.mother !== slave.father) {
 			spy = V.slaveIndices[slave.father];
-			if ((spy !== undefined) && (V.slaves[spy].assignment === "please you" || V.slaves[spy].assignment === "serve in the master suite" || V.slaves[spy].assignment === "be your Concubine")) {
+			if ((spy !== undefined) && (V.slaves[spy].assignment === Job.FUCKTOY || V.slaves[spy].assignment === Job.MASTERSUITE || V.slaves[spy].assignment === Job.CONCUBINE)) {
 				r.push(`Since you are also keeping ${his} father as a sexual servant, you often use them together, which leaves quite a public impression.`);
 			}
 		}
@@ -1627,12 +1627,12 @@ App.SlaveAssignment.pleaseYou = (function() {
 			r.push(`Keeping your own ${daughter} as a personal fucktoy leaves quite a public impression.`);
 		} else if (slave.mother > 0) {
 			spy = V.slaveIndices[slave.mother];
-			if ((spy !== undefined) && (V.slaves[spy].assignment === "please you" || V.slaves[spy].assignment === "serve in the master suite" || V.slaves[spy].assignment === "be your Concubine")) {
+			if ((spy !== undefined) && (V.slaves[spy].assignment === Job.FUCKTOY || V.slaves[spy].assignment === Job.MASTERSUITE || V.slaves[spy].assignment === Job.CONCUBINE)) {
 				r.push(`Since you are also keeping ${his} mother as a sexual servant, you often use them together, which leaves quite a public impression.`);
 			}
 		}
 
-		children = V.slaves.filter(function(s) { return (s.father === slave.ID || s.mother === slave.ID) && (s.assignment === "please you" || s.assignment === "serve in the master suite" || s.assignment === "be your Concubine"); });
+		children = V.slaves.filter(function(s) { return (s.father === slave.ID || s.mother === slave.ID) && (s.assignment === Job.FUCKTOY || s.assignment === Job.MASTERSUITE || s.assignment === Job.CONCUBINE); });
 		if (children.length > 2) {
 			r.push(`Since you are also keeping ${his} daughters,`);
 			for (spy = 0; spy < children.length; spy++) {
@@ -1650,7 +1650,7 @@ App.SlaveAssignment.pleaseYou = (function() {
 			r.push(`Since you are also keeping ${his} ${childPronouns.daughter} as a sexual servant, you often use them together, which leaves quite a public impression.`);
 		}
 
-		children = V.slaves.filter(function(s) { return (areSisters(slave, s) > 0) && (s.assignment === "please you" || s.assignment === "serve in the master suite" || s.assignment === "be your Concubine"); });
+		children = V.slaves.filter(function(s) { return (areSisters(slave, s) > 0) && (s.assignment === Job.FUCKTOY || s.assignment === Job.MASTERSUITE || s.assignment === Job.CONCUBINE); });
 		if (children.length > 2) {
 			r.push(`Since you are also keeping ${his} sisters,`);
 			for (spy = 0; spy < children.length; spy++) {
diff --git a/src/endWeek/saRules_old.js b/src/endWeek/saRules_old.js
index a4573589196abd02015be0003d33cf813c8a9b01..43d0f3b6308d8838f8a0aa052217f6b37240ba86 100644
--- a/src/endWeek/saRules_old.js
+++ b/src/endWeek/saRules_old.js
@@ -34,14 +34,14 @@
 					rewards = 3;
 
 				switch (slave.assignment) {
-					case "be the Nurse":
-					case "get treatment in the clinic":
-					case "be the Wardeness":
-					case "be confined in the cellblock":
-					case "be the Attendant":
-					case "rest in the spa":
-					case "be the Matron":
-					case "work as a nanny":
+					case Job.NURSE:
+					case Job.CLINIC:
+					case Job.WARDEN:
+					case Job.CELLBLOCK:
+					case Job.ATTENDANT:
+					case Job.SPA:
+					case Job.MATRON:
+					case Job.NURSERY:
 						// TODO: this will all need to be rewritten
 						if (slave.devotion < -50) {
 							r += `is so unhappy that ${he} has little interest in getting off. `;
@@ -292,14 +292,14 @@
 						if (!V.universalRulesConsent) {
 							if (slave.devotion <= 20) {
 								if (slave.trust > -10) {
-									if (V.NurseryiIDs.length > 2) {
+									if (App.Entity.facilities.nursery.employeesIDs().size > 2) {
 										r += `Under the rules, ${he} finds ${himself} constantly molested by other slaves, and lives ${his} life constantly <span class="gold">afraid. </span>`;
 									} else {
 										r += `Under the rules, ${he} is free game for other slaves to molest, and lives ${his} life constantly <span class="gold">afraid</span> of the day another slave grabs ${him} from under the water. `;
 									}
 									slave.trust -= 2;
 								} else {
-									if (V.NurseryiIDs.length > 2) {
+									if (App.Entity.facilities.nursery.employeesIDs().size > 2) {
 										r += `Under the rules, ${he} finds ${himself} constantly molested by other slaves, but ${he}'s already in such constant terror it doesn't seriously affect ${him}. `;
 									} else {
 										r += `Under the rules, ${he} will someday find ${himself} constantly molested by other slaves, but ${he}'s already in such constant terror it that it doesn't cross ${his} mind. `;
@@ -307,20 +307,20 @@
 								}
 							} else if (release.slaves === 1) {
 								if (slave.energy > 95) {
-									if (V.NurseryiIDs.length > 2) {
+									if (App.Entity.facilities.nursery.employeesIDs().size > 2) {
 										r += `Under the rules, ${he}'s allowed to demand that other slaves get ${him} off, and ${he} <span class="hotpink">adores</span> you for providing plentiful outlets for ${his} nymphomania. `;
 									} else {
 										r += `Under the rules, ${he}'s allowed to demand that other slaves get ${him} off, and ${he} <span class="hotpink">eagerly awaits</span> the day ${V.Matron ? `more of your slaves join ${him} in ${V.nurseryName} ` : `you assign more nurses to ${V.nurseryName} to help ${him} relieve ${his} ${slave.balls ? `swollen balls` : `tension`}`}. `;	// TODO:
 									}
 								} else if (slave.fetishKnown && slave.fetishStrength > 60) {
 									if (slave.fetish === "sadist") {
-										if (V.NurseryiIDs.length > 2) {
+										if (App.Entity.facilities.nursery.employeesIDs().sizeh > 2) {
 											r += `Under the rules, ${he}'s allowed to sexually abuse other slaves, and ${he} <span class="hotpink">adores</span> you for providing a whole nursery of slaves for ${him} to rape. `;
 										} else {
 											r += `Under the rules, ${he}'s allowed to sexually abuse other slaves, and ${he} <span class="hotpink">eagerly awaits</span> the day ${V.Matron ? `more of your slaves join ${him} in ${V.nurseryName}` : `you assign more nurses to ${V.nurseryName} to help ${him} unwind`}. `;
 										}
 									} else if (slave.fetish === "dom") {
-										if (V.NurseryiIDs.length > 2) {
+										if (App.Entity.facilities.nursery.employeesIDs().size > 2) {
 											r += `Under the rules, ${he}'s allowed to force other slaves to have sex with ${him}, and ${he} <span class="hotpink">adores</span> you for providing a whole nursery of slaves for ${him} to dominate. `;
 										} else {
 											r += `Under the rules, ${he}'s allowed to force other slaves to have sex with ${him}, and ${he} <span class="hotpink">eagerly awaits</span> the day ${V.Matron ? `more of your slaves join ${him} in ${V.nurseryName}` : `you assign more nurses to ${V.nurseryName} to help ${him} unwind`}. `;
@@ -331,7 +331,7 @@
 							}
 						} else {
 							if (slave.devotion <= 20 && slave.devotion > -20) {
-								if (V.NurseryiIDs.length > 2) {
+								if (App.Entity.facilities.nursery.employeesIDs().size > 2) {
 									r += `Since ${he}'s low in the slave hierarchy, <span class="mediumaquamarine">${he} knows</span> that the rule that slaves must get consent before having sex with ${him} are all that protect ${him} from abuse. `;
 								} else {
 									r += `Since ${he}'s low in the slave hierarchy, <span class="mediumaquamarine">${he} knows</span> that the rule that slaves must get consent before having sex with ${him} are all that protect ${him} from abuse. Well, that and the fact ${V.nurseryName} is ${V.Matron ? `mostly frequented by other slaveowners' stock` : `${his} little private sanctuary`}. `;
diff --git a/src/endWeek/saServeThePublic.js b/src/endWeek/saServeThePublic.js
index 8c75e23aa9c69e35b9334c36fd8b7942afea72dc..15ea4fbff2fa729b86661c7a2d99c835b24ca9c6 100644
--- a/src/endWeek/saServeThePublic.js
+++ b/src/endWeek/saServeThePublic.js
@@ -31,7 +31,7 @@ App.SlaveAssignment.serveThePublic = (function() {
 		} = getPronouns(slave));
 
 		gatherStatistics(slave);
-		if (slave.assignment === "serve in the club") {
+		if (slave.assignment === Job.CLUB) {
 			// By being at the end, every slave after the first will get a bonus. By moving it up, the first can enjoy it too. slaveJobValues() checks Edo Revivalist, so here we are.
 			applyFSDecoration(slave);
 		}
@@ -98,8 +98,8 @@ App.SlaveAssignment.serveThePublic = (function() {
 	 */
 	function bonusMultiplierText(slave) {
 		if (V.club > 0) {
-			if ((V.universalRulesFacilityWork === 1 && slave.assignment === "serve the public" && V.clubSpots > 0) || (slave.assignment === "serve in the club")) {
-				if (slave.assignment === "serve the public") {
+			if ((V.universalRulesFacilityWork === 1 && slave.assignment === Job.PUBLIC && V.clubSpots > 0) || (slave.assignment === Job.CLUB)) {
+				if (slave.assignment === Job.PUBLIC) {
 					r += ` Since there's extra space in ${V.clubName}, ${he}'s promiscuous there.`;
 				}
 				// ads
@@ -146,7 +146,7 @@ App.SlaveAssignment.serveThePublic = (function() {
 				if (V.DJ !== 0) {
 					const DJpronouns = getPronouns(V.DJ);
 					if (V.DJRepBonus > 0) {
-						if (slave.assignment === "serve the public") {
+						if (slave.assignment === Job.PUBLIC) {
 							r += ` Working`;
 						} else {
 							r += ` Living and working`;
@@ -274,7 +274,7 @@ App.SlaveAssignment.serveThePublic = (function() {
 			r += ` ${slave.slaveName} <span class="trust inc">trusts your judgment</span> in assigning ${him} a job that affords ${him} a chance to tease and flirt.`;
 			slave.trust += 1;
 		}
-		if (slave.assignment === "serve in the club" && slave.devotion > 50) {
+		if (slave.assignment === Job.CLUB && slave.devotion > 50) {
 			r += ` Being so far from your presence <span class="mediumorchid">weakens ${his} intense devotion to you.</span>`;
 		}
 	}
@@ -307,7 +307,7 @@ App.SlaveAssignment.serveThePublic = (function() {
 			}
 			r += `,</span> hindering ${his} ability to attract and please citizens.`;
 		}
-		if (slave.assignment === "serve in the club") {
+		if (slave.assignment === Job.CLUB) {
 			if (slaveResting(slave)) {
 				r += ` ${He} spends reduced hours working the floor in ${V.clubName} in order to <span class="green">offset ${his} lack of rest.</span>`;
 			} else if (slave.health.tired + 15 >= 90 && !willWorkToDeath(slave)) {
@@ -330,7 +330,7 @@ App.SlaveAssignment.serveThePublic = (function() {
 				r += `so ${he} ends ${his} shifts <span class="red">eager for sleep.</span>`;
 			}
 			tired(slave);
-		} else if (slave.assignment === "serve the public") {
+		} else if (slave.assignment === Job.PUBLIC) {
 			if (slaveResting(slave)) {
 				r += ` ${He} spends reduced hours serving in order to <span class="green">offset ${his} lack of rest.</span>`;
 			} else if (slave.health.tired + 15 >= 90 && !willWorkToDeath(slave)) {
@@ -349,7 +349,7 @@ App.SlaveAssignment.serveThePublic = (function() {
 			tired(slave);
 		}
 
-		if (slave.assignment !== "serve in the club") {
+		if (slave.assignment !== Job.CLUB) {
 			if (slave.curatives > 0 || slave.inflationType === "curative") {
 				r += ` The drugs `;
 				if (slave.inflationType === "curative") {
@@ -1237,15 +1237,15 @@ App.SlaveAssignment.serveThePublic = (function() {
 	 *
 	 */
 	function addRep(slave) {
-		if (slave.assignment !== "recruit girls") {
-			if (slave.assignment === "be the DJ") {
+		if (slave.assignment !== Job.RECRUITER) {
+			if (slave.assignment === Job.DJ) {
 				repX(Math.trunc((slave.sexAmount * slave.sexQuality) * (1 + (0.003 * slave.skill.entertainment)) * 0.15), "publicServant", slave);
 				// DJ bonus rep
 				repX(Math.trunc((slave.sexAmount * slave.sexQuality) * (1 + (0.003 * slave.skill.entertainment)) * 0.15), "publicServantClub", slave);
 				T.incomeStats.income += Math.trunc((slave.sexAmount * slave.sexQuality) * (1 + (0.003 * slave.skill.entertainment)) * 0.15);
-			} else if (slave.assignment === "serve in the club") {
+			} else if (slave.assignment === Job.CLUB) {
 				repX(Math.trunc((slave.sexAmount * slave.sexQuality) * (1 + (0.003 * slave.skill.entertainment)) * 0.15), "publicServantClub", slave);
-			} else if (slave.assignment === "serve the public") {
+			} else if (slave.assignment === Job.PUBLIC) {
 				repX(Math.trunc((slave.sexAmount * slave.sexQuality) * (1 + (0.003 * slave.skill.entertainment)) * 0.15), "publicServant", slave);
 			} else {
 				repX(Math.trunc((slave.sexAmount * slave.sexQuality) * (1 + (0.003 * slave.skill.entertainment)) * 0.15), "serving the public in an unregistered building", slave);
diff --git a/src/endWeek/saStayConfined.js b/src/endWeek/saStayConfined.js
index 377f4bcd31d5714c3c19daad8f497a40ea106472..d5f4ac892aa1f71ab189bfb317f0e96f0dfc00b7 100644
--- a/src/endWeek/saStayConfined.js
+++ b/src/endWeek/saStayConfined.js
@@ -39,7 +39,7 @@ App.SlaveAssignment.stayConfined = function(slave) {
 			slave.trust -= 5;
 		}
 
-		if (slave.assignment === "be confined in the cellblock") {
+		if (slave.assignment === Job.CELLBLOCK) {
 			if ((slave.hears === -1 && slave.earwear !== "hearing aids") || (slave.hears === 0 && slave.earwear === "muffling ear plugs") || (slave.hears === -2)) {
 				t += ` ${His} hearing impairment spares ${him} the sounds of ${his} peers getting punished, lightening the impact of ${his} imprisonment.`;
 			}
@@ -60,7 +60,7 @@ App.SlaveAssignment.stayConfined = function(slave) {
 			}
 			t += `,</span> so ${his} misery only grows.`;
 		}
-		if (slave.assignment === "be confined in the cellblock" && V.Wardeness !== 0) {
+		if (slave.assignment === Job.CELLBLOCK && V.Wardeness !== 0) {
 			t += ` The stress of confinement <span class="red">damages ${his} health.</span> ${V.Wardeness.slaveName}`;
 			if (V.Wardeness.fetish === "mindbroken") {
 				if (slave.health.tired > 80) {
@@ -99,7 +99,7 @@ App.SlaveAssignment.stayConfined = function(slave) {
 	}
 	tired(slave);
 
-	if (slave.assignment === "be confined in the cellblock" && V.Wardeness !== 0) {
+	if (slave.assignment === Job.CELLBLOCK && V.Wardeness !== 0) {
 		if ((V.Wardeness.sexualFlaw === "malicious" || V.Wardeness.sexualFlaw === "abusive" || V.Wardeness.sexualFlaw === "breast growth") && slave.lactation === 1 && slave.lactationDuration === 0) {
 			t += ` ${V.Wardeness.slaveName} `;
 			if (V.Wardeness.sexualFlaw === "malicious") {
@@ -127,7 +127,7 @@ App.SlaveAssignment.stayConfined = function(slave) {
 		}
 
 		t += ` <span class="noteworthy">`;
-		if (slave.assignment === "be confined in the cellblock") {
+		if (slave.assignment === Job.CELLBLOCK) {
 			State.temporary.brokenSlaves++;
 			State.temporary.DL--;
 			State.temporary.dI--;
@@ -137,8 +137,8 @@ App.SlaveAssignment.stayConfined = function(slave) {
 			assignJobSafely(slave, oldJob);
 			if (slave.choosesOwnAssignment === 1) {
 				t += ` and ${he} is resting before choosing another task.`;
-			} else if (slave.assignment === "rest") {
-				if (oldJob !== "rest") {
+			} else if (slave.assignment === Job.REST) {
+				if (oldJob !== Job.REST) {
 					t += ` and since ${he} was unable to return to ${his} old task to ${oldJob}, ${his} assignment has defaulted to rest.`;
 				} else {
 					t += ` so ${he} has returned to rest.`;
diff --git a/src/endWeek/saTakeClasses.js b/src/endWeek/saTakeClasses.js
index 2c05a32c1662ae86a347c8c21718134868130e14..78a6c8fdbc6b24e6e7bd688bed8c3f1cb5ec65a7 100644
--- a/src/endWeek/saTakeClasses.js
+++ b/src/endWeek/saTakeClasses.js
@@ -49,15 +49,15 @@ App.SlaveAssignment.takeClasses = (function() {
 		if (slave.fetish === "mindbroken") {
 			r += `is no longer mentally capable and <span class="noteworthy">has been dropped from class.</span>`;
 			slave.health.tired = Math.clamp(slave.health.tired - 10, 0, 100); // Since they avoid the tired call altogether, just toss them some reduction. It's not like they were listening anyway.
-			if (slave.assignment === "take classes") {
-				removeJob(slave, "take classes");
+			if (slave.assignment === Job.CLASSES) {
+				removeJob(slave, Job.CLASSES);
 			}
 		} else {
 			r += `takes courses in slavery`;
 			if (V.schoolroomUpgradeSkills + V.schoolroomUpgradeRemedial + V.schoolroomUpgradeLanguage !== 0) {
 				r += `, using ${V.schoolroomName}'s improved educational materials,`;
 			}
-			if (slave.assignment === "learn in the schoolroom" && V.Schoolteacher !== 0) {
+			if (slave.assignment === Job.SCHOOL && V.Schoolteacher !== 0) {
 				const schoolteacherPronouns = getPronouns(V.Schoolteacher);
 				teaching = (V.Schoolteacher.intelligence + V.Schoolteacher.intelligenceImplant);
 				if (V.Schoolteacher.visualAge > 35) {
@@ -170,7 +170,7 @@ App.SlaveAssignment.takeClasses = (function() {
 	 *
 	 */
 	function learningProgress(slave) {
-		if (V.schoolroomRemodelBimbo !== 1 || slave.assignment !== "learn in the schoolroom") {
+		if (V.schoolroomRemodelBimbo !== 1 || slave.assignment !== Job.SCHOOL) {
 			if (slave.intelligence > 95) { /* 200% education for brilliant */
 				learning += 2;
 			} else if (slave.intelligence > 50) { /* normal for very smart */
@@ -254,7 +254,7 @@ App.SlaveAssignment.takeClasses = (function() {
 		}
 
 		r += ` and ${he} `;
-		if (V.schoolroomRemodelBimbo !== 1 || slave.assignment !== "learn in the schoolroom") {
+		if (V.schoolroomRemodelBimbo !== 1 || slave.assignment !== Job.SCHOOL) {
 			if (learning <= 1) {
 				r += `learns slowly`;
 			} else if (learning === 2) {
@@ -280,7 +280,7 @@ App.SlaveAssignment.takeClasses = (function() {
 	 */
 	function lactationBreak(slave) {
 		// room for growth — do so during lactation rules expansion
-		if (slave.lactation === 1 && slave.assignment === "learn in the schoolroom" && V.Schoolteacher !== 0 && hasAnyArms(V.Schoolteacher)) {
+		if (slave.lactation === 1 && slave.assignment === Job.SCHOOL && V.Schoolteacher !== 0 && hasAnyArms(V.Schoolteacher)) {
 			r += ` With ${his} natural lactation, ${he} often finds ${himself} milked before the class by ${V.Schoolteacher.slaveName} both to serve as a lesson and to keep ${him} from becoming a milky mess.`;
 			slave.lactationDuration = 2;
 			slave.boobs -= slave.boobsMilk;
@@ -295,7 +295,7 @@ App.SlaveAssignment.takeClasses = (function() {
 	function skillLessons(slave) {
 		let undevoted = 0; // forces an obedience lesson to replace the first skill lesson
 		let skillIncrease = 0;
-		if (V.schoolroomRemodelBimbo !== 1 || slave.assignment !== "learn in the schoolroom") {
+		if (V.schoolroomRemodelBimbo !== 1 || slave.assignment !== Job.SCHOOL) {
 			skillIncrease = (10 + Math.floor((slave.intelligence + slave.intelligenceImplant) / 32));
 		} else {
 			skillIncrease = (10 + (Math.abs(Math.floor((slave.intelligence + slave.intelligenceImplant) / 32))));
@@ -362,7 +362,7 @@ App.SlaveAssignment.takeClasses = (function() {
 	 *
 	 */
 	function generalLessons(slave) {
-		if (V.schoolroomRemodelBimbo === 1 && slave.assignment === "learn in the schoolroom") {
+		if (V.schoolroomRemodelBimbo === 1 && slave.assignment === Job.SCHOOL) {
 			if (slave.intelligenceImplant > -15) {
 				r += ` ${He} makes some progress `;
 				if (slave.intelligenceImplant < 0) {
@@ -376,7 +376,7 @@ App.SlaveAssignment.takeClasses = (function() {
 					r += ` ${He} has completed ${his} special education, and for most purposes ${he} has become <span class="education neg">less intelligent.</span>`;
 				}
 			}
-		} else if (slave.intelligenceImplant < 30 && slave.assignment === "learn in the schoolroom") {
+		} else if (slave.intelligenceImplant < 30 && slave.assignment === Job.SCHOOL) {
 			r += ` ${He} makes some progress `;
 			if (slave.intelligenceImplant < 15) {
 				r += `towards a basic education.`;
@@ -388,7 +388,7 @@ App.SlaveAssignment.takeClasses = (function() {
 				slave.intelligenceImplant = 30;
 				r += ` ${He} has completed ${his} advanced education, and for most purposes ${he} has become <span class="intelligent">more intelligent.</span>`;
 			}
-		} else if (slave.intelligenceImplant < 15 && slave.assignment === "take classes") {
+		} else if (slave.intelligenceImplant < 15 && slave.assignment === Job.CLASSES) {
 			r += ` ${He} makes some progress towards a basic education.`;
 			slave.intelligenceImplant += Math.max(1, learning);
 			if (slave.intelligenceImplant >= 15) {
@@ -430,7 +430,7 @@ App.SlaveAssignment.takeClasses = (function() {
 	 *
 	 */
 	function graduation(slave) {
-		if (slave.intelligenceImplant >= 15 && slave.assignment === "take classes") {
+		if (slave.intelligenceImplant >= 15 && slave.assignment === Job.CLASSES) {
 			if ((slave.voice === 0) || (slave.accent <= 1) || ((V.schoolroomUpgradeLanguage === 0 && slave.accent <= 2))) {
 				if ((slave.skill.oral > 30) || (V.schoolroomUpgradeSkills === 0 && slave.skill.oral > 10)) {
 					if ((slave.skill.whoring > 30) || (V.schoolroomUpgradeSkills === 0 && slave.skill.whoring > 10)) {
@@ -443,8 +443,8 @@ App.SlaveAssignment.takeClasses = (function() {
 										assignJobSafely(slave, oldJob);
 										if (slave.choosesOwnAssignment === 1) {
 											r += ` so ${he} takes a break before choosing another task.`;
-										} else if (slave.assignment === "rest") {
-											if (oldJob !== "rest") {
+										} else if (slave.assignment === Job.REST) {
+											if (oldJob !== Job.REST) {
 												r += ` and since ${he} was unable to return to ${his} old task to ${oldJob}, ${his} assignment has defaulted to rest.`;
 											} else {
 												r += ` so ${he} has returned to resting.`;
diff --git a/src/endWeek/saWhore.js b/src/endWeek/saWhore.js
index 77eb9c98a065af29862900fcd6d22b9ea0e38e93..d71b52bc80f7b963479c95215b5f84548e1f2416 100644
--- a/src/endWeek/saWhore.js
+++ b/src/endWeek/saWhore.js
@@ -38,7 +38,7 @@ App.SlaveAssignment.whore = (function() {
 
 		gatherStatistics(slave);
 		updateNonSlaveVariables(slave); // must be run before applyFSDecoration() or you will face NaNs
-		if (slave.assignment === "work in the brothel" || slave.assignment === "be the Madam") {
+		if (slave.assignment === Job.BROTHEL || slave.assignment === Job.MADAM) {
 			// By being at the end, every slave after the first will get a bonus. By moving it up, the first can enjoy it too. slaveJobValues() checks Edo Revivalist, so here we are.
 			applyFSDecoration();
 		}
@@ -130,8 +130,8 @@ App.SlaveAssignment.whore = (function() {
 	 */
 	function bonusMultiplierText(slave) {
 		if (V.brothel > 0) {
-			if ((V.universalRulesFacilityWork === 1 && slave.assignment === "whore" && V.brothelSpots > 0) || (slave.assignment === "work in the brothel")) {
-				if (slave.assignment === "whore") {
+			if ((V.universalRulesFacilityWork === 1 && slave.assignment === Job.WHORE && V.brothelSpots > 0) || (slave.assignment === Job.BROTHEL)) {
+				if (slave.assignment === Job.WHORE) {
 					r += ` Since there's extra space in ${V.brothelName}, ${he} sells ${himself} there.`;
 					const maxBrothelBoost = Math.max(Math.trunc(100 * Math.pow(1.26, V.brothelBoost.eligible - 1)) * 50 * V.brothelBoost.eligible, 1); // Correcting prices in case benefits outgrow the cap
 					if (maxBrothelBoost < V.slaveJobValues.brothel.boost) {
@@ -181,7 +181,7 @@ App.SlaveAssignment.whore = (function() {
 				if (V.Madam !== 0) {
 					const madamPronouns = getPronouns(V.Madam);
 					if (V.madamCashBonus > 0) {
-						if (slave.assignment === "whore") {
+						if (slave.assignment === Job.WHORE) {
 							r += ` Working`;
 						} else {
 							r += ` Living and working`;
@@ -347,7 +347,7 @@ App.SlaveAssignment.whore = (function() {
 			}
 			r += `,</span> hindering ${his} ability to attract and please customers.`;
 		}
-		if (slave.assignment === "work in the brothel") {
+		if (slave.assignment === Job.BROTHEL) {
 			if (slaveResting(slave)) {
 				r += ` ${He} spends reduced hours working ${V.brothelName} in order to <span class="green">offset ${his} lack of rest.</span>`;
 			} else if (slave.health.tired + 15 >= 90 && !willWorkToDeath(slave)) {
@@ -364,7 +364,7 @@ App.SlaveAssignment.whore = (function() {
 				r += ` It takes effort to be a productive whore and ${he} ends ${his} shifts <span class="red">eager for sleep.</span>`;
 			}
 			tired(slave);
-		} else if (slave.assignment === "whore") {
+		} else if (slave.assignment === Job.WHORE) {
 			if (slaveResting(slave)) {
 				r += ` ${He} spends reduced hours plying ${his} trade in order to <span class="green">offset ${his} lack of rest.</span>`;
 			} else if (slave.health.tired + 15 >= 90 && !willWorkToDeath(slave)) {
@@ -543,7 +543,7 @@ App.SlaveAssignment.whore = (function() {
 		}
 
 		if (!canWalk(slave)) {
-			if ((V.universalRulesFacilityWork === 1 && slave.assignment === "whore" && V.brothelSpots > 0) || (slave.assignment === "work in the brothel")) {
+			if ((V.universalRulesFacilityWork === 1 && slave.assignment === Job.WHORE && V.brothelSpots > 0) || (slave.assignment === Job.BROTHEL)) {
 				r += ` Since ${he} can't walk, ${he} spends all of ${his} time in ${his} own room in ${V.brothelName}. Customers come in, fuck ${him}, and leave.`;
 			} else {
 				r += ` Since ${he} can't walk, ${he}'s set up so customers can use ${him}, pay and carry on their way.`;
diff --git a/src/endWeek/saWorkAGloryHole.js b/src/endWeek/saWorkAGloryHole.js
index 090f66268986b2139e14e934b7c6eb202431c607..94014ce91bcca44565b4a1669ab28407fbcc0c09 100644
--- a/src/endWeek/saWorkAGloryHole.js
+++ b/src/endWeek/saWorkAGloryHole.js
@@ -152,7 +152,7 @@ App.SlaveAssignment.workAGloryHole = (function() {
 			}
 			r += `,</span> but no one cared.`;
 		}
-		if (slave.assignment === "be confined in the arcade") {
+		if (slave.assignment === Job.ARCADE) {
 			if (!slave.fuckdoll) {
 				r += ` $He spends $his working hours constrained to a box, and $his time outside preparing for $his next shift; <span class="red">an exhausting life for even the healthiest of slaves.</span>`;
 				if (V.arcadeUpgradeHealth > 0) {
@@ -167,7 +167,7 @@ App.SlaveAssignment.workAGloryHole = (function() {
 				}
 			}
 			tired(slave);
-		} else if (slave.assignment === "work a glory hole") {
+		} else if (slave.assignment === Job.GLORYHOLE) {
 			if (!slave.fuckdoll) {
 				if (slaveResting(slave)) {
 					r += ` ${He} spends reduced hours serving ${his} glory hole in order to <span class="green">offset ${his} lack of rest.</span>`;
diff --git a/src/endWeek/sexualServices.js b/src/endWeek/sexualServices.js
new file mode 100644
index 0000000000000000000000000000000000000000..7ab3faf96c7e2feb45234074a70fb9dc0d70a0d3
--- /dev/null
+++ b/src/endWeek/sexualServices.js
@@ -0,0 +1,352 @@
+/**
+ * @param {ParentNode} renderContainer
+ */
+App.EndWeek.computeSexualServicesModel = function(renderContainer) {
+	const arcology = V.arcologies[0];
+
+	/* Sexual services demand per class */
+	/* We can add milk etc. to this as well, though this is a good that can be traded beyond the arcology and also needs its own market much like the slavemarket. TODO */
+	/* In the default scenario these numbers indicate the amount of money each individual citizen of a particular class is looking to spend on sex (and milk) every week
+	Depending on the conditions they may derive more or less 'utility' out of their credits spent
+	i.e. a highly paternalist arcology with little choice for its lower class but Fuckdolls may still put money into them but not get the same satisfaction out of it*/
+	/* Low rent increases demand/available money for sexual services, high rent decreases it */
+	if (V.brothelBoost.selected > 0 && V.rep < V.brothelBoost.selected * 500 + 2000) {
+		V.brothelBoost.eligible = Math.trunc((V.rep - 2000) / 500);
+		if (V.brothelBoost.eligible < 0) {
+			V.brothelBoost.eligible = 0;
+		}
+	} else {
+		V.brothelBoost.eligible = V.brothelBoost.selected;
+	}
+	repX(forceNeg(50 * V.brothelBoost.eligible), "brothel");
+
+	let lowerClassSexDemand = Math.trunc(V.lowerClass * V.whoreBudget.lowerClass) * 2,
+		lowerClassSexDemandRef = Math.max(lowerClassSexDemand, 1),
+		visitorsSexDemand = Math.trunc(V.visitors) * 40,
+		middleClassSexDemand = Math.trunc(V.middleClass * V.whoreBudget.middleClass + visitorsSexDemand * 0.5) * 2,
+		middleClassSexDemandRef = Math.max(middleClassSexDemand, 1),
+		upperClassSexDemand = Math.trunc(V.upperClass * V.whoreBudget.upperClass + visitorsSexDemand * 0.5) * 2,
+		upperClassSexDemandRef = Math.max(upperClassSexDemand, 1),
+		topClassSexDemand = Math.trunc(V.topClass * V.whoreBudget.topClass) * 2,
+		topClassSexDemandRef = Math.max(topClassSexDemand, 1),
+		arcadeSupply = {lowerClass: 0, middleClass: 0, upperClass: 0},
+		clubSupply = {lowerClass: 0, middleClass: 0};
+
+	V.whorePriceAdjustment = {lowerClass: 0, middleClass: 0, upperClass: 0, topClass: 0};
+	V.NPCMarketShare = {lowerClass: 0, middleClass: 0, upperClass: 0, topClass: 0};
+	V.sexDemandResult = {lowerClass: 0, middleClass: 0, upperClass: 0, topClass: 0};
+	V.slaveJobValues = slaveJobValues(lowerClassSexDemandRef, middleClassSexDemandRef, upperClassSexDemandRef, topClassSexDemandRef);
+
+	let lowerClassArcadeSexDemand = 0;
+	let middleClassArcadeSexDemand = 0;
+	let upperClassArcadeSexDemand = 0;
+	let arcadeDemand = 0;
+	let arcadeDemandDeg = 0;
+	// Arcade Specific Demand for Degradationists to give it higher priority
+	if (arcology.FSDegradationist !== "unset") {
+		lowerClassArcadeSexDemand = Math.trunc(lowerClassSexDemand * arcology.FSDegradationist * 0.0015);
+		middleClassArcadeSexDemand = Math.trunc(middleClassSexDemand * arcology.FSDegradationist * 0.0002);
+		upperClassArcadeSexDemand = Math.trunc(upperClassSexDemand * arcology.FSDegradationist * 0.000025);
+		arcadeDemandDeg = lowerClassArcadeSexDemand + middleClassArcadeSexDemand + upperClassArcadeSexDemand;
+		if (arcology.FSDegradationistLaw === 1) {
+			arcadeDemandDeg += V.ASlaves * 3;
+		}
+		if (V.slaveJobValues.arcade < arcadeDemandDeg) {
+			if (arcadeDemandDeg > 20000 || arcology.FSDegradationist > 50) {
+				const degradationistPenalty = ((arcadeDemandDeg - V.slaveJobValues.arcade) / arcadeDemandDeg);
+				arcology.FSDegradationist -= Math.trunc(5 * degradationistPenalty);
+				repX(forceNeg(100 * degradationistPenalty), "futureSocieties");
+				V.arcadeDemandDegResult = degradationistPenalty > 0.5 ? 1 : 2;
+			} else {
+				V.arcadeDemandDegResult = 3;
+			}
+			arcadeSupply.lowerClass += Math.trunc(1.15 * V.slaveJobValues.arcade * (lowerClassArcadeSexDemand / arcadeDemandDeg));
+			lowerClassSexDemand -= arcadeSupply.lowerClass;
+			arcadeSupply.middleClass += Math.trunc(1.15 * V.slaveJobValues.arcade * (middleClassArcadeSexDemand / arcadeDemandDeg));
+			middleClassSexDemand -= arcadeSupply.middleClass;
+			arcadeSupply.upperClass += Math.trunc(1.15 * V.slaveJobValues.arcade * (upperClassArcadeSexDemand / arcadeDemandDeg));
+			upperClassSexDemand -= arcadeSupply.upperClass; // There's a 15% satisfaction bonus from getting release in a societally approved way
+		} else {
+			if (V.slaveJobValues.arcade >= arcadeDemandDeg * 1.5) {
+				arcology.FSDegradationist += 2;
+				V.arcadeDemandDegResult = 4;
+				repX(500, "futureSocieties");
+			} else {
+				V.arcadeDemandDegResult = 5;
+			}
+			arcadeSupply.lowerClass += Math.trunc(1.15 * lowerClassArcadeSexDemand);
+			lowerClassSexDemand -= arcadeSupply.lowerClass;
+			arcadeSupply.middleClass += Math.trunc(1.15 * middleClassArcadeSexDemand);
+			middleClassSexDemand -= arcadeSupply.middleClass;
+			arcadeSupply.upperClass += Math.trunc(1.15 * upperClassArcadeSexDemand);
+			upperClassSexDemand -= arcadeSupply.upperClass;
+		}
+	} else {
+		arcadeDemandDeg = 0;
+	}
+
+	// Public slut sex supply. Top and upper class won't partake
+	let clubDemand = lowerClassSexDemand + middleClassSexDemand;
+	let lowerClassClubRatio = lowerClassSexDemand / clubDemand;
+	let middleClassClubRatio = middleClassSexDemand / clubDemand;
+
+	if (V.slaveJobValues.club * V.slaveJobValues.clubSP < clubDemand) {
+		lowerClassSexDemand -= Math.trunc(V.slaveJobValues.club * V.slaveJobValues.clubSP * lowerClassClubRatio);
+		middleClassSexDemand -= Math.trunc(V.slaveJobValues.club * V.slaveJobValues.clubSP * middleClassClubRatio);
+	} else {
+		lowerClassSexDemand = 0;
+		middleClassSexDemand = 0;
+	}
+
+	clubSupply.lowerClass = Math.trunc(V.slaveJobValues.club * V.slaveJobValues.clubSP * lowerClassClubRatio);
+	clubSupply.middleClass = Math.trunc(V.slaveJobValues.club * V.slaveJobValues.clubSP * middleClassClubRatio);
+
+	// Brothel or street whore sex supply
+	if (lowerClassSexDemand < V.slaveJobValues.brothel.lowerClass) {
+		V.whorePriceAdjustment.lowerClass = Math.max(Math.pow(lowerClassSexDemand / (V.slaveJobValues.brothel.lowerClass + V.NPCSexSupply.lowerClass), 1.513), 0.3);
+		lowerClassSexDemand = 0; // This accounts for people having too much choice and getting more picky how they spend their money
+	} else {
+		V.whorePriceAdjustment.lowerClass = Math.pow(lowerClassSexDemand / (V.slaveJobValues.brothel.lowerClass + V.NPCSexSupply.lowerClass), 0.5);
+		lowerClassSexDemand -= V.slaveJobValues.brothel.lowerClass; // People are willing to pay more for a scarce good, but within reason
+	}
+	if (middleClassSexDemand < V.slaveJobValues.brothel.middleClass) {
+		V.whorePriceAdjustment.middleClass = Math.max(Math.pow((middleClassSexDemand * 1.1) / (V.slaveJobValues.brothel.middleClass + V.NPCSexSupply.middleClass), 1.513), 0.33);
+		middleClassSexDemand = 0;
+	} else {
+		V.whorePriceAdjustment.middleClass = Math.pow((middleClassSexDemand * 1.1) / (V.slaveJobValues.brothel.middleClass + V.NPCSexSupply.middleClass), 0.5);
+		middleClassSexDemand -= V.slaveJobValues.brothel.middleClass;
+	}
+	if (upperClassSexDemand < V.slaveJobValues.brothel.upperClass) {
+		V.whorePriceAdjustment.upperClass = Math.max(Math.pow((upperClassSexDemand * 1.21) / (V.slaveJobValues.brothel.upperClass + V.NPCSexSupply.upperClass), 1.513), 0.363);
+		upperClassSexDemand = 0;
+	} else {
+		V.whorePriceAdjustment.upperClass = Math.pow((upperClassSexDemand * 1.21) / (V.slaveJobValues.brothel.upperClass + V.NPCSexSupply.upperClass), 0.5);
+		upperClassSexDemand -= V.slaveJobValues.brothel.upperClass;
+	}
+	if (topClassSexDemand < V.slaveJobValues.brothel.topClass) {
+		V.whorePriceAdjustment.topClass = Math.max(Math.pow((topClassSexDemand * 1.331) / (V.slaveJobValues.brothel.topClass + V.NPCSexSupply.topClass), 1.513), 0.3993);
+		topClassSexDemand = 0;
+	} else {
+		V.whorePriceAdjustment.topClass = Math.pow((topClassSexDemand * 1.331) / (V.slaveJobValues.brothel.topClass + V.NPCSexSupply.topClass), 0.5);
+		topClassSexDemand -= V.slaveJobValues.brothel.topClass;
+	}
+
+	// Price for sex in the arcade or at a glory hole
+	if (arcology.FSPaternalist !== "unset") {
+		arcadeDemand = Math.max((arcadeDemandDeg + lowerClassSexDemand) * (1 - arcology.FSPaternalist / 50), 0); // Paternalists sap demand for the arcade
+	} else {
+		arcadeDemand = arcadeDemandDeg + lowerClassSexDemand;
+	}
+	if (V.slaveJobValues.arcade + V.NPCSexSupply.lowerClass > 0) {
+		V.arcadePrice = Math.clamp(Math.pow((arcadeDemand / (V.slaveJobValues.arcade + V.NPCSexSupply.lowerClass)), 0.5), 0.5, 3); // This calculates the price charged per fuck
+	} else {
+		V.arcadePrice = 0.5; // minimum price no matter what
+	}
+
+	// Arcade usage beyond degradationist demand
+	if (arcology.FSDegradationist !== "unset") {
+		if (V.slaveJobValues.arcade > arcadeDemandDeg) {
+			V.slaveJobValues.arcade -= arcadeDemandDeg;
+		} else {
+			V.slaveJobValues.arcade = 0;
+		}
+	}
+	if (V.slaveJobValues.arcade > lowerClassSexDemand) {
+		lowerClassSexDemand = 0;
+	} else {
+		lowerClassSexDemand -= V.slaveJobValues.arcade;
+	}
+	arcadeSupply.lowerClass += V.slaveJobValues.arcade;
+
+	// NPC sex supply
+	V.NPCSexSupply = NPCSexSupply(lowerClassSexDemand, lowerClassSexDemandRef, middleClassSexDemand, middleClassSexDemandRef, upperClassSexDemand, upperClassSexDemandRef, topClassSexDemand, topClassSexDemandRef);
+	V.NPCMarketShare.lowerClass = Math.trunc((V.NPCSexSupply.lowerClass * 1000) / lowerClassSexDemandRef);
+	V.NPCMarketShare.middleClass = Math.trunc((V.NPCSexSupply.middleClass * 1000) / middleClassSexDemandRef);
+	V.NPCMarketShare.upperClass = Math.trunc((V.NPCSexSupply.upperClass * 1000) / upperClassSexDemandRef);
+	V.NPCMarketShare.topClass = Math.trunc((V.NPCSexSupply.topClass * 1000) / topClassSexDemandRef);
+	if (lowerClassSexDemand < V.NPCSexSupply.lowerClass) {
+		lowerClassSexDemand = 0;
+	} else {
+		lowerClassSexDemand -= V.NPCSexSupply.lowerClass;
+	}
+
+	if (middleClassSexDemand < V.NPCSexSupply.middleClass) {
+		middleClassSexDemand = 0;
+	} else {
+		middleClassSexDemand -= V.NPCSexSupply.middleClass;
+	}
+
+	if (upperClassSexDemand < V.NPCSexSupply.upperClass) {
+		upperClassSexDemand = 0;
+	} else {
+		upperClassSexDemand -= V.NPCSexSupply.upperClass;
+	}
+
+	if (topClassSexDemand < V.NPCSexSupply.topClass) {
+		topClassSexDemand = 0;
+	} else {
+		topClassSexDemand -= V.NPCSexSupply.topClass;
+	}
+
+	if ((V.cheatMode === 1) || (V.debugMode === 1)) {
+		_printDebugInfo(renderContainer);
+	}
+
+	// Sexual satisfaction effects
+	V.sexDemandResult.lowerClass = Math.trunc(((V.NPCSexSupply.lowerClass + V.slaveJobValues.brothel.lowerClass + clubSupply.lowerClass + arcadeSupply.lowerClass) * 1000) / lowerClassSexDemandRef);
+	V.sexDemandResult.middleClass = Math.trunc(((V.NPCSexSupply.middleClass + V.slaveJobValues.brothel.middleClass + clubSupply.middleClass + arcadeSupply.middleClass) * 1000) / middleClassSexDemandRef);
+	V.sexDemandResult.upperClass = Math.trunc(((V.NPCSexSupply.upperClass + V.slaveJobValues.brothel.upperClass + arcadeSupply.upperClass) * 1000) / upperClassSexDemandRef);
+	V.sexDemandResult.topClass = Math.trunc(((V.NPCSexSupply.topClass + V.slaveJobValues.brothel.topClass) * 1000) / topClassSexDemandRef);
+
+	if (V.sexDemandResult.lowerClass < 400) { // You are providing < 40% of their desired amount of sex
+		if (V.week <= 30) {
+			V.classSatisfied.lowerClass = 0;
+		} else {
+			V.classSatisfied.lowerClass = -1;
+		}
+	} else if (V.sexDemandResult.lowerClass < 600) { // You are providing between 40 and 60% of their desired amount of sex
+		if (V.week <= 40) {
+			V.classSatisfied.lowerClass = 1;
+		} else if (V.week <= 60) {
+			V.classSatisfied.lowerClass = 0;
+		} else {
+			V.classSatisfied.lowerClass = -1;
+		}
+	} else if (V.sexDemandResult.lowerClass < 800) { // You are providing between 60 and 80% of their desired amount of sex
+		if (V.week <= 50) {
+			V.classSatisfied.lowerClass = 1;
+		} else {
+			V.classSatisfied.lowerClass = 0;
+		}
+	} else if (V.sexDemandResult.lowerClass === 1000) { // You are providing 100% or more of their desired amount of sex
+		V.classSatisfied.lowerClass = 2;
+	} else { // You are providing > 80% of their desired amount of sex
+		V.classSatisfied.lowerClass = 1;
+	}
+
+	if (V.sexDemandResult.middleClass < 400) { // You are providing < 40% of their desired amount of sex
+		if (V.week <= 30) {
+			V.classSatisfied.middleClass = 0;
+		} else {
+			V.classSatisfied.middleClass = -1;
+		}
+	} else if (V.sexDemandResult.middleClass < 600) { // You are providing between 40 and 60% of their desired amount of sex
+		if (V.week <= 40) {
+			V.classSatisfied.middleClass = 1;
+		} else if (V.week <= 60) {
+			V.classSatisfied.middleClass = 0;
+		} else {
+			V.classSatisfied.middleClass = -1;
+		}
+	} else if (V.sexDemandResult.middleClass < 800) { // You are providing between 60 and 80% of their desired amount of sex
+		if (V.week <= 50) {
+			V.classSatisfied.middleClass = 1;
+		} else {
+			V.classSatisfied.middleClass = 0;
+		}
+	} else if (V.sexDemandResult.middleClass === 1000) { // You are providing 100% or more of their desired amount of sex
+		V.classSatisfied.middleClass = 2;
+	} else { // You are providing > 80% of their desired amount of sex
+		V.classSatisfied.middleClass = 1;
+	}
+
+	if (V.sexDemandResult.upperClass < 400) { // You are providing < 40% of their desired amount of sex
+		if (V.week <= 30) {
+			V.classSatisfied.upperClass = 0;
+		} else {
+			V.classSatisfied.upperClass = -1;
+		}
+	} else if (V.sexDemandResult.upperClass < 600) { // You are providing between 40 and 60% of their desired amount of sex
+		if (V.week <= 40) {
+			V.classSatisfied.upperClass = 1;
+		} else if (V.week <= 60) {
+			V.classSatisfied.upperClass = 0;
+		} else {
+			V.classSatisfied.upperClass = -1;
+		}
+	} else if (V.sexDemandResult.upperClass < 800) { // You are providing between 60 and 80% of their desired amount of sex
+		if (V.week <= 50) {
+			V.classSatisfied.upperClass = 1;
+		} else {
+			V.classSatisfied.upperClass = 0;
+		}
+	} else if (V.sexDemandResult.upperClass === 1000) { // You are providing 100% or more of their desired amount of sex
+		V.classSatisfied.upperClass = 2;
+	} else { // You are providing > 80% of their desired amount of sex
+		V.classSatisfied.upperClass = 1;
+	}
+
+	if (V.sexDemandResult.topClass < 400) { // You are providing < 40% of their desired amount of sex
+		if (V.week <= 30) {
+			V.classSatisfied.topClass = 0;
+		} else {
+			V.classSatisfied.topClass = -1;
+		}
+	} else if (V.sexDemandResult.topClass < 600) { // You are providing between 40 and 60% of their desired amount of sex
+		if (V.week <= 40) {
+			V.classSatisfied.topClass = 1;
+		} else if (V.week <= 60) {
+			V.classSatisfied.topClass = 0;
+		} else {
+			V.classSatisfied.topClass = -1;
+		}
+	} else if (V.sexDemandResult.topClass < 800) { // You are providing between 60 and 80% of their desired amount of sex
+		if (V.week <= 50) {
+			V.classSatisfied.topClass = 1;
+		} else {
+			V.classSatisfied.topClass = 0;
+		}
+	} else if (V.sexDemandResult.topClass === 1000) { // You are providing 100% or more of their desired amount of sex
+		V.classSatisfied.topClass = 2;
+	} else { // You are providing > 80% of their desired amount of sex
+		V.classSatisfied.topClass = 1;
+	}
+
+	/**
+	 * @param {ParentNode} c
+	 */
+	function _printDebugInfo(c) {
+		c.append(document.createElement("br"));
+		c.append("Slave services supply and demand this week:");
+
+		const table = App.UI.DOM.appendNewElement("table", c, null, "finance");
+		table.border = "1";
+		const titleRow = App.UI.DOM.appendNewElement("tr", table);
+		titleRow.align = "center";
+		const tcl = App.UI.DOM.appendNewElement("th", titleRow, "Client's class");
+		tcl.align = "right";
+		App.UI.DOM.appendNewElement("th", titleRow, "Lower");
+		App.UI.DOM.appendNewElement("th", titleRow, "Middle");
+		App.UI.DOM.appendNewElement("th", titleRow, "Upper");
+		App.UI.DOM.appendNewElement("th", titleRow, "Top");
+
+		/**
+		 *
+		 * @param {string} caption
+		 * @param {number} [lower]
+		 * @param {number} [middle]
+		 * @param {number} [upper]
+		 * @param {number} [top]
+		 */
+		function numericRow(caption, lower, middle, upper, top) {
+			const row = App.UI.DOM.appendNewElement("tr", table);
+			row.align = "right";
+			App.UI.DOM.appendNewElement("td", row, caption);
+			App.UI.DOM.appendNewElement("td", row, lower == null ? "N/A" : commaNum(lower));
+			App.UI.DOM.appendNewElement("td", row, middle == null ? "N/A" : commaNum(middle));
+			App.UI.DOM.appendNewElement("td", row, upper == null ? "N/A" : commaNum(upper));
+			App.UI.DOM.appendNewElement("td", row, top == null ? "N/A" : commaNum(top));
+		}
+
+		numericRow("Demand", lowerClassSexDemand, middleClassSexDemand, upperClassSexDemand, topClassSexDemand);
+		numericRow("Brothel Supply", V.slaveJobValues.brothel.lowerClass, V.slaveJobValues.brothel.middleClass, V.slaveJobValues.brothel.upperClass, V.slaveJobValues.brothel.topClass);
+		if (clubSupply.lowerClass || clubSupply.middleClass) {
+			numericRow("Club Supply", clubSupply.lowerClass, clubSupply.middleClass);
+		}
+		if (arcadeSupply.lowerClass || arcadeSupply.middleClass || arcadeSupply.upperClass) {
+			numericRow("Arcade Supply", arcadeSupply.lowerClass, arcadeSupply.middleClass, arcadeSupply.upperClass);
+		}
+		numericRow("NPC Supply", V.NPCSexSupply.lowerClass, V.NPCSexSupply.middleClass, V.NPCSexSupply.upperClass, V.NPCSexSupply.topClass);
+		numericRow("Unsatisfied", lowerClassSexDemand, middleClassSexDemand, upperClassSexDemand, topClassSexDemand)
+	}
+};
diff --git a/src/endWeek/slaveAssignmentReport.js b/src/endWeek/slaveAssignmentReport.js
new file mode 100644
index 0000000000000000000000000000000000000000..dd5a981c32b8eaeb3bfe5ed13374f0ed623a31d9
--- /dev/null
+++ b/src/endWeek/slaveAssignmentReport.js
@@ -0,0 +1,1211 @@
+App.EndWeek.slaveAssignmentReport = function() {
+	const facilities = App.Entity.facilities;
+	const arcology = V.arcologies[0];
+
+	// V.nextLink = "Economics";
+	// V.nextButton = "Continue";
+
+	const initialEmployeesCount = App.Utils.countFacilityWorkers(); // will be used to show differences after all the assignment changes
+	const initialPenthouseTotalEmployeesCount = _countPenthousePopulation();
+
+	/* Spa room */
+	if (facilities.spa.established) {
+		V.spaSpots = (facilities.spa.capacity - App.Entity.facilities.spa.employeesIDs().size) * 20;
+		if (S.Attendant) {
+			V.spaSpots = Math.trunc(V.spaSpots * (1 + (S.Attendant.skill.attendant / 400))); // A skilled attendant improves available space by 25%
+		}
+	}
+
+	/** silent pass for any reassignments before generating reports */
+	for (let i = 0; i < V.slaves.length; ++i) {
+		// temp
+		V.slaves[i].health.illness = 0;
+		V.slaves[i].health.tired = 0;
+		if (V.slaves[i].choosesOwnAssignment === 1) {
+			V.i = i;
+			App.UI.DOM.renderPassage("SA chooses own job");
+		}
+	}
+
+	const res = document.createDocumentFragment();
+
+	App.EndWeek.computeSexualServicesModel(res);
+
+	res.appendChild(document.createElement("br"));
+	res.appendChild(document.createElement("br"));
+
+	const skillsToTest = {
+		whoring: "whore",
+		entertainment: "entertain",
+		vaginal: "vaginal",
+		anal: "anal",
+		oral: "oral"
+	};
+
+	for (const slave of V.slaves) {
+		for (const sk in skillsToTest) {
+			if (_.isNil(slave.skill[sk])) {
+				_printSlaveError(`Reset bad ${skillsToTest[sk]} skill`, slave);
+				slave.skill[sk] = 0;
+			}
+		}
+
+		if ((V.seeDicks > 0) && canPenetrate(slave) && App.Utils.hasNonassignmentSex(slave)) {
+			V.averageDick += slave.dick, V.slavesWithWorkingDicks++;
+		}
+
+		if ((slave.lactation === 1)) {
+			slave.lactationDuration--;
+		}
+
+		_ensureEmployeeMeetsJobRequirements(slave); // this can fire special slaves
+
+		switch (slave.assignment) {
+			case Job.HEADGIRLSUITE:
+				if (slave.devotion >= random(-30, 20)) {
+					V.HGSlaveSuccess++, V.HGEnergy++;
+				} else {
+					V.HGSlaveSuccess--;
+				}
+				break;
+			case Job.CONCUBINE:
+				V.Concubine = slave, V.fuckSlaves++;
+				break;
+			case Job.MASTERSUITE:
+			case Job.FUCKTOY:
+				V.fuckSlaves++;
+				break;
+		}
+
+		if (slave.ID === V.LurcherID) {
+			if (!canWalk(slave)) {
+				_printSlaveUnassignedNote(slave, "is no longer able to run", null, Job.LURCHER);
+				V.LurcherID = 0;
+			} else if (!canHold(slave)) {
+				_printSlaveUnassignedNote(slave, "is no longer able to catch the hares", null, Job.LURCHER);
+				V.LurcherID = 0;
+			} else if (!canHear(slave) && !canSee(slave)) {
+				_printSlaveUnassignedNote(slave, "is no longer able to track the hares", null, Job.LURCHER);
+				V.LurcherID = 0;
+			} else if (slave.bellyPreg >= 60000) {
+				_printSlaveUnassignedNote(slave, "is too pregnant to run", null, Job.LURCHER);
+				V.LurcherID = 0;
+			}
+		}
+
+		if (V.fighterIDs.includes(slave)) {
+			if (!canWalk(slave)) {
+				_printSlaveUnassignedNote(slave, "is no longer independently mobile",
+					`and cannot fight any more. ${getPronouns(slave).he} has been removed from ${App.Entity.facilities.pit.name} roster`);
+				V.fighterIDs.delete(slave.ID);
+			} else if (!canHold(slave)) {
+				_printSlaveUnassignedNote(slave, "is no longer able to strike",
+					`and cannot fight any more. ${getPronouns(slave).he} has been removed from ${App.Entity.facilities.pit.name} roster`);
+				V.fighterIDs.delete(slave.ID);
+			}
+		}
+
+		if (slave.bellyPain !== 0) {
+			slave.bellyPain = 0;
+		}
+
+		/* preg speed and advance*/
+
+		if (slave.preg > 0) {
+			let pregSpeed = 1; // base speed is normal
+			if (slave.pregControl === "slow gestation") {
+				pregSpeed = 0.5;
+			} else if (slave.pregControl === "speed up") {
+				pregSpeed = 2;
+			}
+
+			if (slave.broodmother === 1 && slave.broodmotherOnHold !== 1) { /* broodmother advance block */
+				if ((V.week / slave.broodmotherFetuses === Math.round(V.week / slave.broodmotherFetuses)) && slave.broodmotherFetuses < 1) {
+					// one fetus in few week - selection and adding
+					WombImpregnate(slave, 1, slave.pregSource, 0);
+				} else {
+					// one or more fetuses in one week
+					WombImpregnate(slave, Math.floor(slave.broodmotherFetuses), slave.pregSource, 0); /* really 0, it's will be advanced right few lines down.*/
+				}
+				if (slave.ovaryAge >= 47) {
+					slave.broodmotherOnHold = 1;
+					slave.broodmotherCountDown = 37 - WombMinPreg(slave);
+				}
+			}
+
+			WombProgress(slave, pregSpeed, 1); /* drugs can affect speed of gestation, but not a real time */
+
+			slave.pregKnown = 1;
+			slave.pregWeek++;
+		}
+		if (slave.pregWeek < 0) { // postpartum state
+			slave.pregWeek++;
+		}
+
+		SetBellySize(slave); /* here will be also set through WombGetVolume .bellyPreg, .pregType, to current values. */
+
+		/* end of preg speed and advance*/
+
+		/* set up sexual need */
+		if (slave.devotion >= -50) {
+			if (slave.energy > 20) {
+				if (slave.physicalAge < slave.pubertyAgeXY && slave.genes === "XY" && slave.energy <= 80) {
+					slave.need = slave.energy / 3;
+				} else if (slave.physicalAge < slave.pubertyAgeXX && slave.genes === "XX" && slave.energy <= 80) {
+					slave.need = slave.energy / 3;
+				} else if (slave.physicalAge < 50) {
+					slave.need = slave.energy;
+				} else {
+					slave.need = slave.energy / 5;
+				}
+				if (slave.balls > 0 && slave.pubertyXY === 1 && slave.physicalAge <= (slave.pubertyAgeXY + 1) && (slave.physicalAge > slave.pubertyAgeXY) && slave.physicalAge < 18) {
+					slave.need = (slave.need * 1.25);
+				}
+				if ((slave.ovaries === 1 || slave.mpreg === 1) && slave.pubertyXX === 1 && slave.physicalAge <= (slave.pubertyAgeXX + 1) && (slave.physicalAge > slave.pubertyAgeXX) && slave.physicalAge < 18) {
+					slave.need = (slave.need * 1.25);
+				}
+				if (slave.diet === "fertility") {
+					slave.need += 10;
+				}
+				if (slave.aphrodisiacs === -1) {
+					slave.need = (slave.need * 0.5);
+				} else if (slave.aphrodisiacs === 1) {
+					slave.need = (slave.need * 1.5);
+				} else if (slave.aphrodisiacs === 2) {
+					slave.need = (slave.need * 2);
+				}
+				poorHealthNeedReduction(slave);
+				slave.need = Math.round(slave.need);
+				slave.needCap = slave.need;
+			}
+		}
+
+		if (slave.fetish === "mindbroken" && slave.relationship === -3) {
+			if (slave.kindness > 0) {
+				slave.kindness--;
+			}
+		}
+
+		if (slave.assignment === Job.AGENT || slave.assignment === Job.AGENTPARTNER) {
+			App.EndWeek.saAgent(slave);
+		}
+	} // for (const slave of V.slaves)
+
+	if (V.HeadGirl !== 0) {
+		V.HGEnergy++;
+		const slave = slaveStateById(V.HeadGirl.ID);
+		if (V.personalAttention === PersonalAttention.SUPPORTHG) {
+			V.HGEnergy++;
+			if (slave.trust > 95) {
+				V.HGEnergy++;
+			}
+		}
+		if (arcology.FSChineseRevivalistLaw === 1) {
+			V.HGEnergy++;
+		}
+		if (slave.health.tired > 90) {
+			V.HGEnergy--;
+		}
+		if (canAchieveErection(slave)) {
+			V.HGCum = 2 + Math.trunc((slave.balls / 5) + (slave.energy / 95) + (slave.health.condition / 95) + (slave.devotion / 95) + (V.reproductionFormula * 5));
+		}
+	}
+
+	// Stud gets off based on impregnations, so we need to check and see if they actually do anyone
+	if (V.StudID) {
+		const stud = S.Stud;
+		V.StudCum = 2 + Math.trunc(((stud.balls / 5) + (stud.energy / 95) + (stud.health.condition / 95) + (stud.devotion / 95) + (V.reproductionFormula * 5) - (stud.health.tired / 25)) * healthPenalty(stud));
+		if (stud.drugs === "hyper testicle enhancement") {
+			V.StudCum += 3;
+		} else if (stud.drugs === "testicle enhancement") {
+			V.StudCum += 1;
+		}
+		if (stud.diet === "cum production") {
+			V.StudCum += 1;
+		}
+		let studCumLimit = V.StudCum;
+		for (const slave of V.slaves) {
+			if (studCumLimit === 0 || stud.need <= 0) {
+				break;
+			}
+			if (canGetPregnant(slave) && canBreed(stud, slave) && slave.ID !== V.StudID) {
+				stud.need -= 20;
+				if (stud.fetish === "pregnancy") {
+					stud.need -= 30;
+				}
+			}
+		}
+	}
+
+	if (V.averageDick > 0) {
+		V.averageDick = V.averageDick / V.slavesWithWorkingDicks;
+	}
+	V.freeSexualEnergy = V.PC.sexualEnergy - V.fuckSlaves;
+	const penthouseSlaves = App.Entity.facilities.penthouse.employees().length;
+	if (V.freeSexualEnergy > 0) {
+		if (V.freeSexualEnergy > penthouseSlaves / 2) {
+			V.freeSexualEnergy = 3;
+		} else if (V.freeSexualEnergy > penthouseSlaves / 4) {
+			V.freeSexualEnergy = 2;
+		} else {
+			V.freeSexualEnergy = 1;
+		}
+	}
+
+	if (S.HeadGirl) {
+		const HGPossibleSlaves = [[], [], [], [], [], []];
+		for (const slave of V.slaves) {
+			if (!assignmentVisible(slave) || slave.fuckdoll === 1 || slave.ID === V.Bodyguard.ID || slave.ID === V.HeadGirl.ID || slave.fetish == "mindbroken") {
+				continue;
+			} else if (Array.isArray(V.personalAttention) && V.personalAttention.some(p => p.ID === slave.ID)) {
+				continue;
+			}
+
+			if ((V.headGirlTrainsHealth && slave.health.condition < -20)) {
+				HGPossibleSlaves[0].push({ID: slave.ID, training: "health"});
+				continue;
+			}
+
+			if (slave.health.tired < 50) {
+				const hasParaphilia = (["abusive", "anal addict", "attention whore", "breast growth", "breeder", "cum addict", "malicious", "neglectful", "self hating"].includes(slave.sexualFlaw));
+				if ((V.headGirlTrainsParaphilias && hasParaphilia)) {
+					HGPossibleSlaves[1].push({ID: slave.ID, training: "paraphilia"});
+					continue;
+				}
+
+				if (V.headGirlTrainsFlaws || V.headGirlSoftensFlaws) {
+					if (slave.behavioralFlaw !== "none" || (slave.sexualFlaw !== "none" && !hasParaphilia)) {
+						if (V.headGirlSoftensFlaws) {
+							if (slave.devotion > 20) {
+								if ((slave.behavioralFlaw !== "none" && slave.behavioralQuirk === "none") || (slave.sexualFlaw !== "none" && slave.sexualQuirk === "none" && !hasParaphilia)) {
+									HGPossibleSlaves[3].push({ID: slave.ID, training: "soften"});
+								} else {
+									HGPossibleSlaves[3].push({ID: slave.ID, training: "flaw"});
+								}
+								continue;
+							}
+						} else if (V.headGirlTrainsFlaws) {
+							HGPossibleSlaves[2].push({ID: slave.ID, training: "flaw"});
+							continue;
+						}
+					}
+				}
+
+				if ((V.headGirlTrainsObedience && slave.devotion <= 20 && slave.trust >= -20)) {
+					HGPossibleSlaves[4].push({ID: slave.ID, training: "obedience"});
+					continue;
+				}
+
+				if ((V.headGirlTrainsSkills)) {
+					if ((slave.skill.oral < S.HeadGirl.skill.oral)) {
+						HGPossibleSlaves[5].push({ID: slave.ID, training: "oral skill"});
+					} else if ((slave.skill.vaginal < S.HeadGirl.skill.vaginal) && (slave.vagina > 0) && (canDoVaginal(slave))) {
+						HGPossibleSlaves[5].push({ID: slave.ID, training: "fuck skill"});
+					} else if ((slave.skill.anal < S.HeadGirl.skill.anal) && (slave.anus > 0) && (canDoAnal(slave))) {
+						HGPossibleSlaves[5].push({ID: slave.ID, training: "anal skill"});
+					} else if ((slave.skill.whoring < S.HeadGirl.skill.whoring)) {
+						HGPossibleSlaves[5].push({ID: slave.ID, training: "whore skill"});
+					} else if ((slave.skill.entertainment < S.HeadGirl.skill.entertainment) && !isAmputee(slave)) {
+						HGPossibleSlaves[5].push({ID: slave.ID, training: "entertain skill"});
+					}
+				}
+			}
+		}
+		V.HGTrainSlavesIDs = HGPossibleSlaves.flatten().slice(0, V.HGEnergy);
+	} else {
+		V.HGTrainSlavesIDs = [];
+	}
+
+	/**
+	* Accordion
+	* @version 0.7RC
+	* @author 000-250-006
+	*
+	* @param array _facListArr V.args
+	*	Multidimensional temporary array
+	*	0: The passage name for the facility's report
+	*	1: The facility name capitalized (@see todo)
+	*	2: max number of slaves allowed in facility - > 0 implies open
+	*	3: number of slaves assigned to facility
+	*	4: ID of the slave assigned to run the facility ("Boss")
+	*	5: Text title of the Boss
+	*
+	* @todo This is a proof of concept construct, if it works and cuts overhead, intended to create an object
+	*	for deeper use in multiple locations, including streamlining reports/facilities code to one widget
+	* @todo Figure out if this would be better as an object rather than an array for overhead
+	*	StoryInit also?
+	* @todo Figure out why we're not using ndef/-1 for a bunch of these story variables. Leaky conditionals
+	* @todo Figure out why we're using variable space with capitalized facility names when we can parse it from true name
+	*/
+
+	const facListArr = [
+		["Arcade Report", App.Entity.facilities.arcade],
+		["Brothel Report", App.Entity.facilities.brothel],
+		["Cellblock Report", App.Entity.facilities.cellblock],
+		["Clinic Report", App.Entity.facilities.clinic],
+		["Club Report", App.Entity.facilities.club],
+		["Dairy Report", App.Entity.facilities.dairy],
+		["Farmyard Report", App.Entity.facilities.farmyard],
+		["Schoolroom Report", App.Entity.facilities.schoolroom],
+		["Spa Report", App.Entity.facilities.spa],
+		["Nursery Report", App.Entity.facilities.nursery],
+		["Servants' Quarters Report", App.Entity.facilities.servantsQuarters],
+		["Children Report", "Nursery Children", V.nursery, V.nurseryBabies],
+		["Incubator Report", App.Entity.facilities.incubator],
+		["Master Suite Report", App.Entity.facilities.masterSuite],
+		["Penthouse Report", "The Penthouse"],
+		["Rules Assistant Report", "Rules Assistant", V.rulesAssistantAuto], /** should be last — may reassign slaves **/
+		["Lab Report", "Lab", V.researchLab.level]
+	];
+
+	function _getReportElementStats(ar) {
+		if (typeof ar[1] == "string") {
+			if (ar[1] === "The Penthouse") { // special case because we have to combine several facilities
+				return {
+					name: ar[1],
+					established: 1,
+					entriesNumberInitial: initialPenthouseTotalEmployeesCount,
+					entriesNumber: _countPenthousePopulation(),
+					manager: null
+				};
+			} else {
+				return {
+					name: ar[1],
+					established: ar[2],
+					entriesNumberInitial: null,
+					entriesNumber: ar[3],
+					manager: null
+				};
+			}
+		} else {
+			return {
+				name: ar[1].nameCaps,
+				established: ar[1].established,
+				entriesNumberInitial: initialEmployeesCount[ar[1].desc.baseName],
+				entriesNumber: ar[1].hostedSlaves,
+				manager: ar[1].manager
+			};
+		}
+	}
+
+	const buttonClasses = V.useAccordion > 0 ? ["buttonBar", "accordion"] : ["buttonBar"];  // Is Accordion turned on?
+	const disTxt = V.useAccordion > 0 ? "" : " disabled='disabled'";  // Chunk the row from our array we're working on to make reading code easier, null some text vars we'll need
+	for (const facSubArr of facListArr) {
+		const reportContent = document.createElement("div");
+		App.UI.DOM.includePassage(reportContent, facSubArr[0]);
+		if (V.useAccordion === 1) {
+			reportContent.className = "accHidden";
+		}
+
+		const stats = _getReportElementStats(facSubArr); // needs to be inside the loop after the report passage to get the employees number after re-assignments
+
+		const str = facSubArr[0].replace(/\W+/g, '-').toLowerCase(); // Normalize the passage name to use as an element ID
+		if (stats.established) { /** Do we have one of these facilities? */
+			if (stats.entriesNumber === 0 && !stats.manager) { // Is there anyone inside the facility?
+				// No — it's empty, so we display the heading without a button and with a thinner bar under it
+				App.UI.DOM.appendNewElement("strong", res, `${stats.name} Report`);
+				App.UI.DOM.appendNewElement("hr", res).style.margin = "0";
+				App.UI.DOM.appendNewElement("span", res, `${stats.name} is currently empty`, "gray");
+				App.UI.DOM.appendNewElement("br", res);
+				App.UI.DOM.appendNewElement("br", res);
+				/** Old code: <<= '<div id="button-' + _str + '" class="unStaffed">' + _facSubArr[1] + ' is currently unstaffed</div>'>> */
+			} else {
+				const btn = App.UI.DOM.appendNewElement("button", res, `${stats.name}  Report`, buttonClasses);
+				btn.type = "button" + disTxt;
+				btn.id = `button-${str}`;
+				if (_.isNil(stats.entriesNumber)) {
+					// Yes, display the bar with information
+					btn.setAttribute("data-after", '');
+				} else {
+					// Yes, display the bar with information
+					const diffNum = stats.entriesNumber - stats.entriesNumberInitial;
+					let diffText = diffNum === 0 ? "" : (diffNum > 0 ? ` (+${diffNum})` : ` (${diffNum})`);
+					btn.setAttribute("data-after", `${stats.entriesNumber}${diffText} slave${stats.entriesNumber !== 1 ? 's': ''} in ${stats.name}`);
+				}
+			}
+			res.appendChild(reportContent);
+		}
+	}
+
+	/* IMPORTANT FOR REASONS!!! */
+	// <<unset _ii>>
+	/** /Accordion */
+
+	/* release loading screen as soon as the event loop can run */
+	//App.UI.EndWeekAnim.end();
+
+	return res;
+
+	function _countPenthousePopulation() {
+		const fs = App.Entity.facilities;
+		return fs.penthouse.employeesIDs().size + fs.headGirlSuite.totalEmployeesCount + fs.armory.totalEmployeesCount;
+	}
+
+	function _printSlaveError(warning, slave) {
+		const warningLine = App.UI.DOM.appendNewElement("div", res);
+		App.UI.DOM.appendNewElement("span", warningLine, warning + `for ${slave.slaveName}.`, "yellow");
+		warningLine.appendChild(document.createTextNode(" Report this as a bug if it reoccurs."));
+	}
+
+	/**
+	 * Check key employees. Fire those who do not satisfy their job requirements
+	 * @param {App.Entity.SlaveState} slave
+	 */
+	function _ensureEmployeeMeetsJobRequirements(slave) {
+		switch (slave.assignment) {
+			case Job.HEADGIRL:
+				V.HeadGirl = slave;
+				if (V.HeadGirl.fetish === "mindbroken") {
+					_printSlaveUnassignedNote(slave, "is mindbroken");
+					V.HeadGirl = 0;
+				} else if (!canTalk(V.HeadGirl)) {
+					_printSlaveUnassignedNote(slave, "can't give slaves verbal orders");
+					V.HeadGirl = 0;
+				} else if (!canWalk(V.HeadGirl)) {
+					_printSlaveUnassignedNote(slave, "is no longer independently mobile");
+					V.HeadGirl = 0;
+				} else if (!canHold(V.HeadGirl)) {
+					_printSlaveUnassignedNote(slave, "is no longer able to handle your slaves");
+					V.HeadGirl = 0;
+				} else if (!canSee(V.HeadGirl)) {
+					_printSlaveUnassignedNote(slave, "can no longer see");
+					V.HeadGirl = 0;
+				} else if (!canHear(V.HeadGirl)) {
+					_printSlaveUnassignedNote(slave, "can no longer hear");
+					V.HeadGirl = 0;
+				} else if (V.HeadGirl.preg > 37 && V.HeadGirl.broodmother === 2) {
+					_printSlaveUnassignedNote(slave, "spends so much time giving birth and laboring that", `${getPronouns(slave).he} cannot effectively serve as your Head Girl any longer`);
+					V.HeadGirl = 0;
+				} else if (V.HeadGirl.devotion <= 20) {
+					_printSlaveUnassignedNote(slave, "is no longer even accepting of you");
+					V.HeadGirl = 0;
+				}
+				if (V.HeadGirl === 0) {
+					removeJob(slave, Job.HEADGIRL);
+				}
+				break;
+			case Job.RECRUITER:
+				V.Recruiter = slave;
+				if (slave.fetish === "mindbroken") {
+					_printSlaveUnassignedNote(slave, "is mindbroken");
+					V.Recruiter = 0;
+				} else if (!canTalk(slave)) {
+					_printSlaveUnassignedNote(slave, "can't verbally entice marks");
+					V.Recruiter = 0;
+				} else if (slave.preg > 37 && slave.broodmother === 2) {
+					_printSlaveUnassignedNote(slave, "spends so much time giving birth and laboring that", `${getPronouns(slave).he} cannot effectively serve as your recruiter any longer`);
+					V.Recruiter = 0;
+				} else if (!canWalk(slave)) {
+					_printSlaveUnassignedNote(slave, "is no longer independently mobile");
+					V.Recruiter = 0;
+				} else if (!canSee(slave)) {
+					_printSlaveUnassignedNote(slave, "can no longer see");
+					V.Recruiter = 0;
+				} else if (!canHear(V.Recruiter)) {
+					_printSlaveUnassignedNote(slave, "an no longer hear");
+					V.Recruiter = 0;
+				}
+				if (V.Recruiter === 0) {
+					removeJob(slave, Job.RECRUITER);
+				}
+				break;
+			case Job.MADAM:
+				if (V.unMadam === 1) {
+					_printSlaveUnassignedNote(slave, "can't give whores verbal orders");
+				} else if (V.unMadam === 2) {
+					_printSlaveUnassignedNote(slave, "spends so much time giving birth and laboring that", `${getPronouns(slave).he} cannot effectively serve as your Madam any longer`);
+				} else if (V.unMadam === 3) {
+					_printSlaveUnassignedNote(slave, "is mindbroken");
+				} else if (V.unMadam === 4) {
+					_printSlaveUnassignedNote(slave, "is no longer independently mobile");
+				} else if (V.unMadam === 5) {
+					_printSlaveUnassignedNote(slave, "can no longer see");
+				} else if (V.unMadam === 6) {
+					_printSlaveUnassignedNote(slave, "can no longer hear");
+				} else if (V.unMadam === 7) {
+					_printSlaveUnassignedNote(slave, `can no longer handle ${getPronouns(slave).his} underlings`);
+				}
+				if (V.Madam === 0) {
+					removeJob(slave, Job.MADAM);
+				}
+				break;
+			case Job.DJ:
+				if (V.unDJ === 1) {
+					_printSlaveUnassignedNote(slave, "can't speak");
+				} else if (V.unDJ === 2) {
+					_printSlaveUnassignedNote(slave, "spends so much time giving birth and laboring that", `${getPronouns(slave).he} cannot effectively serve as your DJ any longer`);
+				} else if (V.unDJ === 3) {
+					_printSlaveUnassignedNote(slave, "is mindbroken");
+				} else if (V.unDJ === 4) {
+					_printSlaveUnassignedNote(slave, "is no longer independently mobile");
+				} else if (V.unDJ === 5) {
+					_printSlaveUnassignedNote(slave, "can no longer hear");
+				}
+				if (V.DJ === 0) {
+					removeJob(slave, Job.DJ);
+				}
+				break;
+			case Job.MILKMAID:
+				V.Milkmaid = slave;
+				if (V.Milkmaid.fetish === "mindbroken") {
+					_printSlaveUnassignedNote(slave, "is mindbroken");
+					V.Milkmaid = 0;
+				} else if (V.Milkmaid.preg > 37 && V.Milkmaid.broodmother === 2) {
+					_printSlaveUnassignedNote(slave, "spends so much time giving birth and laboring that", `${getPronouns(slave).he} cannot effectively serve as your Milkmaid any longer`);
+					V.Milkmaid = 0;
+				} else if (!canWalk(V.Milkmaid)) {
+					_printSlaveUnassignedNote(slave, "is no longer independently mobile");
+					V.Milkmaid = 0;
+				} else if (!canHold(V.Milkmaid)) {
+					_printSlaveUnassignedNote(slave, "can no longer handle nor milk your slaves");
+					V.Milkmaid = 0;
+				} else if (!canSee(V.Milkmaid)) {
+					_printSlaveUnassignedNote(slave, "can no longer see");
+					V.Milkmaid = 0;
+				} else if (!canHear(V.Milkmaid)) {
+					_printSlaveUnassignedNote(slave, "can no longer hear");
+					V.Milkmaid = 0;
+				}
+				if (V.Milkmaid === 0) {
+					removeJob(slave, Job.MILKMAID);
+				}
+				break;
+			case Job.FARMER:
+				V.Farmer = slave;
+				if (V.Farmer.fetish === "mindbroken") {
+					_printSlaveUnassignedNote(slave, "is mindbroken");
+					V.Farmer = 0;
+				} else if (V.Farmer.preg > 37 && V.Farmer.broodmother === 2) {
+					_printSlaveUnassignedNote(slave, "spends so much time giving birth and laboring that", `${getPronouns(slave).he} cannot effectively serve as your Farmer any longer`);
+					V.Farmer = 0;
+				} else if (!canWalk(V.Farmer)) {
+					_printSlaveUnassignedNote(slave, "is no longer independently mobile");
+					V.Farmer = 0;
+				} else if (!canHold(V.Farmer)) {
+					_printSlaveUnassignedNote(slave, "can no longer grip things");
+					V.Farmer = 0;
+				} else if (!canSee(V.Farmer)) {
+					_printSlaveUnassignedNote(slave, "can no longer see");
+					V.Farmer = 0;
+				} else if (!canHear(V.Farmer)) {
+					_printSlaveUnassignedNote(slave, "can no longer hear");
+					V.Farmer = 0;
+				}
+				if (V.Farmer === 0) {
+					removeJob(slave, Job.FARMER);
+				}
+				break;
+			case Job.STEWARD:
+				V.Stewardess = slave;
+				if (!canTalk(slave)) {
+					_printSlaveUnassignedNote(slave, "can't give servants verbal orders");
+					V.Stewardess = 0;
+				} else if (slave.preg > 37 && slave.broodmother === 2) {
+					_printSlaveUnassignedNote(slave, "spends so much time giving birth and laboring that", `${getPronouns(slave).he} cannot effectively serve as your Stewardess any longer`);
+					V.Stewardess = 0;
+				} else if (slave.fetish === "mindbroken") {
+					_printSlaveUnassignedNote(slave, "is mindbroken");
+					V.Stewardess = 0;
+				} else if (!canWalk(slave)) {
+					_printSlaveUnassignedNote(slave, "is no longer independently mobile");
+					V.Stewardess = 0;
+				} else if (!canHold(slave)) {
+					_printSlaveUnassignedNote(slave, `can no longer handle ${getPronouns(slave).his} underlings nor effectively clean`);
+					V.Stewardess = 0;
+				} else if (!canSee(slave)) {
+					_printSlaveUnassignedNote(slave, "can no longer see");
+					V.Stewardess = 0;
+				} else if (!canHear(slave)) {
+					_printSlaveUnassignedNote(slave, "can no longer hear");
+					V.Stewardess = 0;
+				}
+				if (V.Stewardess === 0) {
+					removeJob(slave, Job.STEWARD);
+				}
+				break;
+			case Job.TEACHER:
+				V.Schoolteacher = slave;
+				if (!canTalk(slave)) {
+					_printSlaveUnassignedNote(slave, "can't give verbal instruction");
+					V.Schoolteacher = 0;
+				} else if (slave.preg > 37 && slave.broodmother === 2) {
+					_printSlaveUnassignedNote(slave, "spends so much time giving birth and laboring that", `${getPronouns(slave).he} cannot effectively serve as your Schoolteacher any longer`);
+					V.Schoolteacher = 0;
+				} else if (slave.fetish === "mindbroken") {
+					_printSlaveUnassignedNote(slave, "is mindbroken");
+					V.Schoolteacher = 0;
+				} else if (!canSee(slave)) {
+					_printSlaveUnassignedNote(slave, "can no longer see");
+					V.Schoolteacher = 0;
+				} else if (!canHear(slave)) {
+					_printSlaveUnassignedNote(slave, "can no longer hear");
+					V.Schoolteacher = 0;
+				}
+				if (V.Schoolteacher === 0) {
+					removeJob(slave, Job.TEACHER);
+				}
+				break;
+			case Job.WARDEN:
+				V.Wardeness = slave;
+				if (!canWalk(slave)) {
+					_printSlaveUnassignedNote(slave, "is no longer independently mobile");
+					V.Wardeness = 0;
+				} else if (!canHold(slave)) {
+					_printSlaveUnassignedNote(slave, `can no longer handle ${getPronouns(slave).his} charges`);
+					V.Wardeness = 0;
+				} else if (slave.preg > 37 && slave.broodmother === 2) {
+					_printSlaveUnassignedNote(slave, "spends so much time giving birth and laboring that", `${getPronouns(slave).he} cannot effectively serve as your Wardeness any longer`);
+					V.Wardeness = 0;
+				} else if (!canSee(slave)) {
+					_printSlaveUnassignedNote(slave, "can no longer see");
+					V.Wardeness = 0;
+				} else if (!canHear(slave)) {
+					_printSlaveUnassignedNote(slave, "can no longer hear");
+					V.Wardeness = 0;
+				}
+				if (V.Wardeness === 0) {
+					removeJob(slave, Job.WARDEN);
+				}
+				break;
+			case Job.ATTENDANT:
+				if (slave.fetish === "mindbroken") {
+					_printSlaveUnassignedNote(slave, "is mindbroken");
+					V.AttendantID = 0;
+				} else if (slave.preg > 37 && slave.broodmother === 2) {
+					_printSlaveUnassignedNote(slave, "spends so much time giving birth and laboring that", `${getPronouns(slave).he} cannot effectively serve as your Attendant any longer`);
+					V.AttendantID = 0;
+				} else if (!canWalk(slave)) {
+					_printSlaveUnassignedNote(slave, "is no longer independently mobile");
+					V.AttendantID = 0;
+				} else if (!canHold(slave)) {
+					_printSlaveUnassignedNote(slave, `can no longer support ${getPronouns(slave).his} charges`);
+					V.AttendantID = 0;
+				} else if (!canHear(slave)) {
+					_printSlaveUnassignedNote(slave, "can no longer hear");
+					V.AttendantID = 0;
+				}
+				if (V.AttendantID === 0) {
+					removeJob(slave, Job.ATTENDANT);
+				}
+				break;
+			case Job.MATRON:
+				V.Matron = slave;
+				if (slave.fetish === "mindbroken") {
+					_printSlaveUnassignedNote(slave, "is mindbroken");
+					V.Matron = 0;
+				} else if (slave.preg > 37 && slave.broodmother === 2) {
+					_printSlaveUnassignedNote(slave, "spends so much time giving birth and laboring that", `${getPronouns(slave).he} cannot effectively serve as your Matron any longer`);
+					V.Matron = 0;
+				} else if (!canWalk(slave)) {
+					_printSlaveUnassignedNote(slave, "is no longer independently mobile");
+					V.Matron = 0;
+				} else if (!canHold(slave)) {
+					_printSlaveUnassignedNote(slave, "can no longer hold infants");
+					V.Matron = 0;
+				} else if (!canHear(slave)) {
+					_printSlaveUnassignedNote(slave, "can no longer hear");
+					V.Matron = 0;
+				} else if (!canSee(slave)) {
+					_printSlaveUnassignedNote(slave, "can no longer see");
+					V.Matron = 0;
+				}
+				if (V.Matron === 0) {
+					removeJob(slave, Job.MATRON);
+				}
+				break;
+			case Job.NURSE:
+				V.Nurse = slave;
+				if (slave.fetish === "mindbroken") {
+					_printSlaveUnassignedNote(slave, "is mindbroken");
+					V.Nurse = 0;
+				} else if (slave.preg > 37 && slave.broodmother === 2) {
+					_printSlaveUnassignedNote(slave, "spends so much time giving birth and laboring that", `${getPronouns(slave).he} cannot effectively serve as your Nurse any longer`);
+					V.Nurse = 0;
+				} else if (!canWalk(slave)) {
+					_printSlaveUnassignedNote(slave, "is no longer independently mobile");
+					V.Nurse = 0;
+				} else if (!canHold(slave)) {
+					_printSlaveUnassignedNote(slave, "can no longer hold onto patients");
+					V.Nurse = 0;
+				} else if (!canSee(slave)) {
+					_printSlaveUnassignedNote(slave, "can no longer see");
+					V.Nurse = 0;
+				} else if (!canHear(slave)) {
+					_printSlaveUnassignedNote(slave, "can no longer hear");
+					V.Nurse = 0;
+				}
+				if (V.Nurse === 0) {
+					removeJob(slave, Job.NURSE);
+				}
+				break;
+			case Job.BODYGUARD:
+				V.Bodyguard = slave;
+				if (slave.fetish === "mindbroken") {
+					_printSlaveUnassignedNote(slave, "is mindbroken");
+					V.Bodyguard = 0;
+				} else if (!canWalk(slave)) {
+					_printSlaveUnassignedNote(slave, "is no longer independently mobile");
+					V.Bodyguard = 0;
+				} else if (!canHold(slave)) {
+					_printSlaveUnassignedNote(slave, "is no longer able to hold a weapon");
+					V.Bodyguard = 0;
+				} else if (slave.preg > 37 && slave.broodmother === 2) {
+					_printSlaveUnassignedNote(slave, "spends so much time giving birth and laboring that", `${getPronouns(slave).he} cannot effectively serve as your bodyguard any longer`);
+					V.Bodyguard = 0;
+				} else if (!canSee(slave)) {
+					_printSlaveUnassignedNote(slave, "can no longer see");
+					V.Bodyguard = 0;
+				} else if (!canHear(slave)) {
+					_printSlaveUnassignedNote(slave, "can no longer hear");
+					V.Bodyguard = 0;
+				}
+				if (V.Bodyguard === 0) {
+					removeJob(slave, Job.BODYGUARD);
+				}
+				break;
+			case Job.SUBORDINATE:
+				if (slave.subTarget === -1) {
+					V.StudID = slave.ID;
+					if (slave.balls === 0) {
+						_printSlaveUnassignedNote(slave, "no longer has sperm", null, "@Stud");
+						V.StudID = 0;
+					} else if (slave.ballType === "sterile") {
+						_printSlaveUnassignedNote(slave, "no longer produces potent sperm", null, "@Stud");
+						V.StudID = 0;
+					} else if (slave.pubertyXY !== 1) {
+						_printSlaveUnassignedNote(slave, "no longer produces mature sperm", null, "@Stud");
+						V.StudID = 0;
+					} else if (slave.vasectomy === 1) {
+						_printSlaveUnassignedNote(slave, "shoots blanks due to a vasectomy", null, "@Stud");
+						V.StudID = 0;
+					} else if (V.universalRulesImpregnation !== "Stud") {
+						_printSlaveUnassignedNote(slave, "is", "no longer needed as a Stud", "@Stud");
+					}
+					if (V.StudID === 0) {
+						slave.subTarget = 0;
+					}
+				}
+		}
+
+		if (slave.ID === V.LurcherID) {
+			if (!canWalk(slave)) {
+				_printSlaveUnassignedNote(slave, "is no longer able to run", null, Job.LURCHER);
+				V.LurcherID = 0;
+			} else if (!canHold(slave)) {
+				_printSlaveUnassignedNote(slave, "is no longer able to catch the hares", null, Job.LURCHER);
+				V.LurcherID = 0;
+			} else if (!canHear(slave) && !canSee(slave)) {
+				_printSlaveUnassignedNote(slave, "is no longer able to track the hares", null, Job.LURCHER);
+				V.LurcherID = 0;
+			} else if (slave.bellyPreg >= 60000) {
+				_printSlaveUnassignedNote(slave, "is too pregnant to run", null, Job.LURCHER);
+				V.LurcherID = 0;
+			}
+		}
+
+		if (V.fighterIDs.includes(slave)) {
+			if (!canWalk(slave)) {
+				_printSlaveUnassignedNote(slave, "is no longer independently mobile",
+					`and cannot fight any more. ${getPronouns(slave).he} has been removed from ${App.Entity.facilities.pit.name} roster`);
+				V.fighterIDs.delete(slave.ID);
+			} else if (!canHold(slave)) {
+				_printSlaveUnassignedNote(slave, "is no longer able to strike",
+					`and cannot fight any more. ${getPronouns(slave).he} has been removed from ${App.Entity.facilities.pit.name} roster`);
+				V.fighterIDs.delete(slave.ID);
+			}
+		}
+
+		if (slave.bellyPain !== 0) {
+			slave.bellyPain = 0;
+		}
+
+		/* preg speed and advance*/
+
+		if (slave.preg > 0) {
+			let pregSpeed = 1; // base speed is normal
+			if (slave.pregControl === "slow gestation") {
+				pregSpeed = 0.5;
+			} else if (slave.pregControl === "speed up") {
+				pregSpeed = 2;
+			}
+
+			if (slave.broodmother === 1 && slave.broodmotherOnHold !== 1) { /* broodmother advance block */
+				if ((V.week / slave.broodmotherFetuses === Math.round(V.week / slave.broodmotherFetuses)) && slave.broodmotherFetuses < 1) {
+					// one fetus in few week - selection and adding
+					WombImpregnate(slave, 1, slave.pregSource, 0);
+				} else {
+					// one or more fetuses in one week
+					WombImpregnate(slave, Math.floor(slave.broodmotherFetuses), slave.pregSource, 0); /* really 0, it's will be advanced right few lines down.*/
+				}
+				if (slave.ovaryAge >= 47) {
+					slave.broodmotherOnHold = 1;
+					slave.broodmotherCountDown = 37 - WombMinPreg(slave);
+				}
+			}
+
+			WombProgress(slave, pregSpeed, 1); /* drugs can affect speed of gestation, but not a real time */
+
+			slave.pregKnown = 1;
+			slave.pregWeek++;
+		}
+		if (slave.pregWeek < 0) { // postpartum state
+			slave.pregWeek++;
+		}
+
+		SetBellySize(slave); /* here will be also set through WombGetVolume .bellyPreg, .pregType, to current values. */
+
+		/* end of preg speed and advance*/
+
+		/* set up sexual need */
+		if (slave.devotion >= -50) {
+			if (slave.energy > 20) {
+				if (slave.physicalAge < slave.pubertyAgeXY && slave.genes === "XY" && slave.energy <= 80) {
+					slave.need = slave.energy / 3;
+				} else if (slave.physicalAge < slave.pubertyAgeXX && slave.genes === "XX" && slave.energy <= 80) {
+					slave.need = slave.energy / 3;
+				} else if (slave.physicalAge < 50) {
+					slave.need = slave.energy;
+				} else {
+					slave.need = slave.energy / 5;
+				}
+				if (slave.balls > 0 && slave.pubertyXY === 1 && slave.physicalAge <= (slave.pubertyAgeXY + 1) && (slave.physicalAge > slave.pubertyAgeXY) && slave.physicalAge < 18) {
+					slave.need = (slave.need * 1.25);
+				}
+				if ((slave.ovaries === 1 || slave.mpreg === 1) && slave.pubertyXX === 1 && slave.physicalAge <= (slave.pubertyAgeXX + 1) && (slave.physicalAge > slave.pubertyAgeXX) && slave.physicalAge < 18) {
+					slave.need = (slave.need * 1.25);
+				}
+				if (slave.diet === "fertility") {
+					slave.need += 10;
+				}
+				if (slave.aphrodisiacs === -1) {
+					slave.need = (slave.need * 0.5);
+				} else if (slave.aphrodisiacs === 1) {
+					slave.need = (slave.need * 1.5);
+				} else if (slave.aphrodisiacs === 2) {
+					slave.need = (slave.need * 2);
+				}
+				poorHealthNeedReduction(slave);
+				slave.need = Math.round(slave.need);
+				slave.needCap = slave.need;
+			}
+		}
+
+		if (slave.fetish === "mindbroken" && slave.relationship === -3) {
+			if (slave.kindness > 0) {
+				slave.kindness--;
+			}
+		}
+
+		if (slave.assignment === Job.AGENT || slave.assignment === Job.AGENTPARTNER) {
+			App.SlaveAssignment.agent(slave);
+		}
+	} // for (const slave of V.slaves)
+
+	// Stud gets off based on impregnations, so we need to check and see if they actually do anyone
+	if (V.StudID) {
+		const stud = S.Stud;
+		let studCumLimit = V.StudCum;
+		for (const slave of V.slaves) {
+			if (studCumLimit === 0 || stud.need <= 0) {
+				break;
+			}
+			if (canGetPregnant(slave) && canBreed(stud, slave) && slave.ID != V.StudID) {
+				stud.need -= 20;
+				if (stud.fetish === "pregnancy") {
+					stud.need -= 30;
+				}
+			}
+		}
+	}
+
+	if (V.averageDick > 0) {
+		V.averageDick = V.averageDick / V.slavesWithWorkingDicks;
+	}
+	V.freeSexualEnergy = V.PC.sexualEnergy - V.fuckSlaves;
+	const penthouseSlaves = App.Entity.facilities.penthouse.employees().length;
+	if (V.freeSexualEnergy > 0) {
+		if (V.freeSexualEnergy > penthouseSlaves / 2) {
+			V.freeSexualEnergy = 3;
+		} else if (V.freeSexualEnergy > penthouseSlaves / 4) {
+			V.freeSexualEnergy = 2;
+		} else {
+			V.freeSexualEnergy = 1;
+		}
+	}
+
+	if (S.HeadGirl) {
+		const HGPossibleSlaves = [[], [], [], [], [], []];
+		for (const slave of V.slaves) {
+			if (!assignmentVisible(slave) || slave.fuckdoll === 1 || slave.ID === V.Bodyguard.ID || slave.ID === V.HeadGirl.ID || slave.fetish == "mindbroken") {
+				continue;
+			} else if (Array.isArray(V.personalAttention) && V.personalAttention.some(p => p.ID === slave.ID)) {
+				continue;
+			}
+
+			if ((V.headGirlTrainsHealth && slave.health.condition < -20)) {
+				HGPossibleSlaves[0].push({ID: slave.ID, training: "health"});
+				continue;
+			}
+
+			if (slave.health.tired < 50) {
+				const hasParaphilia = (["abusive", "anal addict", "attention whore", "breast growth", "breeder", "cum addict", "malicious", "neglectful", "self hating"].includes(slave.sexualFlaw));
+				if ((V.headGirlTrainsParaphilias && hasParaphilia)) {
+					HGPossibleSlaves[1].push({ID: slave.ID, training: "paraphilia"});
+					continue;
+				}
+
+				if (V.headGirlTrainsFlaws || V.headGirlSoftensFlaws) {
+					if (slave.behavioralFlaw !== "none" || (slave.sexualFlaw !== "none" && !hasParaphilia)) {
+						if (V.headGirlSoftensFlaws) {
+							if (slave.devotion > 20) {
+								if ((slave.behavioralFlaw !== "none" && slave.behavioralQuirk === "none") || (slave.sexualFlaw !== "none" && slave.sexualQuirk == "none" && !hasParaphilia)) {
+									HGPossibleSlaves[3].push({ID: slave.ID, training: "soften"});
+								} else {
+									HGPossibleSlaves[3].push({ID: slave.ID, training: "flaw"});
+								}
+								continue;
+							}
+						} else if (V.headGirlTrainsFlaws) {
+							HGPossibleSlaves[2].push({ID: slave.ID, training: "flaw"});
+							continue;
+						}
+					}
+				}
+
+				if ((V.headGirlTrainsObedience && slave.devotion <= 20 && slave.trust >= -20)) {
+					HGPossibleSlaves[4].push({ID: slave.ID, training: "obedience"});
+					continue;
+				}
+
+				if ((V.headGirlTrainsSkills)) {
+					if ((slave.skill.oral < S.HeadGirl.skill.oral)) {
+						HGPossibleSlaves[5].push({ID: slave.ID, training: "oral skill"});
+					} else if ((slave.skill.vaginal < S.HeadGirl.skill.vaginal) && (slave.vagina > 0) && (canDoVaginal(slave))) {
+						HGPossibleSlaves[5].push({ID: slave.ID, training: "fuck skill"});
+					} else if ((slave.skill.anal < S.HeadGirl.skill.anal) && (slave.anus > 0) && (canDoAnal(slave))) {
+						HGPossibleSlaves[5].push({ID: slave.ID, training: "anal skill"});
+					} else if ((slave.skill.whoring < S.HeadGirl.skill.whoring)) {
+						HGPossibleSlaves[5].push({ID: slave.ID, training: "whore skill"});
+					} else if ((slave.skill.entertainment < S.HeadGirl.skill.entertainment) && !isAmputee(slave)) {
+						HGPossibleSlaves[5].push({ID: slave.ID, training: "entertain skill"});
+					}
+				}
+			}
+		}
+		V.HGTrainSlavesIDs = HGPossibleSlaves.flatten().slice(0, V.HGEnergy);
+	} else {
+		V.HGTrainSlavesIDs = [];
+	}
+
+	/**
+	* Accordion
+	* @version 0.7RC
+	* @author 000-250-006
+	*
+	* @param array _facListArr V.args
+	*	Multidimensional temporary array
+	*	0: The passage name for the facility's report
+	*	1: The facility name capitalized (@see todo)
+	*	2: max number of slaves allowed in facility - > 0 implies open
+	*	3: number of slaves assigned to facility
+	*	4: ID of the slave assigned to run the facility ("Boss")
+	*	5: Text title of the Boss
+	*
+	* @todo This is a proof of concept construct, if it works and cuts overhead, intended to create an object
+	*	for deeper use in multiple locations, including streamlining reports/facilities code to one widget
+	* @todo Figure out if this would be better as an object rather than an array for overhead
+	*	StoryInit also?
+	* @todo Figure out why we're not using ndef/-1 for a bunch of these story variables. Leaky conditionals
+	* @todo Figure out why we're using variable space with capitalized facility names when we can parse it from true name
+	*/
+
+	const facListArr = [
+		["Arcade Report", App.Entity.facilities.arcade],
+		["Brothel Report", App.Entity.facilities.brothel],
+		["Cellblock Report", App.Entity.facilities.cellblock],
+		["Clinic Report", App.Entity.facilities.clinic],
+		["Club Report", App.Entity.facilities.club],
+		["Dairy Report", App.Entity.facilities.dairy],
+		["Farmyard Report", App.Entity.facilities.farmyard],
+		["Schoolroom Report", App.Entity.facilities.schoolroom],
+		["Spa Report", App.Entity.facilities.spa],
+		["Nursery Report", App.Entity.facilities.nursery],
+		["Servants' Quarters Report", App.Entity.facilities.servantsQuarters],
+		["Children Report", "Nursery Children", V.nursery, V.nurseryBabies],
+		["Incubator Report", App.Entity.facilities.incubator],
+		["Master Suite Report", App.Entity.facilities.masterSuite],
+		["Penthouse Report", "The Penthouse"],
+		["Rules Assistant Report", "Rules Assistant", V.rulesAssistantAuto], /** should be last — may reassign slaves **/
+		["Lab Report", "Lab", V.researchLab.level]
+	];
+
+	function _getReportElementStats(ar) {
+		if (typeof ar[1] == "string") {
+			if (ar[1] === "The Penthouse") { // special case because we have to combine several facilities
+				return {
+					name: ar[1],
+					established: 1,
+					entriesNumberInitial: initialPenthouseTotalEmployeesCount,
+					entriesNumber: _countPenthousePopulation(),
+					manager: null
+				};
+			} else {
+				return {
+					name: ar[1],
+					established: ar[2],
+					entriesNumberInitial: null,
+					entriesNumber: ar[3],
+					manager: null
+				};
+			}
+		} else {
+			return {
+				name: ar[1].nameCaps,
+				established: ar[1].established,
+				entriesNumberInitial: initialEmployeesCount[ar[1].desc.baseName],
+				entriesNumber: ar[1].hostedSlaves,
+				manager: ar[1].manager
+			};
+		}
+	}
+
+	const buttonClasses = V.useAccordion > 0 ? ["buttonBar", "accordion"] : ["buttonBar"];  // Is Accordion turned on?
+	const disTxt = V.useAccordion > 0 ? "" : " disabled='disabled'";  // Chunk the row from our array we're working on to make reading code easier, null some text vars we'll need
+	for (const facSubArr of facListArr) {
+		const reportContent = document.createElement("div");
+		App.UI.DOM.includePassage(reportContent, facSubArr[0]);
+		if (V.useAccordion === 1) {
+			reportContent.className = "accHidden";
+		}
+
+		const stats = _getReportElementStats(facSubArr); // needs to be inside the loop after the report passage to get the employees number after re-assignments
+
+		const str = facSubArr[0].replace(/\W+/g, '-').toLowerCase(); // Normalize the passage name to use as an element ID
+		if (stats.established) { /** Do we have one of these facilities? */
+			if (stats.entriesNumber === 0 && !stats.manager) { // Is there anyone inside the facility?
+				// No — it's empty, so we display the heading without a button and with a thinner bar under it
+				App.UI.DOM.appendNewElement("strong", res, `${stats.name} Report`);
+				App.UI.DOM.appendNewElement("hr", res).style.margin = "0";
+				App.UI.DOM.appendNewElement("span", res, `${stats.name} is currently empty`, "gray");
+				App.UI.DOM.appendNewElement("br", res);
+				App.UI.DOM.appendNewElement("br", res);
+				/** Old code: <<= '<div id="button-' + _str + '" class="unStaffed">' + _facSubArr[1] + ' is currently unstaffed</div>'>> */
+			} else {
+				const btn = App.UI.DOM.appendNewElement("button", res, `${stats.name}  Report`, buttonClasses);
+				btn.type = "button" + disTxt;
+				btn.id = `button-${str}`;
+				if (_.isNil(stats.entriesNumber)) {
+					// Yes, display the bar with information
+					btn.setAttribute("data-after", '');
+				} else {
+					// Yes, display the bar with information
+					const diffNum = stats.entriesNumber - stats.entriesNumberInitial;
+					let diffText = diffNum === 0 ? "" : (diffNum > 0 ? ` (+${diffNum})` : ` (${diffNum})`);
+					btn.setAttribute("data-after", `${stats.entriesNumber}${diffText} slave${stats.entriesNumber !== 1 ? 's': ''} in ${stats.name}`);
+				}
+			}
+			res.appendChild(reportContent);
+		}
+	}
+
+	/* IMPORTANT FOR REASONS!!! */
+	// <<unset _ii>>
+	/** /Accordion */
+
+	/* release loading screen as soon as the event loop can run */
+	//App.UI.EndWeekAnim.end();
+
+	return res;
+
+	/**
+	 * @param {DocumentFragment} c
+	 */
+	function _printDebugInfo(c) {
+		c.appendChild(document.createElement("br"));
+		c.appendChild(document.createTextNode("Slave services supply and demand this week:"));
+
+		const table = App.UI.DOM.appendNewElement("table", c, null, "finance");
+		table.border = "1";
+		const titleRow = App.UI.DOM.appendNewElement("tr", table);
+		titleRow.align = "center";
+		const tcl = App.UI.DOM.appendNewElement("th", titleRow, "Client's class");
+		tcl.align = "right";
+		App.UI.DOM.appendNewElement("th", titleRow, "Lower");
+		App.UI.DOM.appendNewElement("th", titleRow, "Middle");
+		App.UI.DOM.appendNewElement("th", titleRow, "Upper");
+		App.UI.DOM.appendNewElement("th", titleRow, "Top");
+
+		/**
+		 *
+		 * @param {string} caption
+		 * @param {number} [lower]
+		 * @param {number} [middle]
+		 * @param {number} [upper]
+		 * @param {number} [top]
+		 */
+		function numericRow(caption, lower, middle, upper, top) {
+			const row = App.UI.DOM.appendNewElement("tr", table);
+			row.align = "right";
+			App.UI.DOM.appendNewElement("td", row, caption);
+			App.UI.DOM.appendNewElement("td", row, lower == null ? "N/A" : commaNum(lower));
+			App.UI.DOM.appendNewElement("td", row, middle == null ? "N/A" : commaNum(middle));
+			App.UI.DOM.appendNewElement("td", row, upper == null ? "N/A" : commaNum(upper));
+			App.UI.DOM.appendNewElement("td", row, top == null ? "N/A" : commaNum(top));
+		}
+
+		numericRow("Demand", lowerClassSexDemand, middleClassSexDemand, upperClassSexDemand, topClassSexDemand);
+		numericRow("Brothel Supply", V.slaveJobValues.brothel.lowerClass, V.slaveJobValues.brothel.middleClass, V.slaveJobValues.brothel.upperClass, V.slaveJobValues.brothel.topClass);
+		if (clubSupply.lowerClass || clubSupply.middleClass) {
+			numericRow("Club Supply", clubSupply.lowerClass, clubSupply.middleClass);
+		}
+		if (arcadeSupply.lowerClass || arcadeSupply.middleClass || arcadeSupply.upperClass) {
+			numericRow("Arcade Supply", arcadeSupply.lowerClass, arcadeSupply.middleClass, arcadeSupply.upperClass);
+		}
+		numericRow("NPC Supply", V.NPCSexSupply.lowerClass, V.NPCSexSupply.middleClass, V.NPCSexSupply.upperClass, V.NPCSexSupply.topClass);
+		numericRow("Unsatisfied", lowerClassSexDemand, middleClassSexDemand, upperClassSexDemand, topClassSexDemand)
+	}
+
+	function _countPenthousePopulation() {
+		const fs = App.Entity.facilities;
+		return fs.penthouse.employeesIDs().size + fs.headGirlSuite.totalEmployeesCount + fs.armory.totalEmployeesCount
+	}
+
+	function _printSlaveError(warning, slave) {
+		const warningLine = App.UI.DOM.appendNewElement("div", res);
+		App.UI.DOM.appendNewElement("span", warningLine, warning + `for ${slave.slaveName}.`, "yellow");
+		warningLine.appendChild(document.createTextNode(" Report this as a bug if it reoccurs."));
+	}
+
+	/**
+	 *
+	 * @param {App.Entity.SlaveState} slave
+	 * @param {string} condition
+	 * @param {string} [outcome]
+	 * @param {string} [assignment]
+	 */
+	function _printSlaveUnassignedNote(slave, condition, outcome, assignment) {
+		const cantServeNotes = new Map([
+			[Job.HEADGIRL, "cannot serve as your Head Girl any more"],
+			[Job.RECRUITER, "and cannot serve as your recruiter any more"],
+			[Job.MADAM, "cannot serve as your Madam any more"],
+			[Job.DJ, "cannot serve as your DJ any more"],
+			[Job.MILKMAID, "cannot serve as your Milkmaid any more"],
+			[Job.FARMER, "cannot serve as your Farmer any more"],
+			[Job.STEWARD, "cannot serve as your Stewardess any more"],
+			[Job.TEACHER, "cannot serve as your Schoolteacher any more"],
+			[Job.WARDEN, "cannot serve as your Wardeness any more"],
+			[Job.ATTENDANT, "cannot serve as your Attendant any more"],
+			[Job.BODYGUARD, " cannot serve as your Bodyguard any more"],
+			["@Stud", "cannot serve as a Stud any more"],
+			[Job.NURSE, "cannot serve as your Nurse any more"],
+			[Job.MATRON, "cannot serve as your Matron any more"],
+			[Job.LURCHER, "cannot course as a lurcher"]
+		]);
+
+		const warningLine = App.UI.DOM.appendNewElement("div", res);
+		App.UI.DOM.appendNewElement("span", warningLine, slave.slaveName, 'slave-name');
+		warningLine.appendChild(document.createTextNode(' ' + condition + ' '));
+		App.UI.DOM.appendNewElement("span", warningLine, outcome ? outcome : `and ${cantServeNotes[assignment || slave.assignment]}`, "yellow");
+		warningLine.appendChild(document.createTextNode("."));
+	}
+};
diff --git a/src/events/RESS/lazyEvening.js b/src/events/RESS/lazyEvening.js
index acfb93d918f36ef97d1be93795c4f313909edb32..dca221a2357c5ac9506326f98d6e8d83789e03d6 100644
--- a/src/events/RESS/lazyEvening.js
+++ b/src/events/RESS/lazyEvening.js
@@ -9,7 +9,7 @@ App.Events.RESSLazyEvening = class RESSLazyEvening extends App.Events.BaseEvent
 				s => s.fetish !== "mindbroken",
 				hasAnyArms,
 				hasAnyLegs,
-				s => s.assignment === "please you",
+				s => s.assignment === Job.FUCKTOY,
 				s => s.devotion > 20,
 			]
 		];
diff --git a/src/events/RESS/moistPussy.js b/src/events/RESS/moistPussy.js
index 545b46fc80b131bac920598e9a25c340403c387a..bb5f9d8d825f7fba8c696e8ce57a494f970ad95b 100644
--- a/src/events/RESS/moistPussy.js
+++ b/src/events/RESS/moistPussy.js
@@ -6,7 +6,7 @@ App.Events.RESSMoistPussy = class RESSMoistPussy extends App.Events.BaseEvent {
 	actorPrerequisites() {
 		return [
 			[ // single event slave
-				s => s.assignment !== "work as a servant",
+				s => s.assignment !== Job.QUARTER,
 				s => s.devotion > 20,
 				s => s.vaginaLube > 1,
 				hasAnyArms,
diff --git a/src/events/RESS/waistlineWoes.js b/src/events/RESS/waistlineWoes.js
index 9ba7c846a3614bc397af3a5bd5650f7753980e6b..9db20b016ef210e77a55e1ac18cb519b7b4a839e 100644
--- a/src/events/RESS/waistlineWoes.js
+++ b/src/events/RESS/waistlineWoes.js
@@ -348,43 +348,43 @@ App.Events.RESSWaistlineWoes = class RESSWaistlineWoes extends App.Events.BaseEv
 			}
 			t.push(`before drifting off. ${He}'s earned a nap before ${he} returns to`);
 			switch (eventSlave.assignment) {
-				case "rest":
+				case Job.REST:
 					t.push(`the dorm,`);
 					break;
-				case "be a servant":
+				case Job.HOUSE:
 					t.push(`${his} chores,`);
 					break;
-				case "get milked":
+				case Job.MILKED:
 					t.push(`getting milked,`);
 					break;
-				case "serve the public":
+				case Job.PUBLIC:
 					t.push(`${his} slutting,`);
 					break;
-				case "please you":
+				case Job.FUCKTOY:
 					t.push(`servicing you,`);
 					break;
-				case "whore":
+				case Job.WHORE:
 					t.push(`selling ${himself},`);
 					break;
-				case "take classes":
+				case Job.CLASSES:
 					t.push(`studying,`);
 					break;
-				case "stay confined":
+				case Job.CONFINEMENT:
 					t.push(`${his} solitude,`);
 					break;
-				case "work a glory hole":
+				case Job.GLORYHOLE:
 					t.push(`being used,`);
 					break;
-				case "be a subordinate slave":
+				case Job.SUBORDINATE:
 					t.push(`serving ${his} superior,`);
 					break;
-				case "work as a servant":
+				case Job.QUARTER:
 					t.push(`${his} work as a servant,`);
 					break;
-				case "be your Concubine":
+				case Job.CONCUBINE:
 					t.push(`your bed to await another set,`);
 					break;
-				case "serve in the master suite":
+				case Job.MASTERSUITE:
 					t.push(`the other fucktoys,`);
 					break;
 				default:
diff --git a/src/facilities/ads.js b/src/facilities/ads.js
index 92b8cbd6e304be0e0e0ecf0d39930b2604492204..63def7e87a51661064f5821c76ac63bb851929cb 100644
--- a/src/facilities/ads.js
+++ b/src/facilities/ads.js
@@ -252,27 +252,16 @@ App.Ads.report = function(building, preview) {
 	}
 	let r = ``;
 
-	let ids;
-	if (building === "brothel") {
-		ids = "BrothiIDs";
-	} else {
-		ids = (capFirstChar(building) + "iIDs");
-	}
-
-	const DL = V[ids].length;
+	/** @type {App.Entity.Facilities.Facility} */
+	const facility = App.Entity.facilities[building];
+	const DL = facility.employeesIDs().size;
 
 	let adMgr = new App.Ads.AdManager(building);
-	for (let dI = 0; dI < DL; dI++) {
-		adMgr.tallySlave(V.slaves[V.slaveIndices[V[ids][dI]]]);
-	}
-	if (building === "brothel") {
-		if (V.Madam !== 0) {
-			adMgr.tallySlave(V.Madam);
-		}
-	} else if (building === "club") {
-		if (V.DJ !== 0) {
-			adMgr.tallySlave(V.DJ);
-		}
+	facility.employees().forEach(s => {
+		adMgr.tallySlave(s);
+	});
+	if (facility.manager.currentEmployee) {
+		adMgr.tallySlave(facility.manager.currentEmployee);
 	}
 
 	let adCampaign = {
diff --git a/src/facilities/arcade/arcadeFramework.js b/src/facilities/arcade/arcadeFramework.js
index b94e395071fbb96590c57a4ba89cdcbf7b770428..961d529eb867cb9f1e3dd59602e8f87a032e01fc 100644
--- a/src/facilities/arcade/arcadeFramework.js
+++ b/src/facilities/arcade/arcadeFramework.js
@@ -4,7 +4,7 @@ App.Data.Facilities.arcade = {
 	jobs: {
 		assignee: {
 			position: "whore",
-			assignment: "be confined in the arcade",
+			assignment: Job.ARCADE,
 			publicSexUse: true,
 			fuckdollAccepted: true,
 			description: {
diff --git a/src/facilities/armory/armoryFramework.js b/src/facilities/armory/armoryFramework.js
index cdf0f4f7daf10c15614bc7146f324c47fe7e9f62..2f866ee1672196432a108dfd58668d6efc8f54da 100644
--- a/src/facilities/armory/armoryFramework.js
+++ b/src/facilities/armory/armoryFramework.js
@@ -5,7 +5,7 @@ App.Data.Facilities.armory = {
 	defaultJob: null,
 	manager: {
 		position: "bodyguard",
-		assignment: "guard you",
+		assignment: Job.BODYGUARD,
 		careers: App.Data.misc.bodyguardCareers,
 		skill: "bodyguard",
 		publicSexUse: true,
@@ -21,6 +21,6 @@ App.Data.Facilities.armory = {
 	}
 };
 
-App.Entity.facilities.armory = new App.Entity.Facilities.SingleJobFacility(
+App.Entity.facilities.armory = new App.Entity.Facilities.Facility(
 	App.Data.Facilities.armory
 );
diff --git a/src/facilities/brothel/brothelFramework.js b/src/facilities/brothel/brothelFramework.js
index 1f307004e055753726772ec402ed328c9911f7fe..cfca519f4a580b571d8581a337e87f8dc8fb6a89 100644
--- a/src/facilities/brothel/brothelFramework.js
+++ b/src/facilities/brothel/brothelFramework.js
@@ -4,7 +4,7 @@ App.Data.Facilities.brothel = {
 	jobs: {
 		assignee: {
 			position: "whore",
-			assignment: "work in the brothel",
+			assignment: Job.BROTHEL,
 			publicSexUse: true,
 			fuckdollAccepted: false,
 			description: {
@@ -17,7 +17,7 @@ App.Data.Facilities.brothel = {
 	defaultJob: "assignee",
 	manager: {
 		position: "madam",
-		assignment: "be the Madam",
+		assignment: Job.MADAM,
 		careers: App.Data.misc.madamCareers,
 		skill: null,
 		publicSexUse: true,
@@ -48,11 +48,6 @@ App.Entity.Facilities.BrothelJob = class extends App.Entity.Facilities.FacilityS
 		}
 		return r;
 	}
-
-	/** @private @override */
-	get _employeeIDsVariableName() {
-		return "BrothiIDs";
-	}
 };
 
 App.Entity.Facilities.MadamJob = class extends App.Entity.Facilities.ManagingJob {
diff --git a/src/facilities/cellblock/cellblockFramework.js b/src/facilities/cellblock/cellblockFramework.js
index 8e63c4f14fd687cd4d11b57b10551fafea8c73ee..c3f9c8b1a6688a7388a2bacd66dd4ff89bfeb634 100644
--- a/src/facilities/cellblock/cellblockFramework.js
+++ b/src/facilities/cellblock/cellblockFramework.js
@@ -4,7 +4,7 @@ App.Data.Facilities.cellblock = {
 	jobs: {
 		assignee: {
 			position: "confinee",
-			assignment: "be confined in the cellblock",
+			assignment: Job.CELLBLOCK,
 			publicSexUse: false,
 			fuckdollAccepted: false,
 			description: {
@@ -17,7 +17,7 @@ App.Data.Facilities.cellblock = {
 	defaultJob: "assignee",
 	manager: {
 		position: "wardeness",
-		assignment: "be the Wardeness",
+		assignment: Job.WARDEN,
 		careers: App.Data.misc.wardenessCareers,
 		skill: "wardeness",
 		publicSexUse: false,
@@ -50,11 +50,6 @@ App.Entity.Facilities.CellblockJob = class extends App.Entity.Facilities.Facilit
 
 		return r;
 	}
-
-	/** @private @override */
-	get _employeeIDsVariableName() {
-		return "CellBiIDs";
-	}
 };
 
 App.Entity.facilities.cellblock = new App.Entity.Facilities.SingleJobFacility(
diff --git a/src/facilities/clinic/clinicFramework.js b/src/facilities/clinic/clinicFramework.js
index 0551343c5777e1b36d008fff888532f900cab272..b3fcffccf9f9b8db9215c0078964cf9679eacd5d 100644
--- a/src/facilities/clinic/clinicFramework.js
+++ b/src/facilities/clinic/clinicFramework.js
@@ -4,7 +4,7 @@ App.Data.Facilities.clinic = {
 	jobs: {
 		patient: {
 			position: "patient",
-			assignment: "get treatment in the clinic",
+			assignment: Job.CLINIC,
 			publicSexUse: false,
 			fuckdollAccepted: false,
 			description: {
@@ -17,7 +17,7 @@ App.Data.Facilities.clinic = {
 	defaultJob: "patient",
 	manager: {
 		position: "nurse",
-		assignment: "be the Nurse",
+		assignment: Job.NURSE,
 		careers: App.Data.misc.nurseCareers,
 		skill: "nurse",
 		publicSexUse: false,
diff --git a/src/facilities/club/clubFramework.js b/src/facilities/club/clubFramework.js
index 31d5dea5e3855c6087613f980159aa00ff98a19a..02638c99d132484e645147919c8ba836d0d6fd57 100644
--- a/src/facilities/club/clubFramework.js
+++ b/src/facilities/club/clubFramework.js
@@ -4,7 +4,7 @@ App.Data.Facilities.club = {
 	jobs: {
 		slut: {
 			position: "Slut",
-			assignment: "serve in the club",
+			assignment: Job.CLUB,
 			publicSexUse: true,
 			fuckdollAccepted: false,
 			description: {
@@ -17,7 +17,7 @@ App.Data.Facilities.club = {
 	defaultJob: "slut",
 	manager: {
 		position: "DJ",
-		assignment: "be the DJ",
+		assignment: Job.DJ,
 		careers: App.Data.misc.DJCareers,
 		skill: "DJ",
 		publicSexUse: false,
diff --git a/src/facilities/dairy/dairyFramework.js b/src/facilities/dairy/dairyFramework.js
index 2237f74427460b555ec5093583e221a246715056..b30c40cbca0f608ba12d2935a154e3ca36b0e70a 100644
--- a/src/facilities/dairy/dairyFramework.js
+++ b/src/facilities/dairy/dairyFramework.js
@@ -4,7 +4,7 @@ App.Data.Facilities.dairy = {
 	jobs: {
 		cow: {
 			position: "cow",
-			assignment: "work in the dairy",
+			assignment: Job.DAIRY,
 			publicSexUse: false,
 			fuckdollAccepted: false,
 			description: {
@@ -17,7 +17,7 @@ App.Data.Facilities.dairy = {
 	defaultJob: "cow",
 	manager: {
 		position: "milkmaid",
-		assignment: "be the Milkmaid",
+		assignment: Job.MILKMAID,
 		careers: App.Data.misc.milkmaidCareers,
 		skill: "milkmaid",
 		publicSexUse: false,
@@ -87,9 +87,9 @@ App.Entity.Facilities.Dairy = class extends App.Entity.Facilities.SingleJobFacil
 			});
 	}
 
-	get hasFreeSpace() {
-		const dairySeed = V.bioreactorsXY + V.bioreactorsXX + V.bioreactorsHerm + V.bioreactorsBarren;
-		return this.capacity > this.hostedSlaves + dairySeed;
+	/** @override */
+	get nonEmployeeOccupantsCount() {
+		return V.bioreactorsXY + V.bioreactorsXX + V.bioreactorsHerm + V.bioreactorsBarren;
 	}
 };
 
diff --git a/src/facilities/farmyard/farmyard.tw b/src/facilities/farmyard/farmyard.tw
index 943d081a97d5b7b82468a02a54a06508383d1a46..680ebf931323b75835f49250a7bde998cf36c507 100644
--- a/src/facilities/farmyard/farmyard.tw
+++ b/src/facilities/farmyard/farmyard.tw
@@ -10,7 +10,7 @@
 	<<set $farmyardNameCaps = $farmyardName.replace("the ", "The ")>>
 <</if>>
 
-<<set _CL = $canines.length, _HL = $hooved.length, _FL = $felines.length, _FyL = $FarmyardiIDs.length>>
+<<set _CL = $canines.length, _HL = $hooved.length, _FL = $felines.length, _FyL = App.Entity.facilities.farmyard.employeesIDs().size>>
 <p class="scene-intro">
 	$farmyardNameCaps is an oasis of growth in the midst of the jungle of steel and concrete that is $arcologies[0].name. Animals are kept in pens, tended to by your slaves, while <<if $farmyardUpgrade.hydroponics == 1>>rows of hydroponics equipment<<else>>makeshift fields<</if>> grow crops.
 	<<switch $farmyardDecoration>>
diff --git a/src/facilities/farmyard/farmyardFramework.js b/src/facilities/farmyard/farmyardFramework.js
index f8479b5212f0c124c468e89586443a605cb6621a..74048a4eef65ae5a9aa897cede6b6a1e4954bc48 100644
--- a/src/facilities/farmyard/farmyardFramework.js
+++ b/src/facilities/farmyard/farmyardFramework.js
@@ -4,7 +4,7 @@ App.Data.Facilities.farmyard = {
 	jobs: {
 		farmhand: {
 			position: "farmhand",
-			assignment: "work as a farmhand",
+			assignment: Job.FARMYARD,
 			publicSexUse: false,
 			fuckdollAccepted: false,
 			description: {
@@ -17,7 +17,7 @@ App.Data.Facilities.farmyard = {
 	defaultJob: "farmhand",
 	manager: {
 		position: "farmer",
-		assignment: "be the Farmer",
+		assignment: Job.FARMER,
 		careers: App.Data.misc.farmerCareers,
 		skill: "farmer",
 		publicSexUse: false,
diff --git a/src/facilities/farmyard/farmyardReport.tw b/src/facilities/farmyard/farmyardReport.tw
index e66a15a72ca353a7aaedb1ab0fdaa693cc206971..7fd9c29e8ec350591586763b79efa5a5d6dfa048 100644
--- a/src/facilities/farmyard/farmyardReport.tw
+++ b/src/facilities/farmyard/farmyardReport.tw
@@ -3,8 +3,8 @@
 <span id="farmyardstats">
 </span>
 
-<<SlaveIDSort $FarmyardiIDs>>
-<<set _DL = $FarmyardiIDs.length, _SL = $slaves.length, $FarmerCashBonus = 0, _FLsFetish = 0, _profits = 0, _foodWeek = 0>>
+<<set _slaves = App.Utils.sortedEmployees(App.Entity.facilities.farmyard)>>
+<<set _DL = _slaves.length, _SL = $slaves.length, $FarmerCashBonus = 0, _FLsFetish = 0, _profits = 0, _foodWeek = 0>>
 <<set $FarmerDevotionBonus = 1, $FarmerDevotionThreshold = 45, $FarmerTrustBonus = 1, $FarmerTrustThreshold = 35, $FarmerHealthBonus = 0>>
 /*<<set $legendaryWombID = 0>> TODO: will the Farmyard have a legendary womb system? */
 
@@ -101,29 +101,30 @@
 		<<set $FarmerCashBonus += 0.05>>
 	<</if>>
 
-	<<for _dI = 0; _dI < _DL; _dI++>>
-		<<set $i = $slaveIndices[$FarmyardiIDs[_dI]]>>
-		<<setLocalPronouns $slaves[$i]>>
-		<<setLocalPronouns $Farmer 2>>
-		<<if $Farmer.rivalryTarget == $slaves[$i].ID>>
+	<<setLocalPronouns $Farmer 2>>
+
+	<<for _slave range _slaves>>
+		<<set $i = $slaveIndices[_slave.ID]>>
+		<<setLocalPronouns _slave>>
+		<<if $Farmer.rivalryTarget == _slave.ID>>
 			_He2 forces _his2 <<print rivalryTerm($Farmer)>> to service all the slaves in $farmyardName.	/* TODO: not sure about this */
-			<<set $slaves[$i].devotion -= 2, $slaves[$i].trust -= 2>>
-			<<if canDoVaginal($slaves[$i])>>
-				<<run seX($slaves[$i], "vaginal", "public", "penetrative", 10)>>
+			<<set _slave.devotion -= 2, _slave.trust -= 2>>
+			<<if canDoVaginal(_slave)>>
+				<<run seX(_slave, "vaginal", "public", "penetrative", 10)>>
 			<</if>>
-			<<if canDoAnal($slaves[$i])>>
-				<<run seX($slaves[$i], "anal", "public", "penetrative", 10)>>
+			<<if canDoAnal(_slave)>>
+				<<run seX(_slave, "anal", "public", "penetrative", 10)>>
 			<</if>>
-			<<run seX($slaves[$i], "oral", "public", "penetrative", 10)>>
+			<<run seX(_slave, "oral", "public", "penetrative", 10)>>
 			<<if random(1,100) > 65>>
-				<<set $slaves[_FLs].rivalry++, $Farmer.rivalry++, $slaves[$i].rivalry++>>
+				<<set $slaves[_FLs].rivalry++, $Farmer.rivalry++, _slave.rivalry++>>
 			<</if>>
-		<<elseif $Farmer.relationshipTarget == $slaves[$i].ID>>
-			_He2 dotes over _his2 <<print relationshipTerm($Farmer)>>, $slaves[$i].slaveName, making sure $he isn't worked too hard, but unfortunately manages to get in the way of $his work.
-			<<set $slaves[$i].devotion++, $FarmerCashBonus -= 0.05>>
-		<<elseif areRelated($Farmer, $slaves[$i])>>
-			_He2 pays special attention to _his2 <<print relativeTerm($Farmer.ID,$slaves[$i].ID)>>, $slaves[$i].slaveName, making sure $he is treated well and showing off $his skills. /* TODO: does this need rewriting? */
-			<<set $slaves[$i].trust++, $FarmerCashBonus += 0.05>>
+		<<elseif $Farmer.relationshipTarget == _slave.ID>>
+			_He2 dotes over _his2 <<print relationshipTerm($Farmer)>>, _slave.slaveName, making sure $he isn't worked too hard, but unfortunately manages to get in the way of $his work.
+			<<set _slave.devotion++, $FarmerCashBonus -= 0.05>>
+		<<elseif areRelated($Farmer, _slave)>>
+			_He2 pays special attention to _his2 <<print relativeTerm($Farmer.ID,_slave.ID)>>, _slave.slaveName, making sure $he is treated well and showing off $his skills. /* TODO: does this need rewriting? */
+			<<set _slave.trust++, $FarmerCashBonus += 0.05>>
 		<</if>>
 	<</for>>
 
@@ -132,7 +133,7 @@
 		<<set $slavesGettingHelp = 0>>
 		<<if $universalRulesFacilityWork == 1>>
 			<<for $i = 0; $i < _SL; $i++>>
-				<<if ($slaves[$i].assignment == "farmhand")>>
+				<<if (_slave.assignment == "farmhand")>>
 					<<set $slavesGettingHelp++>>
 				<</if>>
 			<</for>>
@@ -195,40 +196,40 @@
 
 <<if (_DL > 0)>>
 	<<set _oldCash = $cash, _oldFood = $food>>
-	<<for _dI = 0; _dI < _DL; _dI++>>
-		<<set $i = $slaveIndices[$FarmyardiIDs[_dI]]>>
-		<<setLocalPronouns $slaves[$i]>>
+	<<for _slave range _slaves>>
+		<<set $i = $slaveIndices[_slave.ID]>>
+		<<setLocalPronouns _slave>>
 		/* Perform facility based rule changes */
 		<<switch $farmyardDecoration>>
 		<<case "Degradationist" "standard">>	/* TODO: add the rest of the FS */
-			<<set $slaves[$i].rules.living = "spare">>
+			<<set _slave.rules.living = "spare">>
 		<<case "Roman Revivalist">>
-			<<set $slaves[$i].rules.living = "luxurious">>
+			<<set _slave.rules.living = "luxurious">>
 		<<default>>
-			<<set $slaves[$i].rules.living = "normal">>
+			<<set _slave.rules.living = "normal">>
 		<</switch>>
 		/* TODO: should FS with "spare" living rules cause some minor health damage and devotion / trust loss? */
-		<<if ($slaves[$i].health.condition < -80)>>
-			<<run improveCondition($slaves[$i], 20)>>
-		<<elseif $slaves[$i].health.condition < -40>>
-			<<run improveCondition($slaves[$i], 15)>>
-		<<elseif $slaves[$i].health.condition < 0>>
-			<<run improveCondition($slaves[$i], 10)>>
-		<<elseif $slaves[$i].health.condition < 90>>
-			<<run improveCondition($slaves[$i], 7)>>
+		<<if (_slave.health.condition < -80)>>
+			<<run improveCondition(_slave, 20)>>
+		<<elseif _slave.health.condition < -40>>
+			<<run improveCondition(_slave, 15)>>
+		<<elseif _slave.health.condition < 0>>
+			<<run improveCondition(_slave, 10)>>
+		<<elseif _slave.health.condition < 90>>
+			<<run improveCondition(_slave, 7)>>
 		<</if>>
-		<<if ($slaves[$i].devotion <= 20) && ($slaves[$i].trust >= -20)>>
-			<<set $slaves[$i].devotion -= 5, $slaves[$i].trust -= 5>>
-		<<elseif ($slaves[$i].devotion < 45)>>
-			<<set $slaves[$i].devotion += 4>>
-		<<elseif ($slaves[$i].devotion > 50)>>
-			<<set $slaves[$i].devotion -= 4>>
+		<<if (_slave.devotion <= 20) && (_slave.trust >= -20)>>
+			<<set _slave.devotion -= 5, _slave.trust -= 5>>
+		<<elseif (_slave.devotion < 45)>>
+			<<set _slave.devotion += 4>>
+		<<elseif (_slave.devotion > 50)>>
+			<<set _slave.devotion -= 4>>
 		<</if>>
-		<<if ($slaves[$i].trust < 30)>>
-			<<set $slaves[$i].trust += 5>>
+		<<if (_slave.trust < 30)>>
+			<<set _slave.trust += 5>>
 		<</if>>
-		<<if $slaves[$i].energy > 40 && $slaves[$i].energy < 95>>
-			<<set $slaves[$i].energy++>>
+		<<if _slave.energy > 40 && _slave.energy < 95>>
+			<<set _slave.energy++>>
 		<</if>>
 
 		<<if $showEWD != 0>>
@@ -236,42 +237,42 @@
 			/* 000-250-006 */
 			<<if $seeImages && $seeReportImages>>
 				<div class="imageRef tinyImg">
-					<<= SlaveArt($slaves[$i], 0, 0)>>
+					<<= SlaveArt(_slave, 0, 0)>>
 				</div>
 			<</if>>
 			/* 000-250-006 */
-			<span class='slave-name'><<= SlaveFullName($slaves[$i])>></span>
-			<<if $slaves[$i].choosesOwnAssignment == 2>>
+			<span class='slave-name'><<= SlaveFullName(_slave)>></span>
+			<<if _slave.choosesOwnAssignment == 2>>
 				<<include "SA chooses own job">>
 			<<else>>
 				is working out of $farmyardName.
 			<</if>>
-			<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.workTheFarm($slaves[$i])>>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.workTheFarm(_slave)>>
 			<br>&nbsp;&nbsp;&nbsp;
-			<<= App.SlaveAssignment.choosesOwnClothes($slaves[$i])>>
+			<<= App.SlaveAssignment.choosesOwnClothes(_slave)>>
 			<<include "SA rules">>
 			<<include "SA diet">>
 			<<include "SA long term effects">>
-			<<= App.SlaveAssignment.drugs($slaves[$i])>>
+			<<= App.SlaveAssignment.drugs(_slave)>>
 			<<include "SA relationships">>
 			<<include "SA rivalries">>
 			<br><<include "SA devotion">>
 		<<else>>
 			<<silently>>
 			<<include "SA chooses own job">>
-			<<run App.SlaveAssignment.workTheFarm($slaves[$i])>>
-			<<run App.SlaveAssignment.choosesOwnClothes($slaves[$i])>>
+			<<run App.SlaveAssignment.workTheFarm(_slave)>>
+			<<run App.SlaveAssignment.choosesOwnClothes(_slave)>>
 			<<include "SA rules">>
 			<<include "SA diet">>
 			<<include "SA long term effects">>
-			<<run App.SlaveAssignment.drugs($slaves[$i])>>
+			<<run App.SlaveAssignment.drugs(_slave)>>
 			<<include "SA relationships">>
 			<<include "SA rivalries">>
 			<<include "SA devotion">>
 			<</silently>>
 		<</if>>
 		<span id="showProfits">
-		<<set _incomeStats = getSlaveStatisticData($slaves[$i], $slaves[$i].assignment === Job.FARMYARD ? $facility.farmyard : undefined)>>
+		<<set _incomeStats = getSlaveStatisticData(_slave, _slave.assignment === Job.FARMYARD ? $facility.farmyard : undefined)>>
 		<<set _profits += _incomeStats.income>>
 		</span>
 
diff --git a/src/facilities/farmyard/farmyardWidgets.js b/src/facilities/farmyard/farmyardWidgets.js
index ffc73869fd1edac93645b8bccfe5fd533e464e76..c14d77c0ee1a5921845b31ece154cf251bb146c8 100644
--- a/src/facilities/farmyard/farmyardWidgets.js
+++ b/src/facilities/farmyard/farmyardWidgets.js
@@ -4,7 +4,7 @@ App.Facilities.Farmyard.farmyardReport = () => {
 	const
 		slaves = V.slaves,
 		Farmer = V.Farmer,
-		FL = V.FarmyardiIDs.length;
+		FL = App.Entity.facilities.farmyard.employeesIDs().size;
 
 	let
 		t = ``,
@@ -122,18 +122,16 @@ App.Facilities.Farmyard.farmyardReport = () => {
 	};
 
 
-	const farmerRelationshipSlaves = (length, Farmer) => {
-		for (let i = length; i--;) {
-			const
-				s = V.slaveIndices[V.FarmyardiIDs[i]],
-				slave = V.slaves[s],
-				p = getPronouns(Farmer);
+	/** @param {App.Entity.SlaveState} Farmer */
+	function farmerRelationshipSlaves(Farmer) {
+		const p = getPronouns(Farmer);
+		for (const slave of App.Utils.sortedEmployees(App.Entity.facilities.farmyard)) {
 
 			let t = ``;
 
 			if (Farmer.rivalryTarget === slave.ID) {
 				t += `${p.He} forces ${p.his} ${rivalryTerm(Farmer)} to service all the slaves in ${V.farmyardName}. `;    // TODO: not sure about this
-				slave.devotion -= 2; slaves.trust -= 2;
+				slave.devotion -= 2; slave.trust -= 2;
 				if (canDoVaginal(slave)) {
 					seX(slave, 'vaginal', 'public', 'penetrative', 10);
 				}
@@ -148,13 +146,13 @@ App.Facilities.Farmyard.farmyardReport = () => {
 				t += `${p.He} dotes over ${p.his} ${relationshipTerm(Farmer)}, ${slave.slaveName}, making sure ${he} isn't worked too hard, but unfortunately manages to get in the way of ${his} work. `;
 				slave.devotion++;
 			} else if (areRelated(Farmer, slave)) {
-				t += `${p.He} pays special attention to ${p.his} ${relativeTerm(Farmer.ID, slave.ID)}, ${slave.slaveName}, making sure ${he} is treated well and showing off ${his} skills. `;
+				t += `${p.He} pays special attention to ${p.his} ${relativeTerm(Farmer, slave)}, ${slave.slaveName}, making sure ${he} is treated well and showing off ${his} skills. `;
 				slave.trust++;
 			}
 
 			return t;
 		}
-	};
+	}
 
 	const farmerWorks = slave => {
 		let
@@ -405,9 +403,6 @@ App.Facilities.Farmyard.farmyardReport = () => {
 	const farmyardStatsDisplay = () => `<<FarmyardStatistics 0>><<timed 50ms>><<replace #farmyardstats>><<FarmyardStatistics 1>><</replace>><</timed>>`;
 
 	t += `<span id="farmyardstats"></span>`;
-	SlaveSort.IDs(V.FarmyardiIDs);  // TODO: not sure if I called this correctly
-
-
 
 	// MAIN LOOP
 
@@ -429,7 +424,7 @@ App.Facilities.Farmyard.farmyardReport = () => {
 		t += farmerIntelligence(Farmer);
 		t += farmerDick(Farmer);
 		t += farmerSmell(Farmer);
-		t += farmerRelationshipSlaves(FL, Farmer);
+		t += farmerRelationshipSlaves(Farmer);
 		t += farmerWorks(Farmer);
 	}
 
@@ -443,9 +438,8 @@ App.Facilities.Farmyard.farmyardReport = () => {
 		let oldCash = V.cash,
 			oldFood = V.food;
 
-		for (let i = FL; i--;) {
-			V.i = V.slaveIndices[V.FarmyardiIDs[i]];
-			const slave = slaves[V.i];
+		for (const slave of App.Utils.sortedEmployees(App.Entity.facilities.farmyard)) {
+			V.i = V.slaveIndices[slave.ID];
 
 			({
 				he, him, his, hers, himself, girl, He, His, loli
diff --git a/src/facilities/headGirlSuite/headGirlSuiteFramework.js b/src/facilities/headGirlSuite/headGirlSuiteFramework.js
index 37f4ecef316fd0a8f16e19a16eb745fe61df8ff9..a980f8a700c8a8105d7c0ce2f95ef6db5f6a6d41 100644
--- a/src/facilities/headGirlSuite/headGirlSuiteFramework.js
+++ b/src/facilities/headGirlSuite/headGirlSuiteFramework.js
@@ -4,7 +4,7 @@ App.Data.Facilities.headGirlSuite = {
 	jobs: {
 		HGToy: {
 			position: "Head Girl's toy",
-			assignment: "live with your Head Girl",
+			assignment: Job.HEADGIRLSUITE,
 			publicSexUse: true,
 			fuckdollAccepted: false,
 			description: {
@@ -17,7 +17,7 @@ App.Data.Facilities.headGirlSuite = {
 	defaultJob: "HGToy",
 	manager: {
 		position: "Head Girl",
-		assignment: "be your Head Girl",
+		assignment: Job.HEADGIRL,
 		careers: App.Data.misc.HGCareers,
 		skill: "headGirl",
 		publicSexUse: false,
diff --git a/src/facilities/masterSuite/masterSuiteFramework.js b/src/facilities/masterSuite/masterSuiteFramework.js
index e5cd58740ec35d8e6ae7f5206aa2489d8a65e630..e94886e242a7970b0469b231d5d2ea3ce2334236 100644
--- a/src/facilities/masterSuite/masterSuiteFramework.js
+++ b/src/facilities/masterSuite/masterSuiteFramework.js
@@ -4,7 +4,7 @@ App.Data.Facilities.masterSuite = {
 	jobs: {
 		fucktoy: {
 			position: "fucktoy",
-			assignment: "serve in the master suite",
+			assignment: Job.MASTERSUITE,
 			publicSexUse: false,
 			fuckdollAccepted: false,
 			description: {
@@ -17,7 +17,7 @@ App.Data.Facilities.masterSuite = {
 	defaultJob: "fucktoy",
 	manager: {
 		position: "concubine",
-		assignment: "be your Concubine",
+		assignment: Job.CONCUBINE,
 		careers: [],
 		skill: null,
 		publicSexUse: false,
@@ -46,10 +46,6 @@ App.Entity.Facilities.MasterSuiteFuckToyJob = class extends App.Entity.Facilitie
 
 		return r;
 	}
-
-	get _employeeIDsVariableName() {
-		return "MastSiIDs";
-	}
 };
 
 App.Entity.Facilities.ConcubineJob = class extends App.Entity.Facilities.ManagingJob {
diff --git a/src/facilities/nursery/nursery.tw b/src/facilities/nursery/nursery.tw
index 57fd9578edac1a0ca8a6dc35faf9184da6b0b9d5..25a9c31733733c934c8323f1a26fbf5bb4e4558a 100644
--- a/src/facilities/nursery/nursery.tw
+++ b/src/facilities/nursery/nursery.tw
@@ -8,7 +8,7 @@
 	<<set $nurseryNameCaps = $nurseryName.replace("the ", "The ")>>
 <</if>>
 
-<<set $readyChildren = 0, $nurseryBabies = $cribs.length, $freeCribs = $nursery - $nurseryBabies, _NL = $NurseryiIDs.length, _SL = $slaves.length, _eligibility = 0, $reservedChildren = FetusGlobalReserveCount("incubator"), $reservedChildrenNursery = FetusGlobalReserveCount("nursery")>>
+<<set $readyChildren = 0, $nurseryBabies = $cribs.length, $freeCribs = $nursery - $nurseryBabies, _NL = App.Entity.facilities.nursery.employeesIDs().size, _SL = $slaves.length, _eligibility = 0, $reservedChildren = FetusGlobalReserveCount("incubator"), $reservedChildrenNursery = FetusGlobalReserveCount("nursery")>>
 <p class=scene-intro">
 	$nurseryNameCaps
 	<<switch $nurseryDecoration>>
diff --git a/src/facilities/nursery/nurseryFramework.js b/src/facilities/nursery/nurseryFramework.js
index 066183f6504c7fe4700dc07c9f6884401f5ab0f2..2403edffab0a54573e70cbdae905ca5c62211615 100644
--- a/src/facilities/nursery/nurseryFramework.js
+++ b/src/facilities/nursery/nurseryFramework.js
@@ -4,7 +4,7 @@ App.Data.Facilities.nursery = {
 	jobs: {
 		nanny: {
 			position: "nanny",
-			assignment: "work as a nanny",
+			assignment: Job.NURSERY,
 			publicSexUse: false,
 			fuckdollAccepted: false,
 			description: {
@@ -17,7 +17,7 @@ App.Data.Facilities.nursery = {
 	defaultJob: "nanny",
 	manager: {
 		position: "matron",
-		assignment: "be the Matron",
+		assignment: Job.MATRON,
 		careers: App.Data.misc.matronCareers,
 		skill: "matron",
 		publicSexUse: false,
diff --git a/src/facilities/nursery/nurseryWidgets.js b/src/facilities/nursery/nurseryWidgets.js
index 0208e92c298cd678a5ff6dba4077dc4a6d6f9e6a..5f1ea8fb39a0ca128a5f23a1182d2eacd9c839f8 100644
--- a/src/facilities/nursery/nurseryWidgets.js
+++ b/src/facilities/nursery/nurseryWidgets.js
@@ -15260,7 +15260,7 @@ App.Facilities.Nursery.newChild = function newChild(child) {
  * @param {App.Entity.ChildState[]} [cribs]
  * @returns {Object.<number, number>}
  */
-App.Facilities.Nursery.cribsToIndices = function cribsToIndices(cribs = State.variables.cribs) {
+App.Facilities.Nursery.cribsToIndices = function cribsToIndices(cribs = V.cribs) {
 	return cribs.reduce((acc, child, i) => { acc[child.ID] = i; return acc; }, {});
 };
 
@@ -15270,7 +15270,7 @@ App.Facilities.Nursery.cribsToIndices = function cribsToIndices(cribs = State.va
  * @returns {number}
  */
 App.Facilities.Nursery.childIndexForID = function childIndexForID(id) {
-	return State.variables.cribsIndices[id];
+	return V.cribsIndices[id];
 };
 
 /**
@@ -15279,7 +15279,7 @@ App.Facilities.Nursery.childIndexForID = function childIndexForID(id) {
  * @returns {Array}
  */
 App.Facilities.Nursery.removeChild = function removeChild(index) {
-	return State.variables.cribs.deleteAt(index);
+	return V.cribs.deleteAt(index);
 };
 
 /**
@@ -15316,7 +15316,7 @@ App.Facilities.Nursery.nurserySort = function nurserySort() {
 			App.Utils.setLocalPronouns(slave);
 
 			if (slave.preg > 0 && !slave.broodmother && slave.pregKnown && slave.eggType === "human") {
-				if (slave.assignment !== "work in the dairy" && V.dairyPregSetting <= 0) {
+				if (slave.assignment !== Job.DAIRY && V.dairyPregSetting <= 0) {
 					const
 						slaveID = "slave-" + slave.ID,
 						WL = slave.womb.length,
@@ -15525,7 +15525,7 @@ App.Facilities.Nursery.nurserySort = function nurserySort() {
 		}
 
 		function byPreviousSort() {
-			let sort = State.variables.sortNurseryList;
+			let sort = V.sortNurseryList;
 			if (sort !== 'unsorted') {
 				if (sort === 'Name') {
 					sortNurseryPossiblesByName();
@@ -15798,7 +15798,7 @@ App.Facilities.Nursery.ChildState = class ChildState {
 		/** Child's assignment
 		 * TODO:
 		*/
-		this.assignment = "rest";
+		this.assignment = Job.REST;
 		/** How far along slave is with being trained (skills, flaws, quirks)
 		 * TODO:
 		*/
@@ -17668,7 +17668,7 @@ App.Facilities.Nursery.childrenReport = function childrenReport() {
 
 	const
 		Matron = V.Matron,
-		NL = V.NurseryiIDs.length,
+		NL = App.Entity.facilities.nursery.employeesIDs().size,
 		CL = V.cribs.length;
 
 	let
@@ -17790,10 +17790,7 @@ App.Facilities.Nursery.childrenReport = function childrenReport() {
 				}
 
 				if (NL > 0) {
-					for (let j = 0; j < NL; j++) {
-						const
-							slave = getSlave(V.NurseryiIDs[j]);
-
+					for (const slave of App.Utils.sortedEmployees(App.Entity.facilities.nursery)) {
 						if (slave.fetish !== "none") {
 							if (chance > 85) {
 								if (child.fetish === "none") {
@@ -17894,28 +17891,31 @@ App.Facilities.Nursery.childrenReport = function childrenReport() {
 
 				if (NL > 0) {
 					let
-						averageIntelligence,
-						averageIntelligenceImplant;
+						averageIntelligence = 0,
+						averageIntelligenceImplant = 0;
 
-					for (let j = 0; j < NL; j++) {
-						averageIntelligence += V.slaves[V.slaveIndices[NurseryiIDs[j]]].intelligence;
-						averageIntelligenceImplant += V.slaves[V.slaveIndices[NurseryiIDs[j]]].intelligenceImplant;
+					const nannies = App.Entity.facilities.nursery.employees();
+					for (const nanny of nannies) {
+						averageIntelligence += nanny.intelligence;
+						averageIntelligenceImplant += nanny.intelligenceImplant;
 					}
 
+					const firstNanny = nannies[0];
+
 					averageIntelligence = averageIntelligence / NL;
 					averageIntelligenceImplant = averageIntelligenceImplant / NL;
 
 					if (averageIntelligence + averageIntelligenceImplant > 65) {
-						r += `${NL > 1 ? `The nannies are mostly` : `${V.slaves[V.slaveIndices[NurseryiIDs[j]]].slaveName} is`} very intelligent and well educated and are able to teach ${CL > 1 ? `the children` : child.slaveName} very effectively. `;
+						r += `${NL > 1 ? `The nannies are mostly` : `${firstNanny.slaveName} is`} very intelligent and well educated and are able to teach ${CL > 1 ? `the children` : child.slaveName} very effectively. `;
 						child.intelligenceImplant += 3;
 					} else if (averageIntelligence > 50) {
-						r += `${NL > 1 ? `The nannies are mostly` : `${V.slaves[V.slaveIndices[NurseryiIDs[j]]].slaveName} is`} very intelligent and able to teach ${CL > 1 ? `the children` : child.slaveName} quite effectively. `;
+						r += `${NL > 1 ? `The nannies are mostly` : `${firstNanny.slaveName} is`} very intelligent and able to teach ${CL > 1 ? `the children` : child.slaveName} quite effectively. `;
 						child.intelligenceImplant += 2;
 					} else if (averageIntelligenceImplant > 25) {
-						r += `${NL > 1 ? `The nannies are mostly` : `${V.slaves[V.slaveIndices[NurseryiIDs[j]]].slaveName} is`} very well educated and able to teach ${CL > 1 ? `the children` : child.slaveName} quite effectively. `;
+						r += `${NL > 1 ? `The nannies are mostly` : `${firstNanny.slaveName} is`} very well educated and able to teach ${CL > 1 ? `the children` : child.slaveName} quite effectively. `;
 						child.intelligenceImplant += 2;
 					} else if (averageIntelligenceImplant > 15) {
-						r += `${NL > 1 ? `The nannies are mostly` : `${V.slaves[V.slaveIndices[NurseryiIDs[j]]].slaveName} is`} well educated and able to teach ${CL > 1 ? `the children` : child.slaveName} fairly effectively. `;
+						r += `${NL > 1 ? `The nannies are mostly` : `${firstNanny.slaveName} is`} well educated and able to teach ${CL > 1 ? `the children` : child.slaveName} fairly effectively. `;
 						child.intelligenceImplant++;
 					}
 				}
@@ -17997,6 +17997,7 @@ App.Facilities.Nursery.childrenReport = function childrenReport() {
 			// TODO: rework these entirely
 			if (Matron || NL) {
 				if (V.nurseryWeight) {
+					const firstNanny = NL > 0 ? App.Entity.facilities.nursery.employees()[0] : null;
 					r += `<br>`;
 					if (V.nurseryWeightSetting === 1) {
 						if (child.weight < 200) {
@@ -18006,10 +18007,10 @@ App.Facilities.Nursery.childrenReport = function childrenReport() {
 					} else if (V.nurseryWeightSetting === 2) {
 						if (child.weight > 10) {
 							child.weight--;
-							r += `${Matron ? Matron.slaveName : NL > 1 ? `A nanny` : V.slaves[V.slaveIndices[NurseryiIDs[j]]].slaveName} notices ${he} is overweight and <span class="green">decreases the amount of food ${he} eats.</span> `;
+							r += `${Matron ? Matron.slaveName : NL > 1 ? `A nanny` : firstNanny.slaveName} notices ${he} is overweight and <span class="green">decreases the amount of food ${he} eats.</span> `;
 						} else if (child.weight <= -10) {
 							child.weight++;
-							r += `${Matron ? Matron.slaveName : NL > 1 ? `A nanny` : V.slaves[V.slaveIndices[NurseryiIDs[j]]].slaveName} notices ${he} is underweight and <span class="green">increases the amount of food ${he} eats.</span> `;
+							r += `${Matron ? Matron.slaveName : NL > 1 ? `A nanny` : firstNanny.slaveName} notices ${he} is underweight and <span class="green">increases the amount of food ${he} eats.</span> `;
 						} else {
 							r += `${He} is <span class="lime">currently a healthy weight;</span> efforts will be made to maintain it. `;
 						}
@@ -18033,11 +18034,11 @@ App.Facilities.Nursery.childrenReport = function childrenReport() {
 						if (child.muscles < 100) {
 							child.muscles += 5;
 						}
-						r += `${Matron ? Matron : NL > 1 ? `A nanny` : V.slaves[V.slaveIndices[NurseryiIDs[j]]].slaveName} notices ${he} is overly muscular and <span class="green">decreases ${his} steroid dosage.</span> `;
+						r += `${Matron ? Matron : NL > 1 ? `A nanny` : firstNanny.slaveName} notices ${he} is overly muscular and <span class="green">decreases ${his} steroid dosage.</span> `;
 					} else if (V.nurseryMusclesSetting === 1) {
 						if (child.muscles > 10) {
 							child.muscles--;
-							r += `${Matron ? Matron : NL > 1 ? `A nanny` : V.slaves[V.slaveIndices[NurseryiIDs[j]]].slaveName} notices ${he} is weak and <span class="green">increases ${his} steroid dosage.</span> `;
+							r += `${Matron ? Matron : NL > 1 ? `A nanny` : firstNanny.slaveName} notices ${he} is weak and <span class="green">increases ${his} steroid dosage.</span> `;
 						} else if (child.muscles < -10) {
 							child.muscles++;
 							r += `${He} has <span class="lime">a healthy musculature;</span> efforts will be made to maintain it. `;
@@ -18076,7 +18077,7 @@ App.Facilities.Nursery.nurseryReport = function nurseryReport() {
 		arcology = V.arcologies[0];
 
 	let
-		NL = V.NurseryiIDs.length,
+		NL = App.Utils.jobForAssignment(Job.NURSERY).employeesIDs().size,
 		healthBonus = 0,
 		trustBonus = 0,
 		idleBonus = 0,
@@ -18233,11 +18234,8 @@ App.Facilities.Nursery.nurseryReport = function nurseryReport() {
 		}
 	}
 
-	for (let dI = 0; dI < NL; dI++) {
-		const
-			slave = getSlave(V.NurseryiIDs[dI]);
-
-		V.i = App.Utils.slaveIndexForId(slave.ID);
+	for (const slave of App.Utils.sortedEmployees(App.Utils.jobForAssignment(Job.NURSERY))) {
+		V.i = V.slaveIndices[slave.ID];
 
 		slave.devotion += devBonus, slave.trust += trustBonus;
 		improveCondition(slave, healthBonus);
@@ -18318,7 +18316,7 @@ App.Facilities.Nursery.nurseryReport = function nurseryReport() {
 		if (V.universalRulesAssignsSelfFacility && slave.devotion > 50 && canWalk(slave) && canSee(slave) && slave.sexualQuirk === "caring" && V.nurseryNannies > NL) {
 			slave.choosesOwnAssignmentText += ` enjoys taking care of children, so ${he} decides to work in ${V.nurseryName}. `;
 			r = slave.choosesOwnAssignmentText;
-			assignJob(slave, "work as a nanny");
+			assignJob(slave, Job.NURSERY);
 		}
 
 		return r;
diff --git a/src/facilities/penthouse/penthouseFramework.js b/src/facilities/penthouse/penthouseFramework.js
index 821d06e541080ab38d1b0a3cac3f2af6ff3371bd..818d2057f7c5ce50c885a62bd011b69fcc1c1156 100644
--- a/src/facilities/penthouse/penthouseFramework.js
+++ b/src/facilities/penthouse/penthouseFramework.js
@@ -1,17 +1,17 @@
 
 App.Data.Facilities.penthouse = {
-	baseName: "",
+	baseName: "penthouse",
 	genericName: "Penthouse",
 	jobs: {
 		rest: {
 			position: "Rest",
-			assignment: "rest",
+			assignment: Job.REST,
 			publicSexUse: false,
 			fuckdollAccepted: true
 		},
 		chooseOwn: {
 			position: "Choose own",
-			assignment: "choose her own job",
+			assignment: Job.CHOICE,
 			publicSexUse: false,
 			fuckdollAccepted: false,
 			description: {
@@ -23,55 +23,55 @@ App.Data.Facilities.penthouse = {
 		},
 		fucktoy: {
 			position: "Fucktoy",
-			assignment: "please you",
+			assignment: Job.FUCKTOY,
 			publicSexUse: false,
 			fuckdollAccepted: true
 		},
 		classes: {
 			position: "Classes",
-			assignment: "take classes",
+			assignment: Job.CLASSES,
 			publicSexUse: false,
 			fuckdollAccepted: false
 		},
 		houseServant: {
 			position: "House Servant",
-			assignment: "be a servant",
+			assignment: Job.HOUSE,
 			publicSexUse: false,
 			fuckdollAccepted: false
 		},
 		whore: {
 			position: "Whore",
-			assignment: "whore",
+			assignment: Job.WHORE,
 			publicSexUse: true,
 			fuckdollAccepted: false
 		},
 		publicServant: {
 			position: "Public Servant",
-			assignment: "serve the public",
+			assignment: Job.PUBLIC,
 			publicSexUse: true,
 			fuckdollAccepted: false
 		},
 		subordinateSlave: {
 			position: "Subordinate slave",
-			assignment: "be a subordinate slave",
+			assignment: Job.SUBORDINATE,
 			publicSexUse: false,
 			fuckdollAccepted: false
 		},
 		cow: {
 			position: "Milked",
-			assignment: "get milked",
+			assignment: Job.MILKED,
 			publicSexUse: false,
 			fuckdollAccepted: false
 		},
 		gloryhole: {
 			position: "Gloryhole",
-			assignment: "work a glory hole",
+			assignment: Job.GLORYHOLE,
 			publicSexUse: false,
 			fuckdollAccepted: true
 		},
 		confinement: {
 			position: "Confinement",
-			assignment: "stay confined",
+			assignment: Job.CONFINEMENT,
 			publicSexUse: false,
 			fuckdollAccepted: true
 		}
@@ -79,7 +79,7 @@ App.Data.Facilities.penthouse = {
 	defaultJob: "rest",
 	manager: {
 		position: "Recruiter",
-		assignment: "recruit girls",
+		assignment: Job.RECRUITER,
 		careers: App.Data.misc.recruiterCareers,
 		skill: "recruiter",
 		publicSexUse: false,
@@ -94,29 +94,9 @@ App.Data.Facilities.penthouse = {
 		requiredDevotion: 51
 	}
 };
-App.Entity.Facilities.PenthouseJob = class extends App.Entity.Facilities.Job {
-	/**
-	 * @override
-	 * @returns {number[]} */
-	employeesIndices() {
-		const employees = State.variables.JobIDArray[this.desc.assignment];
-		if (!employees) { return []; }
-		const si = State.variables.slaveIndices;
-		return employees.map(id => si[id]);
-	}
-
-	/**
-	 * @override
-	 * @returns {App.Entity.SlaveState[]}
-	 */
-	employees() {
-		const slaves = State.variables.slaves;
-		return this.employeesIndices().map(idx => slaves[idx]);
-	}
-};
 
 App.Entity.Facilities.PenthouseJobs = {
-	Classes: class extends App.Entity.Facilities.PenthouseJob {
+	Classes: class extends App.Entity.Facilities.Job {
 		checkRequirements(slave) {
 			let r = super.checkRequirements(slave);
 			if (slave.intelligenceImplant >= 15) {
@@ -132,7 +112,7 @@ App.Entity.Facilities.PenthouseJobs = {
 			return r;
 		}
 	},
-	HouseServant: class extends App.Entity.Facilities.PenthouseJob {
+	HouseServant: class extends App.Entity.Facilities.Job {
 		checkRequirements(slave) {
 			let r = super.checkRequirements(slave);
 
@@ -151,7 +131,7 @@ App.Entity.Facilities.PenthouseJobs = {
 		}
 	},
 
-	SubordinateSlave: class extends App.Entity.Facilities.PenthouseJob {
+	SubordinateSlave: class extends App.Entity.Facilities.Job {
 		checkRequirements(slave) {
 			let r = super.checkRequirements(slave);
 			if (!App.Entity.Facilities.Job._isBrokenEnough(slave, -20, -50, -19, -51)) {
@@ -179,12 +159,12 @@ App.Entity.Facilities.PenthouseJobs = {
 				}, linkText);
 		}
 	},
-	Cow: class extends App.Entity.Facilities.PenthouseJob {
+	Cow: class extends App.Entity.Facilities.Job {
 		checkRequirements(slave) {
 			let r = super.checkRequirements(slave);
 
 			if ((slave.lactation <= 0) && (slave.balls <= 0)) {
-				r.push(`${slave.slaveName} is not lactating` + ((State.variables.seeDicks > 0) ? ' or producing semen.' : '.'));
+				r.push(`${slave.slaveName} is not lactating` + ((V.seeDicks > 0) ? ' or producing semen.' : '.'));
 			}
 			return r;
 		}
@@ -202,15 +182,16 @@ App.Entity.Facilities.Penthouse = class extends App.Entity.Facilities.Facility {
 	}
 
 	/** Facility slave capacity
-	* @returns {number} */
+	 * @override
+	 * @returns {number} */
 	get capacity() {
-		return State.variables.dormitory;
+		return V.dormitory;
 	}
 
 	/** Number of already hosted slaves
 	 * @returns {number} */
 	get hostedSlaves() {
-		return State.variables.dormitoryPopulation;
+		return V.dormitoryPopulation;
 	}
 
 	/** Penthouse can be overcrowded, so it always has free space
@@ -218,36 +199,6 @@ App.Entity.Facilities.Penthouse = class extends App.Entity.Facilities.Facility {
 	get hasFreeSpace() {
 		return true;
 	}
-
-	/**
-	 *
-	 * @param {App.Entity.SlaveState} slave
-	 * @returns {boolean}
-	 */
-	isHosted(slave) {
-		return assignmentVisible(slave);
-	}
-
-	/**
-	 * all slaves that are at the penthouse
-	 * @returns {App.Entity.SlaveState[]}
-	 */
-	employees() {
-		return State.variables.slaves.filter( s => assignmentVisible(s));
-	}
-
-	/**
-	 * Indices in the slaves array for all slaves that are at the penthouse
-	 * @returns {number[]}
-	 */
-	employeesIndices() {
-		return State.variables.slaves.reduce(
-			(acc, cur, idx) => { if (assignmentVisible(cur)) { acc.push(idx); } return acc; }, []);
-	}
-
-	_createJob() {
-		return new App.Entity.Facilities.PenthouseJob();
-	}
 };
 
 App.Entity.facilities.penthouse = new App.Entity.Facilities.Penthouse();
diff --git a/src/facilities/pit/pitFramework.js b/src/facilities/pit/pitFramework.js
index ca88780f3c6f1f829379ec40aff9dc264d9b64f3..bac95c22fe173666f8675c8b6d08b0f79941cb4e 100644
--- a/src/facilities/pit/pitFramework.js
+++ b/src/facilities/pit/pitFramework.js
@@ -4,7 +4,7 @@ App.Data.Facilities.pit = {
 	jobs: {
 		fighter: {
 			position: "fighter",
-			assignment: "@Pit", /* pseudo-assignment for assignmentTransition/assignJob/removeJob */
+			assignment: Job.PIT, /* pseudo-assignment for assignmentTransition/assignJob/removeJob */
 			publicSexUse: false,
 			fuckdollAccepted: false,
 			partTime: true
@@ -21,7 +21,7 @@ App.Entity.Facilities.PitFighterJob = class extends App.Entity.Facilities.Facili
 	 */
 	checkRequirements(slave) {
 		let r = super.checkRequirements(slave);
-		if (slave.breedingMark === 1 && State.variables.propOutcome === 1 && State.variables.eugenicsFullControl !== 1 && State.variables.arcologies[0].FSRestart !== "unset") {
+		if (slave.breedingMark === 1 && V.propOutcome === 1 && V.eugenicsFullControl !== 1 && V.arcologies[0].FSRestart !== "unset") {
 			r.push(`${slave.slaveName} may not participate in combat.`);
 		}
 		if (slave.indentureRestrictions > 1) {
@@ -32,15 +32,6 @@ App.Entity.Facilities.PitFighterJob = class extends App.Entity.Facilities.Facili
 		}
 		return r;
 	}
-
-	isEmployed(slave) {
-		return State.variables.fighterIDs.includes(slave.ID);
-	}
-
-	employeesIndices() {
-		const si = V.slaveIndices;
-		return V.fighterIDs.map(id => si[id]);
-	}
 };
 
 App.Entity.Facilities.Pit = class extends App.Entity.Facilities.SingleJobFacility {
@@ -52,11 +43,7 @@ App.Entity.Facilities.Pit = class extends App.Entity.Facilities.SingleJobFacilit
 	}
 
 	get capacity() {
-		return State.variables[this.desc.baseName] > 0 ? Number.MAX_VALUE : 0;
-	}
-
-	get hostedSlaves() {
-		return State.variables.fighterIDs.length;
+		return super.capacity > 0 ? Number.MAX_VALUE : 0;
 	}
 };
 
diff --git a/src/facilities/schoolroom/schoolroomFramework.js b/src/facilities/schoolroom/schoolroomFramework.js
index 69b43db065135e07c6f7d961b0ce4d5e35d4ef78..04b487df197d89d545eb0d85b6d4b5da4bc6afb5 100644
--- a/src/facilities/schoolroom/schoolroomFramework.js
+++ b/src/facilities/schoolroom/schoolroomFramework.js
@@ -4,7 +4,7 @@ App.Data.Facilities.schoolroom = {
 	jobs: {
 		student: {
 			position: "",
-			assignment: "learn in the schoolroom",
+			assignment: Job.SCHOOL,
 			publicSexUse: false,
 			fuckdollAccepted: false,
 			description: {
@@ -17,7 +17,7 @@ App.Data.Facilities.schoolroom = {
 	defaultJob: "student",
 	manager: {
 		position: "schoolteacher",
-		assignment: "be the Schoolteacher",
+		assignment: Job.TEACHER,
 		careers: App.Data.misc.schoolteacherCareers,
 		skill: "teacher",
 		publicSexUse: false,
@@ -59,11 +59,6 @@ App.Entity.Facilities.SchoolroomStudentJob = class extends App.Entity.Facilities
 
 		return r;
 	}
-
-	/** @private @override */
-	get _employeeIDsVariableName() {
-		return "SchlRiIDs";
-	}
 };
 
 App.Entity.facilities.schoolroom = new App.Entity.Facilities.SingleJobFacility(
diff --git a/src/facilities/servantsQuarters/servantsQuartersFramework.js b/src/facilities/servantsQuarters/servantsQuartersFramework.js
index 2e6713317dcee7ff08e6f70487d3ec55fe96b1ac..b07dd100fc998fed4bffe6219082c833e07ce51a 100644
--- a/src/facilities/servantsQuarters/servantsQuartersFramework.js
+++ b/src/facilities/servantsQuarters/servantsQuartersFramework.js
@@ -4,7 +4,7 @@ App.Data.Facilities.servantsQuarters = {
 	jobs: {
 		servant: {
 			position: "servant",
-			assignment: "work as a servant",
+			assignment: Job.QUARTER,
 			publicSexUse: false,
 			fuckdollAccepted: false,
 			description: {
@@ -17,7 +17,7 @@ App.Data.Facilities.servantsQuarters = {
 	defaultJob: "servant",
 	manager: {
 		position: "stewardess",
-		assignment: "be the Stewardess",
+		assignment: Job.STEWARD,
 		careers: App.Data.misc.stewardessCareers,
 		skill: "stewardess",
 		publicSexUse: false,
@@ -52,11 +52,6 @@ App.Entity.Facilities.ServantsQuartersServantJob = class extends App.Entity.Faci
 		}
 		return r;
 	}
-
-	/** @private @override */
-	get _employeeIDsVariableName() {
-		return "ServQiIDs";
-	}
 };
 
 App.Entity.Facilities.ServantsQuartersStewardessJob = class extends App.Entity.Facilities.ManagingJob {
diff --git a/src/facilities/spa/spaFramework.js b/src/facilities/spa/spaFramework.js
index 65c5565e9bce14a89f5aabde53437d3701f2e33d..2375a1bde62716d9d86ebce91e3a25a87a48b98e 100644
--- a/src/facilities/spa/spaFramework.js
+++ b/src/facilities/spa/spaFramework.js
@@ -4,7 +4,7 @@ App.Data.Facilities.spa = {
 	jobs: {
 		assignee: {
 			position: "",
-			assignment: "rest in the spa",
+			assignment: Job.SPA,
 			publicSexUse: false,
 			fuckdollAccepted: false,
 			description: {
@@ -17,7 +17,7 @@ App.Data.Facilities.spa = {
 	defaultJob: "assignee",
 	manager: {
 		position: "attendant",
-		assignment: "be the Attendant",
+		assignment: Job.ATTENDANT,
 		careers: App.Data.misc.attendantCareers,
 		skill: "attendant",
 		publicSexUse: false,
diff --git a/src/facilities/widgets/misc.tw b/src/facilities/widgets/misc.tw
index d4341a3059e3bda9f1e7c2072a7b01d1c336d5d0..a6bf858541db3ebe093621382dd7a8ca3d163755 100644
--- a/src/facilities/widgets/misc.tw
+++ b/src/facilities/widgets/misc.tw
@@ -3,7 +3,7 @@
 /* Call as removeFacilityWorkers <facilityName> <managerAssignment> <workerAssignment> */
 <<widget "removeFacilityWorkers">>
 	<<set _facility = App.Entity.facilities[$args[0]]>>
-	<<set _count = _facility.hostedSlaves + (_facility.manager && _facility.manager.currentEmployee ? 1 : 0)>>
+	<<set _count = _facility.totalEmployeesCount>>
 	<<set _NewPop = _count+$dormitoryPopulation>>
 	<<if _count > 0>>
 		<<set _passage = passage()>>
diff --git a/src/gui/storyCaption.tw b/src/gui/storyCaption.tw
index 22a5317b56705546419fce7af09f10170a2efe5b..2df3634e36094469d20f45724e3e0eef6069ae91 100644
--- a/src/gui/storyCaption.tw
+++ b/src/gui/storyCaption.tw
@@ -313,12 +313,13 @@
 		<</if>>
 
 		<<if _Pass == "Main" && $newModelUI == 0>>
+				<<set _L = App.Utils.countFacilityWorkers()>>
 				<<if ($HGSuite)>>
 					<br> <<link "$HGSuiteNameCaps""Head Girl Suite">><</link>>
 					<<if $abbreviateSidebar == 2>>
-						<<if $HeadGirl != 0>>(HG<<if $HGSuiteiIDs.length > 0>>, 1)<<else>>)<</if>><</if>>
+						<<if $HeadGirl != 0>>(HG<<if _L.HGSuite > 0>>, 1)<<else>>)<</if>><</if>>
 					<<else>>
-						<<if $HeadGirl != 0>>(HG<<if $HGSuiteiIDs.length > 0>> and slave<<else>>)<</if>><</if>>
+						<<if $HeadGirl != 0>>(HG<<if  _L.HGSuite > 0>> and slave<<else>>)<</if>><</if>>
 					<</if>>
 				<</if>>
 				<<if ($dojo > 1)>>
@@ -331,103 +332,103 @@
 				<<if ($brothel)>>
 					<br> <<link "$brothelNameCaps""Brothel">><</link>>
 					<<if $abbreviateSidebar == 2>>
-						($BrothiIDs.length/<<= $brothel>> whores<<if $Madam>>, madam<</if>>)
+						(_L.brothel/<<= $brothel>> whores<<if $Madam>>, madam<</if>>)
 					<<else>>
-						($BrothiIDs.length/<<= $brothel>><<if $Madam>>, L<</if>>)
+						(_L.brothel/<<= $brothel>><<if $Madam>>, L<</if>>)
 					<</if>>
 				<</if>>
 				<<if ($club)>>
 					<br> <<link "$clubNameCaps""Club">><</link>>
 					<<if $abbreviateSidebar == 2>>
-						($ClubiIDs.length/<<= $club>> sluts<<if $DJ>>, DJ<</if>>)
+						(_L.club/<<= $club>> sluts<<if $DJ>>, DJ<</if>>)
 					<<else>>
-						($ClubiIDs.length/<<= $club>><<if $DJ>>, L<</if>>)
+						(_L.club/<<= $club>><<if $DJ>>, L<</if>>)
 					<</if>>
 				<</if>>
 
 				<<if ($arcade)>>
 					<br> <<link "$arcadeNameCaps""Arcade">><</link>>
 					<<if $abbreviateSidebar == 2>>
-						($ArcadeiIDs.length/<<= $arcade>> inmates)
+						(_L.arcade/<<= $arcade>> inmates)
 					<<else>>
-						($ArcadeiIDs.length/<<= $arcade>>)
+						(_L.arcade/<<= $arcade>>)
 					<</if>>
 				<</if>>
 				<<if ($dairy)>>
 					<br> <<link "$dairyNameCaps""Dairy">><</link>>
 					<<set _SCapT9 = $bioreactorsXY+$bioreactorsXX+$bioreactorsHerm+$bioreactorsBarren>>
 					<<if $abbreviateSidebar == 2>>
-						($DairyiIDs.length<<if _SCapT9>>+_SCapT9<</if>>/<<= $dairy>> cows<<if $Milkmaid>>, milkmaid<</if>>)
+						(_L.dairy<<if _SCapT9>>+_SCapT9<</if>>/<<= $dairy>> cows<<if $Milkmaid>>, milkmaid<</if>>)
 					<<else>>
-						($DairyiIDs.length<<if _SCapT9>>+_SCapT9<</if>>/<<= $dairy>><<if $Milkmaid>>, L<</if>>)
+						(_L.dairy<<if _SCapT9>>+_SCapT9<</if>>/<<= $dairy>><<if $Milkmaid>>, L<</if>>)
 					<</if>>
 				<</if>>
 
 				<<if ($farmyard)>>
 					<br> <<link "$farmyardNameCaps""Farmyard">><</link>>
 					<<if $abbreviateSidebar == 2>>
-						($FarmyardiIDs.length/$farmyard farmhands<<if $Farmer>>, farmer<</if>>)
+						(_L.farmyard/$farmyard farmhands<<if $Farmer>>, farmer<</if>>)
 					<<else>>
-						($FarmyardiIDs.length/$farmyard<<if $Farmer>>, L<</if>>)
+						(_L.farmyard/$farmyard<<if $Farmer>>, L<</if>>)
 					<</if>>
 				<</if>>
 				<<if ($servantsQuarters)>>
 					<br> <<link "$servantsQuartersNameCaps""Servants' Quarters">><</link>>
 					<<if $abbreviateSidebar == 2>>
-						($ServQiIDs.length/$servantsQuarters servants<<if $Stewardess>>, stewardess<</if>>)
+						(_L.servantsQuarters/$servantsQuarters servants<<if $Stewardess>>, stewardess<</if>>)
 					<<else>>
-						($ServQiIDs.length/$servantsQuarters<<if $Stewardess>>, L<</if>>)
+						(_L.servantsQuarters/$servantsQuarters<<if $Stewardess>>, L<</if>>)
 					<</if>>
 				<</if>>
 
 				<<if ($masterSuite)>>
 					<br> <<link "$masterSuiteNameCaps""Master Suite">><</link>>
 					<<if $abbreviateSidebar == 2>>
-						($MastSiIDs.length/$masterSuite <<if $MastSiIDs.length != 1>>fucktoys<<else>>fucktoy<</if>><<if $Concubine>>, Concubine<</if>>)
+						(_L.masterSuite/$masterSuite <<if _L.masterSuite != 1>>fucktoys<<else>>fucktoy<</if>><<if $Concubine>>, Concubine<</if>>)
 					<<else>>
-						($MastSiIDs.length/$masterSuite<<if $Concubine>>, C<</if>>)
+						(_L.masterSuite/$masterSuite<<if $Concubine>>, C<</if>>)
 					<</if>>
 				<</if>>
 				<<if ($schoolroom)>>
 					<br> <<link "$schoolroomNameCaps""Schoolroom">><</link>>
 					<<if $abbreviateSidebar == 2>>
-						($SchlRiIDs.length/$schoolroom <<if $SchlRiIDs.length != 1>>students<<else>>student<</if>><<if $Schoolteacher>>, schoolteacher<</if>>)
+						(_L.schoolroom/$schoolroom <<if _L.schoolroom != 1>>students<<else>>student<</if>><<if $Schoolteacher>>, schoolteacher<</if>>)
 					<<else>>
-						($SchlRiIDs.length/$schoolroom<<if $Schoolteacher>>, L<</if>>)
+						(_L.schoolroom/$schoolroom<<if $Schoolteacher>>, L<</if>>)
 					<</if>>
 				<</if>>
 
 				<<if ($spa)>>
 					<br> <<link "$spaNameCaps""Spa">><</link>>
 					<<if $abbreviateSidebar == 2>>
-						($SpaiIDs.length/$spa <<if $SpaiIDs.length != 1>>bathers<<else>>bathing<</if>><<if _S.Attendant>>, attendant<</if>>)
+						(_L.spa/$spa <<if _L.spa != 1>>bathers<<else>>bathing<</if>><<if _S.Attendant>>, attendant<</if>>)
 					<<else>>
-						($SpaiIDs.length/$spa<<if _S.Attendant>>, L<</if>>)
+						(_L.spa/$spa<<if _S.Attendant>>, L<</if>>)
 					<</if>>
 				<</if>>
 				<<if ($nursery)>>
 					<br> <<link "$nurseryNameCaps""Nursery">><</link>>
 					<<if $abbreviateSidebar == 2>>
-						(<<if $nursery-$nurseryBabies == 0>>No empty rooms<<elseif $nursery-$nurseryBabies == 1>>1 empty room<<else>><<= $nursery-$nurseryBabies>> empty rooms<</if>>, $NurseryiIDs.length/$nurseryNannies <<if $NurseryiIDs.length != 1>>nannies<<else>>nanny<</if>><<if $Matron>>, attendant<</if>>)
+						(<<if $nursery-$nurseryBabies == 0>>No empty rooms<<elseif $nursery-$nurseryBabies == 1>>1 empty room<<else>><<= $nursery-$nurseryBabies>> empty rooms<</if>>, _L.nursery/$nurseryNannies <<if _L.nursery != 1>>nannies<<else>>nanny<</if>><<if $Matron>>, attendant<</if>>)
 					<<else>>
-						($nurseryBabies/$nursery, $NurseryiIDs.length/$nurseryNannies<<if $Matron>>, L<</if>>)
+						($nurseryBabies/$nursery, _L.nursery/$nurseryNannies<<if $Matron>>, L<</if>>)
 					<</if>>
 				<</if>>
 
 				<<if ($clinic)>>
 					<br> <<link "$clinicNameCaps""Clinic">><</link>>
 					<<if $abbreviateSidebar == 2>>
-						($CliniciIDs.length/$clinic <<if $CliniciIDs.length != 1>>patients<<else>>patient<</if>><<if $Nurse>>, nurse<</if>>)
+						(_L.clinic/$clinic <<if _L.clinic != 1>>patients<<else>>patient<</if>><<if $Nurse>>, nurse<</if>>)
 					<<else>>
-						($CliniciIDs.length/$clinic<<if $Nurse>>, L<</if>>)
+						(_L.clinic/$clinic<<if $Nurse>>, L<</if>>)
 					<</if>>
 				<</if>>
 				<<if ($cellblock)>>
 					<br> <<link "$cellblockNameCaps""Cellblock">><</link>>
 					<<if $abbreviateSidebar == 2>>
-						($CellBiIDs.length/$cellblock <<if $CellBiIDs.length != 1>>prisoners<<else>>prisoner<</if>><<if $Wardeness>>, wardeness<</if>>)
+						(_L.cellblock/$cellblock <<if _L.cellblock != 1>>prisoners<<else>>prisoner<</if>><<if $Wardeness>>, wardeness<</if>>)
 					<<else>>
-						($CellBiIDs.length/$cellblock<<if $Wardeness>>, L<</if>>)
+						(_L.cellblock/$cellblock<<if $Wardeness>>, L<</if>>)
 					<</if>>
 				<</if>>
 
diff --git a/src/init/storyInit.tw b/src/init/storyInit.tw
index 79c2ea431c584ac573db829803d9e8d4ca92dd0e..ec134ed408094c618cd53e4dc0f92c2049bc3e43 100644
--- a/src/init/storyInit.tw
+++ b/src/init/storyInit.tw
@@ -45,7 +45,7 @@ You should have received a copy of the GNU General Public License along with thi
 <<run setup.prostheticIDs.forEach(function(id) {
 	$prosthetics[id] = {amount: 0, research: 0};
 })>>
-<<set $JobIDArray = resetJobIDArray()>>
+<<set $JobIDMap = makeJobIdMap()>>
 
 /*SFVAR*/ <<set $SF = Object.assign({}, $SF, {Toggle:0, Active: -1}), $SF.Facility = Object.assign({}, $SF.Facility, {Toggle:0, Active:0})>>
 
diff --git a/src/interaction/main/walkPast.js b/src/interaction/main/walkPast.js
index c9e941edc2178fb00bff347c9862adff8d7df1bb..7834c829a7a06a23244d4d3c7e6981059beddbf4 100644
--- a/src/interaction/main/walkPast.js
+++ b/src/interaction/main/walkPast.js
@@ -164,12 +164,12 @@ globalThis.walkPast = (function() {
 			} else if (flag > 100) {
 				const setter = (flag === 110) ? `<<set $partner="${V.partner}", $relation=${V.relation}>>` : `<<set $partner="${V.partner}">>`;
 				output += ` <span id="walkpast"><<link "Summon them both">>${setter}<<replace "#walk">><<include $target>><</replace>><</link>></span>`;
-			} else if (activeSlave.assignment === "stay confined") {
+			} else if (activeSlave.assignment === Job.CONFINEMENT) {
 				output += ` <span id="walkpast"><<link "Have ${him} brought out of ${his} cell">><<replace "#walk">><<include $target>><</replace>><</link>></span>`;
-			} else if (activeSlave.assignment === "work in the dairy" && V.dairyRestraintsSetting > 1) {
+			} else if (activeSlave.assignment === Job.DAIRY && V.dairyRestraintsSetting > 1) {
 				output += ` ${He} is strapped into a milking machine and cannot leave ${V.dairyName}.`;
 			} else {
-				if (["be confined in the arcade", "be confined in the cellblock", Job.ATTENDANT, "be the DJ", "be the Madam", "be the Milkmaid", "be the Schoolteacher", "be the Stewardess", "be the Wardeness", "be your agent", "be your Concubine", "live with your agent", "live with your Head Girl", "serve in the club", "serve in the master suite", "stay confined", "work a glory hole", "work as a servant", "work in the brothel", "work in the dairy"].includes(activeSlave.assignment)) {
+				if ([Job.ARCADE, Job.CELLBLOCK, Job.ATTENDANT, Job.DJ, Job.MADAM, Job.MILKMAID, Job.TEACHER, Job.STEWARD, Job.WARDEN, Job.AGENT, Job.CONCUBINE, Job.AGENTPARTNER, Job.HEADGIRLSUITE, Job.CLUB, Job.MASTERSUITE, Job.CONFINEMENT, Job.GLORYHOLE, Job.QUARTER, Job.BROTHEL, Job.DAIRY].includes(activeSlave.assignment)) {
 					output += ` <span id="walkpast"><<link "Have ${him} take a break and come up">><<replace "#walk">><<include $target>><</replace>><</link>></span>`;
 				} else {
 					output += ` <span id="walkpast"><<link "Call ${him} over">><<replace "#walk">><<include $target>><</replace>><</link>></span>`;
@@ -268,14 +268,14 @@ globalThis.walkPast = (function() {
 
 			t += `${name} and ${partnerName} are `;
 			if (!isSlaveAvailable(partnerSlave)) {
-				if (partnerSlave.assignment === "work in the dairy" && V.dairyRestraintsSetting >= 2) {
+				if (partnerSlave.assignment === Job.DAIRY && V.dairyRestraintsSetting >= 2) {
 					t += `trying their best to maintain their relationship with ${partnerName} being part of ${V.dairyName}.`;
-				} else if (partnerSlave.assignment === "be your agent" && activeSlave.assignment !== "live with your agent") {
+				} else if (partnerSlave.assignment === Job.AGENT && activeSlave.assignment !== Job.AGENTPARTNER) {
 					t += `catching up with each other over a video call. Running an arcology in your stead comes with its perks.`;
-				} else if (partnerSlave.assignment === "live with your agent" || activeSlave.assignment === "live with your agent") {
+				} else if (partnerSlave.assignment === Job.AGENTPARTNER || activeSlave.assignment === Job.AGENTPARTNER) {
 					const arc = V.arcologies.find((a) => (a.leaderID === partnerSlave.ID || a.leaderID === activeSlave.ID));
 					t += `having some casual fun with each other in the penthouse of ${arc.name}. ${V.assistant.name} has helpfully put a live feed of their activities up on one of the large screens in your office.`;
-				} else if (partnerSlave.assignment === "be confined in the arcade") {
+				} else if (partnerSlave.assignment === Job.ARCADE) {
 					t += `trying their best to maintain their relationship with ${partnerName} being nothing more than a hole in ${V.arcadeName}.`;
 				}
 			} else if (seed >= 66) { /* SEXY TIMES */
@@ -1477,13 +1477,13 @@ globalThis.walkPast = (function() {
 		race = (V.seeRace ? slave.race : "");
 
 		switch (slave.assignment) {
-			case "be your agent":
+			case Job.AGENT:
 				t += `is shaping society in ${his} assigned arcology.`;
 				break;
-			case "live with your agent":
+			case Job.AGENTPARTNER:
 				t += `is helping ${his} lover shape society in ${his} assigned arcology.`;
 				break;
-			case "work in the dairy":
+			case Job.DAIRY:
 				if (V.dairyRestraintsSetting > 1) {
 					t += `is strapped to a milking machine in ${V.dairyName}, `;
 					if (slave.ovaries === 1 && V.dairyPregSetting > 0 && jsRandom(1, 2) === 2) {
@@ -1662,7 +1662,7 @@ globalThis.walkPast = (function() {
 					}
 				}
 				break;
-			case "work in the brothel":
+			case Job.BROTHEL:
 				t += `is working in ${V.brothelName}, and is `;
 				if (Beauty(slave) > 100 && jsRandom(1, 2) === 1) {
 					if (seed > 80) {
@@ -1719,7 +1719,7 @@ globalThis.walkPast = (function() {
 				}
 				t += ` You have a voyeuristic view of ${his} ${race} body on the feeds.`;
 				break;
-			case "serve in the club":
+			case Job.CLUB:
 				t += `is working in ${V.clubName}, `;
 				if (seed > 50) {
 					t += `displaying ${his} ${race} body, keeping citizens company, and flirting with anyone who shows interest.`;
@@ -1727,14 +1727,14 @@ globalThis.walkPast = (function() {
 					t += `or rather just off it, having taken a prominent citizen back to a discreet room so he can use ${his} ${race} body.`;
 				}
 				break;
-			case "work as a servant":
+			case Job.QUARTER:
 				if (seed > 50) {
 					t += `was scrubbing the penthouse floor, until another slave requested oral service.`;
 				} else {
 					t += `is scrubbing the penthouse floor.`;
 				}
 				break;
-			case "serve in the master suite":
+			case Job.MASTERSUITE:
 				if (slave.fuckdoll > 0) {
 					t += `waiting for use in ${V.masterSuiteName}, next to a display case full of other sex toys.`;
 				} else if (V.masterSuiteUpgradeLuxury === 1) {
@@ -1840,20 +1840,20 @@ globalThis.walkPast = (function() {
 				}
 				break;
 				/*
-		case "guard you":
+		case Job.BODYGUARD:
 			t += `is standing discreetly behind your left shoulder, watching for threats.`;
 			break
 		*/
-			case "stay confined":
+			case Job.CONFINEMENT:
 				t += `is confined, but you have a fine view of ${his} ${race} body on the feed from ${his} cell.`;
 				break;
-			case "be confined in the cellblock":
+			case Job.CELLBLOCK:
 				t += `is confined in ${V.cellblockName}, but you have a fine view of ${his} ${race} body on the feed from ${his} cell.`;
 				break;
-			case "be confined in the arcade":
-			case "work a glory hole":
+			case Job.ARCADE:
+			case Job.GLORYHOLE:
 				t += `is confined in `;
-				if (slave.assignment === "be confined in the arcade") {
+				if (slave.assignment === Job.ARCADE) {
 					t += `${V.arcadeName}; `;
 				} else {
 					t += `a glory hole; `;
@@ -1870,17 +1870,17 @@ globalThis.walkPast = (function() {
 					t += `a customer is cruelly spanking ${his} helpless butt.`;
 				}
 				break;
-			case "be the Madam":
+			case Job.MADAM:
 				t += `is managing ${V.brothelName}: ${he} is making sure all the customers are satisfied and all the whores are working hard.`;
 				break;
-			case "be your Concubine":
+			case Job.CONCUBINE:
 				if (jsRandom(1, 2) === 1) {
 					t += `is looking after ${himself}; ${he} spends many hours every day on ${his} beauty regimen.`;
 				} else {
 					t += `is checking over the appearance of your harem, making sure everyone looks perfect.`;
 				}
 				break;
-			case "be the Wardeness":
+			case Job.WARDEN:
 				t += `is looking after the cells: ${he} is `;
 				if (seed > 50) {
 					t += `forcing a resistant slave to orally service ${him}.`;
@@ -1888,23 +1888,23 @@ globalThis.walkPast = (function() {
 					t += `beating a rebellious slave across the buttocks.`;
 				}
 				break;
-			case "live with your Head Girl":
+			case Job.HEADGIRLSUITE:
 				if (V.HeadGirl !== 0) {
 					t += `is getting the Head Girl's suite cleaned up while ${V.HeadGirl.slaveName} is out working.`;
 				} else {
 					t += `is making sure the Head Girl's suite is in order for your next Head Girl.`;
 				}
 				break;
-			case "be the Stewardess":
+			case Job.STEWARD:
 				t += `is managing the house servants in ${V.servantsQuartersName}: ${he} overseeing the laboring house slaves and punishing any that step out of line.`;
 				break;
-			case "be the Schoolteacher":
+			case Job.TEACHER:
 				t += `is teaching classes in ${V.schoolroomName}: ${he} is leading the slave students in rote recitation.`;
 				break;
-			case "be the Attendant":
+			case Job.ATTENDANT:
 				t += `is seeing to the guests in ${V.spaName}: ${he} is gently soaping an exhausted slave.`;
 				break;
-			case "be the DJ":
+			case Job.DJ:
 				if (seed > 50) {
 					t += `is right where ${he} belongs, in the DJ booth in ${V.clubName} ${he} leads. ${He}'s bouncing in time with the beat to show off ${his} `;
 					if (slave.boobs > 300) {
@@ -1916,7 +1916,7 @@ globalThis.walkPast = (function() {
 					t += `is taking the lead on ${V.clubName}'s floor: ${he} greets new arrivals, flirts with them prettily, and subtly guides them towards choice sluts.`;
 				}
 				break;
-			case "be the Milkmaid":
+			case Job.MILKMAID:
 				t += `is working in ${V.dairyName}, looking after your stock.`;
 				break;
 			default: /* WALKPASTS START HERE */
@@ -1973,14 +1973,14 @@ globalThis.walkPast = (function() {
 					}
 				} else {
 					switch (slave.assignment) {
-						case "rest":
+						case Job.REST:
 							if (seed > 50) {
 								t += `bed; `;
 							} else {
 								t += `eat; `;
 							}
 							break;
-						case "get milked":
+						case Job.MILKED:
 							if (seed > 50) {
 								if (slave.lactation) {
 									t += `milk ${his} overfull ${race} tits; `;
@@ -1995,33 +1995,33 @@ globalThis.walkPast = (function() {
 								}
 							}
 							break;
-						case "whore":
+						case Job.WHORE:
 							if (seed > 50) {
 								t += `sell ${his} ${race} body; `;
 							} else {
 								t += `ply ${his} trade as a whore; `;
 							}
 							break;
-						case "serve the public":
+						case Job.PUBLIC:
 							if (seed > 50) {
 								t += `serve the public; `;
 							} else {
 								t += `be a public slut; `;
 							}
 							break;
-						case "rest in the spa":
+						case Job.SPA:
 							t += `relax in ${V.spaName}; `;
 							break;
-						case "please you":
+						case Job.FUCKTOY:
 							t += `wait next to you and wait for you to fuck ${him}; `;
 							break;
-						case "be a subordinate slave":
+						case Job.SUBORDINATE:
 							t += `service your other slaves; `;
 							break;
-						case "be a servant":
+						case Job.HOUSE:
 							t += `clean up after your other slaves; `;
 							break;
-						case "learn in the schoolroom":
+						case Job.SCHOOL:
 							t += `attend classes `;
 							if (V.Schoolteacher === 0) {
 								t += `in ${V.schoolroomName}; `;
@@ -2029,16 +2029,16 @@ globalThis.walkPast = (function() {
 								t += `under ${V.Schoolteacher.slaveName}, perhaps literally; `;
 							}
 							break;
-						case "be the Attendant":
+						case Job.ATTENDANT:
 							t += `look after the slaves in ${V.spaName}; `;
 							break;
-						case "take classes":
+						case Job.CLASSES:
 							t += `attend classes with ${V.assistant.name}; `;
 							break;
-						case "be your Head Girl":
+						case Job.HEADGIRL:
 							t += `oversee your other slaves; `;
 							break;
-						case "recruit girls":
+						case Job.RECRUITER:
 							t += `use ${his} connections to recruit slaves; `;
 							break;
 						default:
diff --git a/src/interaction/slaveInteract.js b/src/interaction/slaveInteract.js
index 89aa2cb3e3152f83de892322ef18e6e86e5ffbfc..afbddd8505467dfc90504fdad25cfa0fb86296b5 100644
--- a/src/interaction/slaveInteract.js
+++ b/src/interaction/slaveInteract.js
@@ -34,7 +34,7 @@ App.UI.SlaveInteract.modify = function(slave) {
 	const {he, his} = getPronouns(slave);
 	let el = new DocumentFragment();
 
-	const isAgent = ["be your agent", "live with your agent"].includes(slave.assignment);
+	const isAgent = [Job.AGENT, Job.AGENTPARTNER].includes(slave.assignment);
 
 	App.UI.DOM.appendNewElement('p', el, isAgent ? "Recall your agent to modify them." : "Take slave to another room.", "scene-intro");
 
@@ -164,6 +164,10 @@ App.UI.SlaveInteract.fucktoyPref = function(slave) {
 	return el;
 };
 
+/**
+ * @param {App.Entity.SlaveState} slave
+ * @returns {JQuery<HTMLElement>}
+ */
 App.UI.SlaveInteract.work = function(slave) {
 	let el = new DocumentFragment();
 	let p;
@@ -185,7 +189,7 @@ App.UI.SlaveInteract.work = function(slave) {
 	}
 
 	p = document.createElement('p');
-	if (["be your agent", "live with your agent"].includes(slave.assignment)) {
+	if ([Job.AGENT, Job.AGENTPARTNER].includes(slave.assignment)) {
 		p.className = "scene-intro";
 		p.textContent = `Recall your agent to modify them.`;
 	} else {
@@ -207,46 +211,46 @@ App.UI.SlaveInteract.work = function(slave) {
 		case "recover from surgery":
 			span.textContent = `${He} is recovering from surgery this week`;
 			break;
-		case "guard you":
+		case Job.BODYGUARD:
 			span.textContent = `${He} is your Bodyguard and is not available for other work`;
 			break;
-		case "be the Madam":
+		case Job.MADAM:
 			span.textContent = `${He} is the Madam and is not available for other work`;
 			break;
-		case "be the DJ":
+		case Job.DJ:
 			span.textContent = `${He} is the DJ and is not available for other work`;
 			break;
-		case "be the Milkmaid":
+		case Job.MILKMAID:
 			span.textContent = `${He} is the Milkmaid and is not available for other work`;
 			break;
-		case "be the Farmer":
+		case Job.FARMER:
 			span.textContent = `${He} is the Farmer and is not available for other work`;
 			break;
-		case "be the Stewardess":
+		case Job.STEWARD:
 			span.textContent = `${He} is the Stewardess and is not available for other work`;
 			break;
-		case "be your Head Girl":
+		case Job.HEADGIRL:
 			span.textContent = `${He} is your Head Girl and is not available for other work`;
 			break;
-		case "recruit girls":
+		case Job.RECRUITER:
 			span.textContent = `${He} is recruiting slaves and is not available for other work`;
 			break;
-		case "be the Nurse":
+		case Job.NURSE:
 			span.textContent = `${He} is the Nurse and is not available for other work`;
 			break;
-		case "be the Attendant":
+		case Job.ATTENDANT:
 			span.textContent = `${He} is the Attendant of the spa and is not available for other work`;
 			break;
-		case "be the Matron":
+		case Job.MATRON:
 			span.textContent = `${He} is the Matron of the nursery and is not available for other work`;
 			break;
-		case "be the Schoolteacher":
+		case Job.TEACHER:
 			span.textContent = `${He} is the Schoolteacher and is not available for other work`;
 			break;
-		case "be your Concubine":
+		case Job.CONCUBINE:
 			span.textContent = `${He} is your Concubine and is not available for other work`;
 			break;
-		case "be the Wardeness":
+		case Job.WARDEN:
 			span.textContent = `${He} is the Wardeness and is not available for other work`;
 			break;
 		default:
@@ -267,7 +271,7 @@ App.UI.SlaveInteract.work = function(slave) {
 	}
 	el.append(span);
 
-	if (slave.assignment === "whore" || slave.assignment === "work in the brothel") {
+	if (slave.assignment === Job.WHORE || slave.assignment === Job.BROTHEL) {
 		div = document.createElement('div');
 		div.textContent = `Whoring Target: `;
 		span = document.createElement('span');
@@ -328,6 +332,7 @@ App.UI.SlaveInteract.work = function(slave) {
 
 /**
  * @param {App.Entity.SlaveState} slave
+ * @returns {HTMLElement}
  */
 App.UI.SlaveInteract.assignmentBlock = function(slave) {
 	let el = document.createElement('div');
@@ -350,7 +355,7 @@ App.UI.SlaveInteract.assignmentBlock = function(slave) {
 		assign.textContent = `${V.assignmentRecords[slave.ID]}. `;
 		title.appendChild(assign);
 	}
-	if (slave.assignment === "be a subordinate slave") {
+	if (slave.assignment === Job.SUBORDINATE) {
 		const target = getSlave(slave.subTarget);
 		let linkText = ``;
 		if (target) {
@@ -366,7 +371,7 @@ App.UI.SlaveInteract.assignmentBlock = function(slave) {
 		title.appendChild(App.UI.DOM.passageLink(linkText, "Subordinate Targeting", () => { V.returnTo = "Slave Interact"; }));
 		title.append(separator);
 	}
-	if (slave.assignment !== "choose her own job") {
+	if (slave.assignment !== Job.CHOICE) {
 		title.appendChild(
 			App.UI.DOM.link(
 				`Stay on this assignment for another month`,
@@ -1018,7 +1023,7 @@ App.UI.SlaveInteract.useSlaveDisplay = function(slave) {
 			}
 			sexOptions.push({text: `Use another slave to impregnate ${him}`, scene: `FSlaveImpreg`});
 		}
-		if (slave.assignment !== "work in the dairy" && slave.assignment !== "be confined in the arcade" && slave.assignment !== "be confined in the cellblock") {
+		if (slave.assignment !== Job.DAIRY && slave.assignment !== Job.ARCADE && slave.assignment !== Job.CELLBLOCK) {
 			if (V.dairyPiping === 1) {
 				if ((V.milkPipeline > 88 && V.milkPipeline !== 0) || V.arcologies[0].FSPastoralistLaw === 1) {
 					if ((slave.inflation < 3 && slave.pregKnown === 0 && slave.bellyImplant < 1500) || slave.inflation < 1) {
@@ -1070,7 +1075,7 @@ App.UI.SlaveInteract.useSlaveDisplay = function(slave) {
 			} /* wcPiping === 1 */
 		} /* assigned to dairy or arcade */
 		if (slave.inflation === 0 && slave.bellyImplant < 1500) {
-			if (slave.assignment !== "work in the dairy" && slave.assignment !== "be confined in the arcade" && slave.assignment !== "be confined in the cellblock") {
+			if (slave.assignment !== Job.DAIRY && slave.assignment !== Job.ARCADE && slave.assignment !== Job.CELLBLOCK) {
 				if (V.buckets === 1) {
 					fillFaceOptions.push({text: `Two liters of slave food`, scene: `forceFeeding`, updateSlave: {inflation: 1, inflationType: "food", inflationMethod: 1}});
 					if (slave.pregKnown === 0) {
@@ -1161,7 +1166,7 @@ App.UI.SlaveInteract.useSlaveDisplay = function(slave) {
 			if (isSlaveAvailable(lover)) {
 				sexOptions.push({text: `Fuck ${him} with ${his} ${relationshipTermShort(slave)} ${SlaveFullName(lover)}`, scene: `FRelation`, update: {partner: "relationship"}});
 			} else {
-				if (lover.assignment === "be your agent") {
+				if (lover.assignment === Job.AGENT) {
 					if (slave.broodmother < 2) {
 						sexOptions.push({text: `Send ${him} to live with your agent ${SlaveFullName(lover)}`, goto: `Agent Company`, update: {subSlave: lover}});
 					} else {
@@ -1714,7 +1719,7 @@ App.UI.SlaveInteract.incubator = function(slave) {
 
 	if (V.incubator > 0) {
 		if (slave.preg > 0 && slave.broodmother === 0 && slave.pregKnown === 1 && slave.eggType === "human") {
-			if ((slave.assignment === "work in the dairy" && V.dairyPregSetting > 0) || (slave.assignment === "work in the farmyard" && V.farmyardBreeding > 0)) {} else {
+			if ((slave.assignment === Job.DAIRY && V.dairyPregSetting > 0) || (slave.assignment === Job.FARMYARD && V.farmyardBreeding > 0)) {} else {
 				let title = document.createElement('div');
 				let link = document.createElement('div');
 				link.className = "choices";
@@ -1884,7 +1889,7 @@ App.UI.SlaveInteract.nursery = function(slave) {
 		let _reservedNursery = WombReserveCount(slave, "nursery");
 		let _WL = slave.womb.length;
 		if (slave.preg > 0 && slave.broodmother === 0 && slave.pregKnown === 1 && slave.eggType === "human") {
-			if ((slave.assignment === "work in the dairy" && V.dairyPregSetting > 0) || (slave.assignment === "work in the farmyard" && V.farmyardBreeding > 0)) {} else {
+			if ((slave.assignment === Job.DAIRY && V.dairyPregSetting > 0) || (slave.assignment === Job.FARMYARD && V.farmyardBreeding > 0)) {} else {
 				let title = document.createElement('div');
 				let link = document.createElement('div');
 				link.className = "choices";
diff --git a/src/js/DefaultRules.js b/src/js/DefaultRules.js
index a20fcec1af1674d0684b491e75ebbb6db39b26ad..9adec3e81745c629d565c9e40df3129d7707074e 100644
--- a/src/js/DefaultRules.js
+++ b/src/js/DefaultRules.js
@@ -141,8 +141,8 @@ globalThis.DefaultRules = (function() {
 			delete rule.setAssignment;
 		};
 		switch (rule.setAssignment) {
-			case "rest":
-			case "please you":
+			case Job.REST:
+			case Job.FUCKTOY:
 				// slaves always qualify for this assignment
 				break;
 			default:
@@ -168,7 +168,7 @@ globalThis.DefaultRules = (function() {
 	function AssignJobToSlave(slave, rule) {
 		// place slave on assignment defined by the rule
 		if ((rule.setAssignment !== undefined && rule.setAssignment !== null)) {
-			if (((rule.setAssignment === "choose her own job" && !slave.choosesOwnAssignment) || rule.setAssignment !== slave.assignment)) {
+			if (((rule.setAssignment === Job.CHOICE && !slave.choosesOwnAssignment) || rule.setAssignment !== slave.assignment)) {
 				r += getAssignmentDescription({rule, slave, assignmentResult: "success"});
 				assignJob(slave, rule.setAssignment);
 			}
@@ -1768,9 +1768,9 @@ globalThis.DefaultRules = (function() {
 			} else if ((slave.balls > 0)) {
 				if ((rule.XY !== undefined) && (rule.XY !== null)) {
 					if (slave.hormones !== rule.XY) {
-						if ((slave.assignment !== "recruit girls")) {
-							if ((slave.assignment !== "be the Wardeness")) {
-								if ((slave.assignment !== "be the Madam")) {
+						if ((slave.assignment !== Job.RECRUITER)) {
+							if ((slave.assignment !== Job.WARDEN)) {
+								if ((slave.assignment !== Job.MADAM)) {
 									const _oldHormones = slave.hormones;
 									slave.hormones = rule.XY;
 									if (slave.indentureRestrictions >= 2) {
@@ -1845,7 +1845,7 @@ globalThis.DefaultRules = (function() {
 		if ((rule.livingRules !== undefined) && (rule.livingRules !== null)) {
 			if (setup.facilityCareers.includes(slave.assignment)) {
 				r += ""; // `<br>${slave.slaveName}'s living standards are controlled by ${his} assignment.`;
-			} else if (((slave.assignment === "be your Head Girl") && (V.HGSuite === 1)) || ((slave.assignment === "guard you") && (V.dojo > 1))) {
+			} else if (((slave.assignment === Job.HEADGIRL) && (V.HGSuite === 1)) || ((slave.assignment === Job.BODYGUARD) && (V.dojo > 1))) {
 				r += `<br>${slave.slaveName} has a private room.`;
 			} else if ((slave.fetish === "mindbroken")) {
 				if ((slave.rules.living !== "spare")) {
diff --git a/src/js/SlaveState.js b/src/js/SlaveState.js
index 586b3d545fee312bd68379fe71c8a7ea738ce25e..a7f3b48a806aaa824afef492bc7d6ff798d2ce92 100644
--- a/src/js/SlaveState.js
+++ b/src/js/SlaveState.js
@@ -523,7 +523,7 @@ App.Entity.SlaveState = class SlaveState {
 		 * 0: no; 1: yes */
 		this.choosesOwnAssignment = 0;
 		/** slave's assignment */
-		this.assignment = "rest";
+		this.assignment = Job.REST;
 		/** how many weeks a slave is sentenced to work a job */
 		this.sentence = 0;
 		/** how far along slave is with being trained (skills, flaws, quirks) */
diff --git a/src/js/assayJS.js b/src/js/assayJS.js
index 06ea5fcaad4d35b445b62e62fcda34143fee52ba..5c8bebc441754931690024218ba2b7810482144c 100644
--- a/src/js/assayJS.js
+++ b/src/js/assayJS.js
@@ -61,7 +61,7 @@ globalThis.isRivalP = function(slave, target) {
  * @returns {boolean}
  */
 globalThis.supremeRaceP = function(slave) {
-	return State.variables.arcologies[0].FSSupremacistRace === slave.race;
+	return V.arcologies[0].FSSupremacistRace === slave.race;
 };
 
 /**
@@ -69,7 +69,7 @@ globalThis.supremeRaceP = function(slave) {
  * @returns {boolean}
  */
 globalThis.inferiorRaceP = function(slave) {
-	return State.variables.arcologies[0].FSSubjugationistRace === slave.race;
+	return V.arcologies[0].FSSubjugationistRace === slave.race;
 };
 
 /**
@@ -246,7 +246,7 @@ globalThis.newSlave = function(slave) {
 	if (slave.assignment) {
 		assignJob(slave, slave.assignment);
 	} else {
-		slave.assignment = "choose her own job";
+		slave.assignment = Job.CHOICE;
 	}
 
 	/** do not run the Rules Assistant before adding the new slave to the slaves list! **/
@@ -259,13 +259,12 @@ globalThis.newSlave = function(slave) {
  * @param {App.Entity.SlaveState} slave
  */
 globalThis.addSlave = function(slave) {
-	State.variables.slaves.push(slave);
-	State.variables.slaveIndices[slave.ID] = State.variables.slaves.length - 1;
+	V.slaveIndices[slave.ID] = V.slaves.push(slave) - 1;
 };
 
 globalThis.removeSlave = function(index) {
-	const ret = State.variables.slaves.deleteAt(index);
-	State.variables.slaveIndices = slaves2indices();
+	const ret = V.slaves.deleteAt(index);
+	V.slaveIndices = slaves2indices();
 	return ret;
 };
 
@@ -273,7 +272,7 @@ globalThis.removeSlave = function(index) {
  * @param {App.Entity.SlaveState[]} [slaves]
  * @returns {Object.<number, number>}
  */
-globalThis.slaves2indices = function(slaves = State.variables.slaves) {
+globalThis.slaves2indices = function(slaves = V.slaves) {
 	return slaves.reduce((acc, slave, i) => { acc[slave.ID] = i; return acc; }, {});
 };
 
@@ -282,8 +281,8 @@ globalThis.slaves2indices = function(slaves = State.variables.slaves) {
  * @returns {App.Entity.SlaveState}
  */
 globalThis.getSlave = function(ID) {
-	const index = State.variables.slaveIndices[ID];
-	return index === undefined ? undefined : State.variables.slaves[index];
+	const index = V.slaveIndices[ID];
+	return index === undefined ? undefined : V.slaves[index];
 };
 
 /**
@@ -291,12 +290,12 @@ globalThis.getSlave = function(ID) {
  * @returns {App.Entity.SlaveState}
  */
 globalThis.slaveStateById = function(ID) {
-	const index = State.variables.slaveIndices[ID];
-	return index === undefined ? null : State.variables.slaves[index];
+	const index = V.slaveIndices[ID];
+	return index === undefined ? null : V.slaves[index];
 };
 
 globalThis.getChild = function(ID) {
-	return State.variables.cribs.find(s => s.ID === ID);
+	return V.cribs.find(s => s.ID === ID);
 };
 
 App.Utils.Pronouns = class {
@@ -307,7 +306,7 @@ App.Utils.Pronouns = class {
 		/** @type {App.Data.Pronouns.Definition} */
 		this._pronouns = obj.pronoun < App.Data.Pronouns.Kind.custom ?
 			App.Data.Pronouns.Std[obj.pronoun] :
-			State.variables.customPronouns[obj.pronoun];
+			V.customPronouns[obj.pronoun];
 	}
 
 	get pronoun() { return this._pronouns.pronoun; }
@@ -1106,20 +1105,20 @@ globalThis.SlaveTitle = function(slave) {
  */
 globalThis.DegradingName = function(slave) {
 	const leadershipPosition = [
-		"be the Attendant",
-		"be the Matron",
-		"be the Stewardess",
-		"be the Milkmaid",
-		"be the Farmer",
-		"be the DJ",
-		"be your Concubine",
-		"be the Madam",
-		"be the Schoolteacher",
-		"be the Wardeness",
-		"be the Nurse",
-		"be your Head Girl",
-		"guard you",
-		"recruit girls"
+		Job.ATTENDANT,
+		Job.MATRON,
+		Job.STEWARD,
+		Job.MILKMAID,
+		Job.FARMER,
+		Job.DJ,
+		Job.CONCUBINE,
+		Job.MADAM,
+		Job.TEACHER,
+		Job.WARDEN,
+		Job.NURSE,
+		Job.HEADGIRL,
+		Job.BODYGUARD,
+		Job.RECRUITER
 	];
 	const names = [];
 	const suffixes = [];
@@ -1127,7 +1126,7 @@ globalThis.DegradingName = function(slave) {
 	if (slave.fuckdoll > 0) {
 		slave.slaveName = `Fuckdoll No. ${slave.ID}`;
 		slave.slaveSurname = 0;
-	} else if (slave.assignment === "work in the dairy" && V.dairyRestraintsSetting >= 2) {
+	} else if (slave.assignment === Job.DAIRY && V.dairyRestraintsSetting >= 2) {
 		slave.slaveName = `Bioreactor No. ${slave.ID}`;
 		slave.slaveSurname = 0;
 	} else {
@@ -1448,50 +1447,50 @@ globalThis.DegradingName = function(slave) {
 	}
 	if (leadershipPosition.includes(slave.assignment)) {
 		switch (slave.assignment) {
-			case "be the Attendant":
+			case Job.ATTENDANT:
 				slave.slaveName = jsEither(["Bath", "Spa"]);
 				break;
-			case "be the Matron":
+			case Job.MATRON:
 				slave.slaveName = jsEither(["Matron", "Nursery"]);
 				break;
-			case "be the Stewardess":
+			case Job.STEWARD:
 				slave.slaveName = jsEither(["Maid", "Servant"]);
 				break;
-			case "be the Milkmaid":
+			case Job.MILKMAID:
 				if (V.cumSlaves > 3) {
 					slave.slaveName = jsEither(["Fucker", "Milker"]);
 				} else {
 					slave.slaveName = jsEither(["Dairy", "Farm"]);
 				}
 				break;
-			case "be the Farmer":
+			case Job.FARMER:
 				slave.slaveName = jsEither(["Farmer", "Farmhand"]);
 				break;
-			case "be the DJ":
+			case Job.DJ:
 				slave.slaveName = jsEither(["Bass", "Booth"]);
 				break;
-			case "be your Concubine":
+			case Job.CONCUBINE:
 				slave.slaveName = jsEither(["Bed", "Master"]);
 				break;
-			case "be the Madam":
+			case Job.MADAM:
 				slave.slaveName = jsEither(["Madam", "Pimp"]);
 				break;
-			case "be the Schoolteacher":
+			case Job.TEACHER:
 				slave.slaveName = jsEither(["Classroom", "Teacher"]);
 				break;
-			case "be the Wardeness":
+			case Job.WARDEN:
 				slave.slaveName = jsEither(["Jail", "Prison"]);
 				break;
-			case "be the Nurse":
+			case Job.NURSE:
 				slave.slaveName = jsEither(["Clinic", "Nurse"]);
 				break;
-			case "be your Head Girl":
+			case Job.HEADGIRL:
 				slave.slaveName = jsEither(["Chief", "Head"]);
 				break;
-			case "guard you":
+			case Job.BODYGUARD:
 				slave.slaveName = jsEither(["Battle", "Guard"]);
 				break;
-			case "recruit girls":
+			case Job.RECRUITER:
 				slave.slaveName = jsEither(["Cam", "Recruiter"]);
 				break;
 		}
@@ -1559,8 +1558,8 @@ globalThis.SlaveSort = function() {
 
 	/** @param {number[]} [slaveIDs] */
 	function sortIDs(slaveIDs) {
-		const slaves = State.variables.slaves;
-		const slaveIndices = State.variables.slaveIndices;
+		const slaves = V.slaves;
+		const slaveIndices = V.slaveIndices;
 		const cmp = _comparator();
 		slaveIDs = slaveIDs || slaves.map(s => s.ID);
 		slaveIDs.sort((IDa, IDb) => cmp(slaveIndices[IDa], slaveIndices[IDb]));
@@ -1568,7 +1567,7 @@ globalThis.SlaveSort = function() {
 
 	/** @param {number[]} [slaveIdxs] */
 	function sortIndices(slaveIdxs) {
-		const slaves = State.variables.slaves;
+		const slaves = V.slaves;
 		const cmp = _comparator();
 		slaveIdxs = slaveIdxs || [...slaves.keys()];
 		slaveIdxs.sort((ia, ib) => cmp(slaves[ia], slaves[ib]));
diff --git a/src/js/assignJS.js b/src/js/assignJS.js
index 043d5d9654e58d0d305cc1cab735d442ead4d8ab..73511017d46162f64bf08ef1e8e1c036f34e8802 100644
--- a/src/js/assignJS.js
+++ b/src/js/assignJS.js
@@ -11,11 +11,14 @@ globalThis.assignJob = function(slave, job) {
 	let oldJob = slave.assignment;
 
 	// handle non-exclusive pseudo-assignments as special cases
-	if (job === "@Pit") {
+	if (job === Job.PIT) {
 		V.fighterIDs.push(slave.ID);
+		V.JobIDMap[this.Job.PIT].add(slave.ID);
 		return r;
-	} else if (job === "@Lurcher") {
+	} else if (job === Job.LURCHER) {
 		V.LurcherID = slave.ID;
+		V.JobIDMap[this.Job.LURCHER].clear();
+		V.JobIDMap[this.Job.LURCHER].add(slave.ID);
 		return r;
 	}
 
@@ -44,29 +47,29 @@ globalThis.assignJob = function(slave, job) {
 	}
 
 	/* Tracking for the following cases: */
-	if (oldJob !== job && V.assignmentRecords[slave.ID] !== job && oldJob !== "rest") { // Check that there is a real change happening. Sometimes when you send someone to a classroom or something, this fires twice.
+	if (oldJob !== job && V.assignmentRecords[slave.ID] !== job && oldJob !== Job.REST) { // Check that there is a real change happening. Sometimes when you send someone to a classroom or something, this fires twice.
 		switch (job.toLowerCase()) {
-			case "be confined in the cellblock":
+			case Job.CELLBLOCK:
 			case "cellblock":
-				if (oldJob !== "be confined in the cellblock") { // Due to the way assignJob fires twice on assigning to a building, we have to make sure that we are keeping the original record.
+				if (oldJob !== Job.CELLBLOCK) { // Due to the way assignJob fires twice on assigning to a building, we have to make sure that we are keeping the original record.
 					V.assignmentRecords[slave.ID] = oldJob;
 				}
 				break;
-			case "get treatment in the clinic":
+			case Job.CLINIC:
 			case "clinic":
-				if (oldJob !== "get treatment in the clinic") {
+				if (oldJob !== Job.CLINIC) {
 					V.assignmentRecords[slave.ID] = oldJob;
 				}
 				break;
-			case "learn in the schoolroom":
+			case Job.SCHOOL.toLowerCase():
 			case "schoolroom":
-				if (oldJob !== "learn in the schoolroom") {
+				if (oldJob !== Job.SCHOOL) {
 					V.assignmentRecords[slave.ID] = oldJob;
 				}
 				break;
-			case "rest in the spa":
+			case Job.SPA.toLowerCase():
 			case "spa":
-				if (oldJob !== "rest in the spa") {
+				if (oldJob !== Job.SPA) {
 					V.assignmentRecords[slave.ID] = oldJob;
 				}
 				break;
@@ -74,10 +77,9 @@ globalThis.assignJob = function(slave, job) {
 	}
 	/* use .toLowerCase() to get rid of a few dupe conditions. */
 	switch (job.toLowerCase()) {
-		case "be confined in the arcade":
+		case Job.ARCADE.toLowerCase():
 		case "arcade":
-			slave.assignment = "be confined in the arcade";
-			V.ArcadeiIDs.push(slave.ID);
+			slave.assignment = Job.ARCADE;
 			if (slave.clothes !== "a fuckdoll suit") {
 				slave.clothes = "no clothing";
 			}
@@ -86,10 +88,9 @@ globalThis.assignJob = function(slave, job) {
 			slave.rules.living = "spare";
 			break;
 
-		case "work in the brothel":
+		case Job.BROTHEL.toLowerCase():
 		case "brothel":
-			slave.assignment = "work in the brothel";
-			V.BrothiIDs.push(slave.ID);
+			slave.assignment = Job.BROTHEL;
 			switch (V.brothelDecoration) {
 				case "Degradationist":
 				case "standard":
@@ -101,10 +102,9 @@ globalThis.assignJob = function(slave, job) {
 			}
 			break;
 
-		case "be confined in the cellblock":
+		case Job.CELLBLOCK.toLowerCase():
 		case "cellblock":
-			slave.assignment = "be confined in the cellblock";
-			V.CellBiIDs.push(slave.ID);
+			slave.assignment = Job.CELLBLOCK;
 			switch (V.cellblockDecoration) {
 				case "Paternalist":
 					slave.rules.living = "normal";
@@ -115,10 +115,9 @@ globalThis.assignJob = function(slave, job) {
 			}
 			break;
 
-		case "get treatment in the clinic":
+		case Job.CLINIC.toLowerCase():
 		case "clinic":
-			slave.assignment = "get treatment in the clinic";
-			V.CliniciIDs.push(slave.ID);
+			slave.assignment = Job.CLINIC;
 			switch (V.clinicDecoration) {
 				case "Repopulation Focus":
 				case "Eugenics":
@@ -151,17 +150,15 @@ globalThis.assignJob = function(slave, job) {
 			}
 			break;
 
-		case "serve in the club":
+		case Job.CLUB.toLowerCase():
 		case "club":
-			slave.assignment = "serve in the club";
-			V.ClubiIDs.push(slave.ID);
+			slave.assignment = Job.CLUB;
 			slave.rules.living = "normal";
 			break;
 
-		case "work in the dairy":
+		case Job.DAIRY.toLowerCase():
 		case "dairy":
-			slave.assignment = "work in the dairy";
-			V.DairyiIDs.push(slave.ID);
+			slave.assignment = Job.DAIRY;
 			switch (V.dairyDecoration) {
 				case "Roman Revivalist":
 				case "Aztec Revivalist":
@@ -181,10 +178,9 @@ globalThis.assignJob = function(slave, job) {
 			}
 			break;
 
-		case "work as a farmhand":
+		case Job.FARMYARD.toLowerCase():
 		case "farmyard":
-			slave.assignment = "work as a farmhand";
-			V.FarmyardiIDs.push(slave.ID);
+			slave.assignment = Job.FARMYARD;
 			switch (V.farmyardDecoration) {
 				case "Aztec Revivalist":
 				case "Chinese Revivalist":
@@ -206,19 +202,17 @@ globalThis.assignJob = function(slave, job) {
 			}
 			break;
 
-		case "live with your head girl":
+		case Job.HEADGIRLSUITE.toLowerCase():
 		case "head girl suite":
 		case "hgsuite":
-			slave.assignment = "live with your Head Girl";
-			V.HGSuiteiIDs.push(slave.ID);
+			slave.assignment = Job.HEADGIRLSUITE;
 			slave.rules.living = "luxurious";
 			break;
 
-		case "serve in the master suite":
+		case Job.MASTERSUITE.toLowerCase():
 		case "master suite":
 		case "mastersuite":
-			slave.assignment = "serve in the master suite";
-			V.MastSiIDs.push(slave.ID);
+			slave.assignment = Job.MASTERSUITE;
 			if (V.masterSuiteUpgradeLuxury > 0) {
 				slave.rules.living = "luxurious";
 			} else {
@@ -226,18 +220,16 @@ globalThis.assignJob = function(slave, job) {
 			}
 			break;
 
-		case "learn in the schoolroom":
+		case Job.SCHOOL.toLowerCase():
 		case "schoolroom":
-			slave.assignment = "learn in the schoolroom";
-			V.SchlRiIDs.push(slave.ID);
+			slave.assignment = Job.SCHOOL;
 			slave.rules.living = "normal";
 			break;
 
-		case "work as a servant":
+		case Job.QUARTER.toLowerCase():
 		case "servants' quarters":
 		case "servantsquarters":
-			slave.assignment = "work as a servant";
-			V.ServQiIDs.push(slave.ID);
+			slave.assignment = Job.QUARTER;
 			switch (V.servantsQuartersDecoration) {
 				case "Roman Revivalist":
 				case "Aztec Revivalist":
@@ -272,10 +264,9 @@ globalThis.assignJob = function(slave, job) {
 			}
 			break;
 
-		case "rest in the spa":
+		case Job.SPA.toLowerCase():
 		case "spa":
-			slave.assignment = "rest in the spa";
-			V.SpaiIDs.push(slave.ID);
+			slave.assignment = Job.SPA;
 			switch (V.spaDecoration) {
 				case "Chattel Religionist":
 				case "Chinese Revivalist":
@@ -290,81 +281,80 @@ globalThis.assignJob = function(slave, job) {
 			}
 			break;
 
-		case "work as a nanny":
+		case Job.NURSERY.toLowerCase():
 		case "nursery":
-			slave.assignment = "work as a nanny";
-			V.NurseryiIDs.push(slave.ID);
+			slave.assignment = Job.NURSERY;
 			slave.rules.living = "normal";
 			break;
 
 		case Job.ATTENDANT.toLowerCase():
 			uniqueJob("Attendant");
-			slave.assignment = job;
+			slave.assignment = Job.ATTENDANT;
 			slave.rules.living = "luxurious";
 			break;
 
-		case "be the matron":
+		case Job.MATRON.toLowerCase():
 			uniqueJob("Matron");
-			slave.assignment = job;
+			slave.assignment = Job.MATRON;
 			slave.rules.living = "luxurious";
 			break;
 
-		case "be the dj":
+		case Job.DJ.toLowerCase():
 			uniqueJob("DJ");
-			slave.assignment = job;
+			slave.assignment = Job.DJ;
 			slave.rules.living = "luxurious";
 			break;
 
-		case "be the madam":
+		case Job.MADAM.toLowerCase():
 			uniqueJob("Madam");
-			slave.assignment = job;
+			slave.assignment = Job.MADAM;
 			slave.rules.living = "luxurious";
 			break;
 
-		case "be the milkmaid":
+		case Job.MILKMAID.toLowerCase():
 			uniqueJob("Milkmaid");
-			slave.assignment = job;
+			slave.assignment = Job.MILKMAID;
 			slave.rules.living = "luxurious";
 			break;
 
-		case "be the farmer":
+		case Job.FARMER.toLowerCase():
 			uniqueJob("Farmer");
-			slave.assignment = job;
+			slave.assignment = Job.FARMER;
 			slave.rules.living = "luxurious";
 			break;
 
-		case "be the nurse":
+		case Job.NURSE.toLowerCase():
 			uniqueJob("Nurse");
-			slave.assignment = job;
+			slave.assignment = Job.NURSE;
 			slave.rules.living = "luxurious";
 			break;
 
-		case "be the schoolteacher":
+		case Job.TEACHER.toLowerCase():
 			uniqueJob("Schoolteacher");
-			slave.assignment = job;
+			slave.assignment = Job.TEACHER;
 			slave.rules.living = "luxurious";
 			break;
 
-		case "be the stewardess":
+		case Job.STEWARD.toLowerCase():
 			uniqueJob("Stewardess");
-			slave.assignment = job;
+			slave.assignment = Job.STEWARD;
 			slave.rules.living = "luxurious";
 			break;
 
-		case "be the wardeness":
+		case Job.WARDEN.toLowerCase():
 			uniqueJob("Wardeness");
-			slave.assignment = job;
+			slave.assignment = Job.WARDEN;
 			slave.rules.living = "luxurious";
 			break;
 
-		case "recruit girls":
+		case Job.RECRUITER:
 			uniqueJob("Recruiter");
-			slave.assignment = job;
+			slave.assignment = Job.RECRUITER;
 			break;
 
-		case "be your concubine":
+		case Job.CONCUBINE.toLowerCase():
 			uniqueJob("Concubine");
-			slave.assignment = job;
+			slave.assignment = Job.CONCUBINE;
 			if (V.masterSuiteUpgradeLuxury > 0) {
 				slave.rules.living = "luxurious";
 			} else {
@@ -372,37 +362,37 @@ globalThis.assignJob = function(slave, job) {
 			}
 			break;
 
-		case "be your head girl":
+		case Job.HEADGIRL.toLowerCase():
 			uniqueJob("HeadGirl");
-			slave.assignment = job;
+			slave.assignment = Job.HEADGIRL;
 			if (V.HGSuite === 1) {
 				slave.rules.living = "luxurious";
 			}
 			V.HGTimeInGrade = 0;
 			break;
 
-		case "guard you":
+		case Job.BODYGUARD.toLowerCase():
 			uniqueJob("Bodyguard");
-			slave.assignment = job;
+			slave.assignment = Job.BODYGUARD;
 			if (V.dojo > 1) {
 				slave.rules.living = "luxurious";
 			}
 			if (V.pitBG === 1 && V.fighterIDs.includes(slave.ID)) { V.fighterIDs.delete(slave.ID); }
 			break;
 
-		case "be your agent":
-		case "live with your agent":
+		case Job.AGENT.toLowerCase():
+		case Job.AGENTPARTNER.toLowerCase():
 			slave.assignment = job;
 			slave.useRulesAssistant = 0; /* non-visible roles exempt from Rules Assistant */
 			WombCleanGenericReserve(slave, 'incubator', 9999);
 			WombCleanGenericReserve(slave, 'nursery', 9999);
-			if (job === "be your agent") {
+			if (job === Job.AGENT) {
 				App.activeArcology().leaderID = slave.ID;
 				App.activeArcology().government = "your agent";
 			}
 			break;
 
-		case "choose her own job":
+		case Job.CHOICE.toLowerCase():
 			slave.assignment = job;
 			slave.choosesOwnAssignment = 1;
 			break;
@@ -412,6 +402,8 @@ globalThis.assignJob = function(slave, job) {
 			break;
 	}
 
+	V.JobIDMap[slave.assignment].add(slave.ID);
+
 	if (!assignmentVisible(slave) && Array.isArray(V.personalAttention)) {
 		if (V.personalAttention.deleteWith(s => s.ID === slave.ID).length > 0) {
 			if (V.personalAttention.length === 0) {
@@ -428,7 +420,7 @@ globalThis.assignJob = function(slave, job) {
 			}
 		}
 	}
-	V.JobIDArray = resetJobIDArray();
+	// maybe recreate it each time? V.JobIDArray = makeJobIdMap();
 	if (idx >= 0) { V.slaves[idx] = slave; }
 
 	return r;
@@ -439,13 +431,13 @@ globalThis.assignJob = function(slave, job) {
  * @param {string} assignmentStr
  */
 globalThis.assignJobSafely = function(slave, assignmentStr) {
-	if (V.assignmentRecords[slave.ID] === "choose her own job") {
-		assignJob(slave, "rest");
+	if (V.assignmentRecords[slave.ID] === Job.CHOICE) {
+		assignJob(slave, Job.REST);
 		slave.choosesOwnAssignment = 1;
 	} else if (!App.Utils.jobForAssignment(assignmentStr).canEmploy(slave).length) {  // If nothing complains about job requirements not being met
 		assignJob(slave, assignmentStr);
 	} else {
-		assignJob(slave, "rest");
+		assignJob(slave, Job.REST);
 	}
 	// Whether they manage to go back or they default to rest, we don't need their record:
 	if (V.assignmentRecords[slave.ID]) {
@@ -463,7 +455,7 @@ globalThis.assignJobSafely = function(slave, assignmentStr) {
 globalThis.removeJob = function(slave, assignment, saveRecord = false) {
 	if (!slave) {
 		// it is well-formed, but does nothing, to remove an assignment from nobody.
-		// this lets us call <<run removeJob($HeadGirl, "be your Head Girl")>> and similar,
+		// this lets us call <<run removeJob($HeadGirl, Job.HEADGIRL)>> and similar,
 		// without first checking to see whether a slave is really assigned to $HeadGirl or not.
 		return '';
 	}
@@ -476,11 +468,19 @@ globalThis.removeJob = function(slave, assignment, saveRecord = false) {
 
 	const idx = V.slaveIndices[slave.ID];
 
-	if (assignment === "@Pit") {
+	if (assignment === Job.PIT) {
 		V.fighterIDs.delete(slave.ID);
-	} else if (assignment === "@Lurcher") {
+		V.JobIDMap[Job.PIT].delete(slave.ID);
+	} else if (assignment === Job.LURCHER) {
 		V.LurcherID = 0;
+		V.JobIDMap[Job.LURCHER].delete(slave.ID);
 	} else {
+		if (V.JobIDMap.hasOwnProperty(assignment)) {
+			V.JobIDMap[assignment].delete(slave.ID);
+		} else {
+			V.JobIDMap[slave.assignment].delete(slave.ID);
+		}
+
 		if (V.HeadGirl !== 0 && slave.ID === V.HeadGirl.ID) {
 			V.HeadGirl = 0;
 		} else if (V.Recruiter !== 0 && slave.ID === V.Recruiter.ID) {
@@ -516,110 +516,97 @@ globalThis.removeJob = function(slave, assignment, saveRecord = false) {
 
 		/* use .toLowerCase() to get rid of a few dupe conditions. */
 		switch (assignment.toLowerCase()) {
-			case "be confined in the arcade":
+			case Job.ARCADE.toLowerCase():
 			case "arcade":
-				slave.assignment = "work a glory hole";
-				V.ArcadeiIDs.delete(slave.ID);
+				slave.assignment = Job.GLORYHOLE;
 				break;
 
-			case "work in the brothel":
+			case Job.BROTHEL.toLowerCase():
 			case "brothel":
-				slave.assignment = "whore";
-				V.BrothiIDs.delete(slave.ID);
+				slave.assignment = Job.WHORE;
 				break;
 
-			case "be confined in the cellblock":
+			case Job.CELLBLOCK.toLowerCase():
 			case "cellblock":
-				slave.assignment = "rest";
+				slave.assignment = Job.REST;
 				if (slave.inflation > 0) {
 					slave.inflation = 0;
 					slave.inflationType = "none";
 					slave.inflationMethod = 0;
 					SetBellySize(slave);
 				}
-				V.CellBiIDs.delete(slave.ID);
 				break;
 
-			case "get treatment in the clinic":
+			case Job.CLINIC.toLowerCase():
 			case "clinic":
-				slave.assignment = "rest";
-				V.CliniciIDs.delete(slave.ID);
+				slave.assignment = Job.REST;
 				break;
 
-			case "serve in the club":
+			case Job.CLUB.toLowerCase():
 			case "club":
-				slave.assignment = "serve the public";
-				V.ClubiIDs.delete(slave.ID);
+				slave.assignment = Job.PUBLIC;
 				break;
 
-			case "work in the dairy":
+			case Job.DAIRY.toLowerCase():
 			case "dairy":
-				slave.assignment = "get milked";
-				V.DairyiIDs.delete(slave.ID);
+				slave.assignment = Job.MILKED;
 				break;
 
-			case "work as a farmhand":
+			case Job.FARMYARD.toLowerCase():
 			case "farmyard":
-				slave.assignment = "rest";
-				V.FarmyardiIDs.delete(slave.ID);
+				slave.assignment = Job.REST;
 				break;
 
-			case "learn in the schoolroom":
+			case Job.SCHOOL.toLowerCase():
 			case "schoolroom":
-				slave.assignment = "rest";
-				V.SchlRiIDs.delete(slave.ID);
+				slave.assignment = Job.REST;
 				break;
 
-			case "rest in the spa":
+			case Job.SPA.toLowerCase():
 			case "spa":
-				slave.assignment = "rest";
-				V.SpaiIDs.delete(slave.ID);
+				slave.assignment = Job.REST;
 				break;
 
-			case "work as a servant":
+			case Job.QUARTER.toLowerCase():
 			case "servants' quarters":
 			case "servantsquarters":
-				slave.assignment = "be a servant";
-				V.ServQiIDs.delete(slave.ID);
+				slave.assignment = Job.HOUSE;
 				break;
 
-			case "serve in the master suite":
+			case Job.MASTERSUITE.toLowerCase():
 			case "master suite":
 			case "mastersuite":
-				slave.assignment = "please you";
-				V.MastSiIDs.delete(slave.ID);
+				slave.assignment = Job.FUCKTOY;
 				break;
 
 			case "live with your head girl":
 			case "head girl suite":
 			case "hgsuite":
-				slave.assignment = "rest";
-				V.HGSuiteiIDs.delete(slave.ID);
+				slave.assignment = Job.REST;
 				break;
 
-			case "work as a nanny":
+			case Job.NURSERY:
 			case "nursery":
-				slave.assignment = "rest";
-				V.NurseryiIDs.delete(slave.ID);
+				slave.assignment = Job.REST;
 				break;
 
 			case "be your head girl":
 				let attentionCheck = 1;
-				slave.assignment = "rest";
-				const HGSlave = V.slaves.findIndex(s => s.assignment === "live with your Head Girl");
+				slave.assignment = Job.REST;
+				const HGSlave = V.slaves.findIndex(s => s.assignment === Job.HEADGIRLSUITE);
 				if (HGSlave !== -1) {
 					if (V.HGSuiteEquality === 1) {
 						if (V.slaves[HGSlave].devotion > 50) {
-							removeJob(V.slaves[HGSlave], "live with your Head Girl");
-							assignJob(V.slaves[HGSlave], "be your Head Girl");
+							removeJob(V.slaves[HGSlave], Job.HEADGIRLSUITE);
+							assignJob(V.slaves[HGSlave], Job.HEADGIRL);
 							V.HeadGirl = V.slaves[HGSlave];
 							V.slaves[HGSlave].diet = "healthy";
 							attentionCheck = 0;
 						} else {
-							removeJob(V.slaves[HGSlave], "live with your Head Girl");
+							removeJob(V.slaves[HGSlave], Job.HEADGIRLSUITE);
 						}
 					} else {
-						removeJob(V.slaves[HGSlave], "live with your Head Girl");
+						removeJob(V.slaves[HGSlave], Job.HEADGIRLSUITE);
 					}
 				}
 				if (V.personalAttention === "HG" && attentionCheck === 1) {
@@ -636,28 +623,30 @@ globalThis.removeJob = function(slave, assignment, saveRecord = false) {
 				V.HGTimeInGrade = 0;
 				break;
 
-			case "be your agent":
-			case "live with your agent":
-				if (slave.assignment === "be your agent") {
+			case Job.AGENT:
+			case Job.AGENTPARTNER:
+				if (slave.assignment === Job.AGENT) {
 					const arc = V.arcologies.find((a) => a.leaderID === slave.ID);
 					arc.leaderID = 0;
 					arc.government = "your trustees";
 				}
-				slave.assignment = "rest";
+				slave.assignment = Job.REST;
 				if (slave.relationshipTarget > 0) {
 					/* following code assumes there can be at most one companion */
-					const _lover = V.slaves.findIndex(s => haveRelationshipP(s, slave) && s.assignment === "live with your agent");
+					const _lover = V.slaves.findIndex(s => haveRelationshipP(s, slave) && s.assignment === Job.AGENTPARTNER);
 					if (_lover !== -1) {
-						V.slaves[_lover].assignment = "rest";
+						V.slaves[_lover].assignment = Job.REST;
 					}
 				}
 				break;
 
 			default:
-				slave.assignment = "rest";
+				slave.assignment = Job.REST;
 				break;
 		}
 
+		V.JobIDMap[slave.assignment].add(slave.ID);
+
 		if (slave.rules.living === "luxurious" && !assignmentVisible(slave)) {
 			slave.rules.living = "normal";
 		}
@@ -666,7 +655,7 @@ globalThis.removeJob = function(slave, assignment, saveRecord = false) {
 		slave.sentence = 0;
 		slave.subTarget = 0;
 	}
-	V.JobIDArray = resetJobIDArray();
+	// reset it each time? V.JobIDArray = makeJobIdMap();
 	if (idx >= 0) {
 		V.slaves[idx] = slave;
 	}
@@ -683,42 +672,42 @@ globalThis.removeJob = function(slave, assignment, saveRecord = false) {
 globalThis.assignmentVisible = function(slave) {
 	switch (slave.assignment) {
 		/* normal out-of-penthouse jobs */
-		case "be confined in the arcade":
-		case "work in the brothel":
-		case "be confined in the cellblock":
-		case "get treatment in the clinic":
-		case "serve in the club":
-		case "work in the dairy":
-		case "work as a farmhand":
-		case "live with your Head Girl":
-		case "serve in the master suite":
-		case "learn in the schoolroom":
-		case "work as a servant":
-		case "rest in the spa":
-		case "work as a nanny":
+		case Job.ARCADE :
+		case Job.BROTHEL:
+		case Job.CELLBLOCK:
+		case Job.CLINIC:
+		case Job.CLUB:
+		case Job.DAIRY:
+		case Job.FARMYARD:
+		case Job.HEADGIRLSUITE:
+		case Job.MASTERSUITE:
+		case Job.SCHOOL:
+		case Job.QUARTER:
+		case Job.SPA:
+		case Job.NURSERY:
 			return false;
 
 		/* outside leadership jobs */
-		case "be the Attendant":
-		case "be the Matron":
-		case "be the DJ":
-		case "be the Madam":
-		case "be the Milkmaid":
-		case "be the Farmer":
-		case "be the Nurse":
-		case "be the Schoolteacher":
-		case "be the Stewardess":
-		case "be the Wardeness":
-		case "be your Concubine":
+		case Job.ATTENDANT:
+		case Job.MATRON:
+		case Job.DJ:
+		case Job.MADAM:
+		case Job.MILKMAID:
+		case Job.FARMER:
+		case Job.NURSE:
+		case Job.TEACHER:
+		case Job.STEWARD:
+		case Job.WARDEN:
+		case Job.CONCUBINE:
 			return false;
 
 		/* agents are not in the arcology at all */
-		case "be your agent":
-		case "live with your agent":
+		case Job.AGENT:
+		case Job.AGENTPARTNER:
 			return false;
 
 		/* transition state */
-		case "choose her own job":
+		case Job.CHOICE:
 			return true; // show
 	}
 
@@ -726,31 +715,25 @@ globalThis.assignmentVisible = function(slave) {
 	return true;
 };
 
-globalThis.resetJobIDArray = function() {
-	/* todo: expand to all assignments */
-
-	/** @type {Array<App.Entity.SlaveState>} */
-	const slaves = State.variables.slaves;
-	const JobIDArray = {
-		"rest": [],
-		"please you": [],
-		"work a glory hole": [],
-		"take classes": [],
-		"be a servant": [],
-		"whore": [],
-		"serve the public": [],
-		"get milked": [],
-		"stay confined": [],
-		"be a subordinate slave": []
-	};
+/**
+ * @returns {Object.<string, Set<number>>} dictionary assignment -> slave IDs
+ */
+globalThis.makeJobIdMap = function() {
+	/** @type {Object.<string, Set<number>>} */
+	const res = {};
+	for (const jn of Object.values(Job)) {
+		res[jn] = new Set();
+	}
 
-	slaves.forEach(function(slave) {
-		if (JobIDArray.hasOwnProperty(slave.assignment)) {
-			JobIDArray[slave.assignment].push(slave.ID);
-		}
-	});
+	for (const slave of V.slaves) {
+		res[slave.assignment].add(slave.ID);
+	}
+
+	// special cases
+	res[Job.PIT] = new Set(V.fighterIDs);
+	res[Job.LURCHER].add(V.LurcherID);
 
-	return JobIDArray;
+	return res;
 };
 
 /**
@@ -795,7 +778,7 @@ App.UI.jobLinks = function() {
 		const sp = getPronouns(slave);
 
 		if (slave.fuckdoll === 0) {
-			const assignment = "choose her own job";
+			const assignment = Job.CHOICE;
 			if (slave.assignment !== assignment) {
 				const linkAction = callback !== undefined ? callback(assignment) : '';
 				penthouseJobs.push(`<<link "Let ${sp.object} choose" ${passage !== undefined ? `"${passage}"` : ''}>><<= assignJob(slaveStateById(${ID}), "${assignment}")>>${linkAction}<</link>>`);
@@ -818,7 +801,7 @@ App.UI.jobLinks = function() {
 		const slave = slaveStateById(ID);
 
 		for (const f of facilitiesOrder) {
-			if (!f.established) { continue; }
+			if (!f.established || f.jobs.length === 0) { continue; }
 			const rejects = f.canHostSlave(slave);
 			if (rejects.length === 0) {
 				transfers.push(f.transferLink(ID, undefined, passage()));
@@ -843,7 +826,7 @@ App.UI.jobLinks = function() {
 		const sp = getPronouns(slave);
 
 		if (slave.fuckdoll === 0) {
-			const assignment = "choose her own job";
+			const assignment = Job.CHOICE;
 			if (slave.assignment !== assignment) {
 				penthouseJobs.push(App.UI.DOM.assignmentLink(slave, assignment, passage, callback, `Let ${sp.object} choose`));
 			}
@@ -872,7 +855,7 @@ App.UI.jobLinks = function() {
 		const slave = slaveStateById(ID);
 
 		for (const f of facilitiesOrder) {
-			if (!f.established) { continue; }
+			if (!f.established || f.jobs.length === 0) { continue; }
 			const rejects = f.canHostSlave(slave);
 			if (rejects.length === 0) {
 				transfers.push(f.transferLinkElement(ID, undefined, passage(), callback));
@@ -906,7 +889,7 @@ App.currentAgent = function(arcology) {
  * @param {string} [managerAssignment="rest"] new assignment for the facility manager
  * @param {string} [workerAssignment="rest"] new assignment for the facility workers
  */
-App.Utils.moveFacilityWorkers = function(facility, managerAssignment = "rest", workerAssignment = "rest") {
+App.Utils.moveFacilityWorkers = function(facility, managerAssignment = Job.REST, workerAssignment = Job.REST) {
 	if (facility.manager && facility.manager.currentEmployee) {
 		assignJob(facility.manager.currentEmployee, managerAssignment);
 	}
diff --git a/src/js/customizeSlaveTrade.js b/src/js/customizeSlaveTrade.js
index 7b58acb33197dceb35acdfec42ab0d5b574fc530..ad9d5cfe0dda86f41119954fb7c5463fbde10d00 100644
--- a/src/js/customizeSlaveTrade.js
+++ b/src/js/customizeSlaveTrade.js
@@ -1,7 +1,7 @@
 App.CustomSlaveTrade = {
 	export: function() {
 		let textArea = document.createElement("textarea");
-		textArea.value = JSON.stringify(State.variables.nationalities);
+		textArea.value = JSON.stringify(V.nationalities);
 		$("#importExportArea").html(textArea);
 	},
 
@@ -11,7 +11,7 @@ App.CustomSlaveTrade = {
 		button.name = "Load";
 		button.innerHTML = "Load";
 		button.onclick = () => {
-			State.variables.nationalities = JSON.parse(textArea.value);
+			V.nationalities = JSON.parse(textArea.value);
 			State.display(State.passage);
 		};
 
diff --git a/src/js/descriptionWidgets.js b/src/js/descriptionWidgets.js
index d16edf5e01fe60817d3fe0225560d4856da1a986..40fee5bae588e51fa0c97ec12f1279af599e89ed 100644
--- a/src/js/descriptionWidgets.js
+++ b/src/js/descriptionWidgets.js
@@ -819,7 +819,7 @@ App.Desc.brand = function(slave, surface) {
 		he, him, his, hers, himself, boy, He, His
 	} = getPronouns(slave);
 	/* eslint-enable */
-	if (State.variables.showBodyMods === 1) {
+	if (V.showBodyMods === 1) {
 		if (surface === "extra") { // Make a sentence that describes all body parts that aren't explicitly described elsewhere in longSlave. If you brand a slave on her thumb, for instance. But why.
 			let extraMarks = App.Desc.extraMarks(slave, "brand");
 			extraMarks = Object.keys(extraMarks);
@@ -935,7 +935,7 @@ App.Desc.scar = function(slave, surface) {
 		he, him, his, hers, himself, boy, He, His
 	} = getPronouns(slave);
 	/* eslint-enable */
-	if (State.variables.showBodyMods === 1) {
+	if (V.showBodyMods === 1) {
 		if (surface === "extra") { // Make a sentence that describes all body parts that aren't explicitly described elsewhere in longSlave. If you scar a slave on her thumb, for instance. But why.
 			let extraMarks = App.Desc.extraMarks(slave, "scar");
 			extraMarks = Object.keys(extraMarks);
diff --git a/src/js/economyJS.js b/src/js/economyJS.js
index 00df24358114d8991c6ccc13b2ceb51b59f2455a..388048944d013aa03906e100e5bf699ca5b463c7 100644
--- a/src/js/economyJS.js
+++ b/src/js/economyJS.js
@@ -1,62 +1,3 @@
-globalThis.LivingRule = Object.freeze({LUXURIOUS: 'luxurious', NORMAL: 'normal', SPARE: 'spare'});
-globalThis.Job = Object.freeze({
-	// Penthouse Assignments
-	REST: 'rest',
-	FUCKTOY: 'please you',
-	CLASSES: 'take classes',
-	HOUSE: 'be a servant',
-	WHORE: 'whore',
-	PUBLIC: 'serve the public',
-	SUBORDINATE: 'be a subordinate slave',
-	MILKED: 'get milked',
-	GLORYHOLE: 'work a glory hole',
-	CONFINEMENT: 'stay confined',
-	// Leadership Assignments
-	BODYGUARD: 'guard you',
-	HEADGIRL: 'be your Head Girl',
-	RECRUITER: 'recruit girls',
-	AGENT: 'be your agent',
-	AGENTPARTNER: 'live with your agent',
-	// Facility Assignments
-	ARCADE: 'be confined in the arcade',
-	MADAM: 'be the Madam',
-	BROTHEL: 'work in the brothel',
-	WARDEN: 'be the Wardeness',
-	CELLBLOCK: 'be confined in the cellblock',
-	DJ: 'be the DJ',
-	CLUB: 'serve in the club',
-	NURSE: 'be the Nurse',
-	CLINIC: 'get treatment in the clinic',
-	MILKMAID: 'be the Milkmaid',
-	DAIRY: 'work in the dairy',
-	FARMER: 'be the Farmer',
-	FARMYARD: 'work as a farmhand',
-	HEADGIRLSUITE: 'live with your Head Girl',
-	CONCUBINE: 'be your Concubine',
-	MASTERSUITE: 'serve in the master suite',
-	MATRON: 'be the Matron',
-	NURSERY: 'work as a nanny',
-	TEACHER: 'be the Schoolteacher',
-	SCHOOL: 'learn in the schoolroom',
-	STEWARD: 'be the Stewardess',
-	QUARTER: 'work as a servant',
-	ATTENDANT: 'be the Attendant',
-	SPA: 'rest in the spa',
-	// Does this one exist?
-	BABY_FACTORY: 'labor in the production line',
-	// Other
-	CHOICE: "choose her own job",
-});
-globalThis.PersonalAttention = Object.freeze({
-	TRADE: 'trading',
-	WAR: 'warfare',
-	SLAVING: 'slaving',
-	ENGINEERING: 'engineering',
-	MEDICINE: 'medicine',
-	MAID: 'upkeep',
-	HACKING: 'hacking'
-});
-
 globalThis.CategoryAssociatedGroup = Object.freeze({
 	PENTHOUSE: [
 		'slaveAssignmentRest',
@@ -290,7 +231,7 @@ globalThis.calculateCosts = (function() {
 	}
 
 	function getCost() {
-		const oldCash = State.variables.cash;
+		const oldCash = V.cash;
 		cashX(forceNeg(getBrothelCosts()), "brothel");
 		cashX(forceNeg(getBrothelAdsCosts()), "brothelAds");
 		cashX(forceNeg(getArcadeCosts()), "arcade");
@@ -324,33 +265,33 @@ globalThis.calculateCosts = (function() {
 
 		// these two apply a multiplicative effect to all costs so far.
 		// Calculate what the deduced expenses would be, then subtract
-		let costSoFar = (oldCash - State.variables.cash); // How much we have spent by this point; expected to be positive.
+		let costSoFar = (oldCash - V.cash); // How much we have spent by this point; expected to be positive.
 		cashX(costSoFar - getEnvironmentCosts(costSoFar), "environment"); // getEnv takes total costs and makes it worse. Figure out how much worse and record it
 
-		costSoFar = (oldCash - State.variables.cash);
+		costSoFar = (oldCash - V.cash);
 		cashX(costSoFar - getPCMultiplierCosts(costSoFar), "PCskills");
 
 		// in the old order these were applied after multiplication. Not sure if deliberate, but I'm leaving it for now.
 		cashX(forceNeg(getSFCosts()), "specialForces");
 		cashX(forceNeg(getWeatherCosts()), "weather");
 
-		return (oldCash - State.variables.cash);
+		return (oldCash - V.cash);
 	}
 
 	// slave expenses
 	function predictTotalSlaveCosts() {
-		const V = State.variables;
 		let loopCosts = 0;
 		let number = 0;
 		for (const slave of V.slaves) {
 			loopCosts += getSlaveCost(slave);
 		}
 		const reducibleUpkeep = Math.trunc(loopCosts * 0.2);
-		V.ServQiIDs.forEach(ID => {
-			number += getSlaveMinorCosts(V.slaves[V.slaveIndices[ID]]);
+		App.Utils.jobForAssignment(Job.QUARTER).employees().forEach( s => {
+			number += getSlaveMinorCosts(s);
 		});
-		V.JobIDArray["be a servant"].forEach(ID => {
-			number += getSlaveMinorCosts(V.slaves[V.slaveIndices[ID]]);
+
+		App.Utils.jobForAssignment(Job.HOUSE).employees().forEach(s => {
+			number += getSlaveMinorCosts(s);
 		});
 		if (V.slaves.length > number) {
 			loopCosts -= Math.trunc(reducibleUpkeep / V.slaves.length * number);
@@ -361,18 +302,17 @@ globalThis.calculateCosts = (function() {
 	}
 
 	function getTotalSlaveCosts() {
-		const V = State.variables;
 		let slaveCost = 0;
 		let slaveCostMinor = 0;
 		let numberServed = 0;
 		let loopCosts = 0;
 
 		// Figure out how many slaves are effectively getting their upkeep reduced by 20%
-		V.ServQiIDs.forEach(ID => {
-			numberServed += getSlaveMinorCosts(V.slaves[V.slaveIndices[ID]]);
+		App.Utils.jobForAssignment(Job.QUARTER).employees().forEach(s => {
+			numberServed += getSlaveMinorCosts(s);
 		});
-		V.JobIDArray["be a servant"].forEach(ID => {
-			numberServed += getSlaveMinorCosts(V.slaves[V.slaveIndices[ID]]);
+		App.Utils.jobForAssignment(Job.HOUSE).employees().forEach(s => {
+			numberServed += getSlaveMinorCosts(s);
 		});
 
 		/* Implement a system that calculates and subtracts slave upkeep per assignment
@@ -523,22 +463,22 @@ globalThis.calculateCosts = (function() {
 
 		// Calculate the servant reduction and credit them for it
 		const reducibleUpkeep = Math.trunc(loopCosts * 0.2);
-		V.ServQiIDs.forEach(ID => {
+		App.Utils.jobForAssignment(Job.QUARTER).employees().forEach(s => {
 			if (V.slaves.length > numberServed) {
-				slaveCostMinor = Math.trunc(reducibleUpkeep / V.slaves.length * getSlaveMinorCosts(V.slaves[V.slaveIndices[ID]]));
-				cashX(Math.abs(slaveCostMinor), "slaveAssignmentQuarter", V.slaves[V.slaveIndices[ID]]);
+				slaveCostMinor = Math.trunc(reducibleUpkeep / V.slaves.length * getSlaveMinorCosts(s));
+				cashX(Math.abs(slaveCostMinor), "slaveAssignmentQuarter", s);
 			} else {
-				slaveCostMinor = Math.trunc(reducibleUpkeep / numberServed * getSlaveMinorCosts(V.slaves[V.slaveIndices[ID]]));
-				cashX(Math.abs(slaveCostMinor), "slaveAssignmentQuarter", V.slaves[V.slaveIndices[ID]]);
+				slaveCostMinor = Math.trunc(reducibleUpkeep / numberServed * getSlaveMinorCosts(s));
+				cashX(Math.abs(slaveCostMinor), "slaveAssignmentQuarter", s);
 			}
 		});
-		V.JobIDArray["be a servant"].forEach(ID => {
+		App.Utils.jobForAssignment(Job.HOUSE).employees().forEach(s => {
 			if (V.slaves.length > numberServed) {
-				slaveCostMinor = Math.trunc(reducibleUpkeep / V.slaves.length * getSlaveMinorCosts(V.slaves[V.slaveIndices[ID]]));
-				cashX(Math.abs(slaveCostMinor), "slaveAssignmentHouse", V.slaves[V.slaveIndices[ID]]);
+				slaveCostMinor = Math.trunc(reducibleUpkeep / V.slaves.length * getSlaveMinorCosts(s));
+				cashX(Math.abs(slaveCostMinor), "slaveAssignmentHouse", s);
 			} else {
-				slaveCostMinor = Math.trunc(reducibleUpkeep / numberServed * getSlaveMinorCosts(V.slaves[V.slaveIndices[ID]]));
-				cashX(Math.abs(slaveCostMinor), "slaveAssignmentHouse", V.slaves[V.slaveIndices[ID]]);
+				slaveCostMinor = Math.trunc(reducibleUpkeep / numberServed * getSlaveMinorCosts(s));
+				cashX(Math.abs(slaveCostMinor), "slaveAssignmentHouse", s);
 			}
 		});
 	// nothing to return, cashX already billed.
@@ -550,7 +490,7 @@ globalThis.calculateCosts = (function() {
 	}
 
 	function getBrothelAdsCosts() {
-		return (State.variables.brothel > 0) ? State.variables.brothelAdsSpending : 0;
+		return (V.brothel > 0) ? V.brothelAdsSpending : 0;
 	}
 
 	function getArcadeCosts() {
@@ -563,7 +503,7 @@ globalThis.calculateCosts = (function() {
 	}
 
 	function getClubAdsCosts() {
-		return (State.variables.club > 0) ? State.variables.clubAdsSpending : 0;
+		return (V.club > 0) ? V.clubAdsSpending : 0;
 	}
 
 	function getDairyCosts() {
@@ -601,17 +541,17 @@ globalThis.calculateCosts = (function() {
 
 	function getMasterSuiteCosts() {
 		let costs = 0;
-		if (State.variables.masterSuitePregnancySlaveLuxuries === 1) {
+		if (V.masterSuitePregnancySlaveLuxuries === 1) {
 			costs += 500;
 		}
-		if (State.variables.masterSuitePregnancyFertilitySupplements === 1) {
+		if (V.masterSuitePregnancyFertilitySupplements === 1) {
 			costs += 1000;
 		}
 		return costs;
 	}
 
 	function getNurseryCosts() {
-		return (State.variables.nursery * State.variables.facilityCost);
+		return (V.nursery * V.facilityCost);
 	}
 
 	function getFarmyardCosts() {
@@ -677,28 +617,28 @@ globalThis.calculateCosts = (function() {
 		} else if (V.PC.rules.living === "normal") {
 			ownerExpense = 2;
 		}
-		return (ownerExpense * (250 + (50000 / State.variables.localEcon)));
+		return (ownerExpense * (250 + (50000 / V.localEcon)));
 	}
 
 	function getFSCosts() {
-		let costs = State.variables.FSSpending;
-		if (State.variables.arcologies[0].FSRepopulationFocusLaw === 1 && State.variables.PC.pregKnown === 1) {
+		let costs = V.FSSpending;
+		if (V.arcologies[0].FSRepopulationFocusLaw === 1 && V.PC.pregKnown === 1) {
 			costs -= 500;
 		}
 		return costs;
 	}
 
 	function getCitizenOrphanageCosts() {
-		return State.variables.citizenOrphanageTotal * 100;
+		return V.citizenOrphanageTotal * 100;
 	}
 
 	function getPrivateOrphanageCosts() {
-		const costs = State.variables.privateOrphanageTotal * 500;
-		return (State.variables.breederOrphanageTotal > 0) ? costs + 50 : costs;
+		const costs = V.privateOrphanageTotal * 500;
+		return (V.breederOrphanageTotal > 0) ? costs + 50 : costs;
 	}
 
 	function getPeacekeeperCosts() {
-		return (State.variables.peacekeepers !== 0 && State.variables.peacekeepers.undermining !== 0) ? State.variables.peacekeepers.undermining : 0;
+		return (V.peacekeepers !== 0 && V.peacekeepers.undermining !== 0) ? V.peacekeepers.undermining : 0;
 	}
 
 	function getMercenariesCosts() {
@@ -717,68 +657,68 @@ globalThis.calculateCosts = (function() {
 	}
 
 	function getMenialRetirementCosts() {
-		return (V.policies.retirement.menial2Citizen === 1) ? State.variables.menials * 2 : 0;
+		return (V.policies.retirement.menial2Citizen === 1) ? V.menials * 2 : 0;
 	}
 
 	// policy and other expenses
 	function getRecruiterCosts() {
-		return (State.variables.Recruiter !== 0) ? 250 : 0;
+		return (V.Recruiter !== 0) ? 250 : 0;
 	}
 
 	function getSchoolCosts() {
 		let costs = 0;
-		if (State.variables.TSS.schoolPresent === 1) {
+		if (V.TSS.schoolPresent === 1) {
 			costs += 1000;
 		}
-		if (State.variables.GRI.schoolPresent === 1) {
+		if (V.GRI.schoolPresent === 1) {
 			costs += 1000;
 		}
-		if (State.variables.SCP.schoolPresent === 1) {
+		if (V.SCP.schoolPresent === 1) {
 			costs += 1000;
 		}
-		if (State.variables.LDE.schoolPresent === 1) {
+		if (V.LDE.schoolPresent === 1) {
 			costs += 1000;
 		}
-		if (State.variables.TGA.schoolPresent === 1) {
+		if (V.TGA.schoolPresent === 1) {
 			costs += 1000;
 		}
-		if (State.variables.HA.schoolPresent === 1) {
+		if (V.HA.schoolPresent === 1) {
 			costs += 1000;
 		}
-		if (State.variables.TCR.schoolPresent === 1) {
+		if (V.TCR.schoolPresent === 1) {
 			costs += 1000;
 		}
-		if (State.variables.NUL.schoolPresent === 1) {
+		if (V.NUL.schoolPresent === 1) {
 			costs += 1000;
 		}
-		if ((State.variables.TFS.schoolPresent === 1) && ((State.variables.PC.dick === 0) || (State.variables.PC.vagina === -1) || (State.variables.PC.boobs < 300))) {
+		if ((V.TFS.schoolPresent === 1) && ((V.PC.dick === 0) || (V.PC.vagina === -1) || (V.PC.boobs < 300))) {
 			costs += 1000;
 		}
-		if (State.variables.TSS.subsidize !== 0) {
+		if (V.TSS.subsidize !== 0) {
 			costs += 1000;
 		}
-		if (State.variables.GRI.subsidize !== 0) {
+		if (V.GRI.subsidize !== 0) {
 			costs += 1000;
 		}
-		if (State.variables.SCP.subsidize !== 0) {
+		if (V.SCP.subsidize !== 0) {
 			costs += 1000;
 		}
-		if (State.variables.LDE.subsidize !== 0) {
+		if (V.LDE.subsidize !== 0) {
 			costs += 1000;
 		}
-		if (State.variables.TGA.subsidize !== 0) {
+		if (V.TGA.subsidize !== 0) {
 			costs += 1000;
 		}
-		if (State.variables.HA.subsidize !== 0) {
+		if (V.HA.subsidize !== 0) {
 			costs += 1000;
 		}
-		if (State.variables.TCR.subsidize !== 0) {
+		if (V.TCR.subsidize !== 0) {
 			costs += 1000;
 		}
-		if (State.variables.NUL.subsidize !== 0) {
+		if (V.NUL.subsidize !== 0) {
 			costs += 1000;
 		}
-		if (State.variables.TFS.subsidize !== 0) {
+		if (V.TFS.subsidize !== 0) {
 			costs += 1000;
 		}
 		return costs;
@@ -805,15 +745,15 @@ globalThis.calculateCosts = (function() {
 	}
 
 	function getLabCosts() {
-		return (100 * State.variables.researchLab.maxSpace);
+		return (100 * V.researchLab.maxSpace);
 	}
 
 	function getLabScientistsCosts() {
-		return (300 * State.variables.researchLab.hired);
+		return (300 * V.researchLab.hired);
 	}
 
 	function getLabMenialsCosts() {
-		return (100 * State.variables.researchLab.hired);
+		return (100 * V.researchLab.hired);
 	}
 
 	// player expenses
@@ -831,14 +771,14 @@ globalThis.calculateCosts = (function() {
 
 	function getPCCosts() {
 		let costs = 0;
-		if (State.variables.PC.preg === -1) {
+		if (V.PC.preg === -1) {
 			costs += 25;
-		} else if (State.variables.PC.fertDrugs === 1) {
+		} else if (V.PC.fertDrugs === 1) {
 			costs += 50;
-		} else if (State.variables.PC.preg >= 16) {
+		} else if (V.PC.preg >= 16) {
 			costs += 100;
 		}
-		if (State.variables.PC.staminaPills === 1) {
+		if (V.PC.staminaPills === 1) {
 			costs += 50;
 		}
 		return costs;
@@ -846,9 +786,9 @@ globalThis.calculateCosts = (function() {
 
 
 	function getPCMultiplierCosts(cost) {
-		if (State.variables.PC.career === 'servant') {
-			if (State.variables.personalAttention === PersonalAttention.MAID) {
-				if (State.variables.PC.belly >= 5000) {
+		if (V.PC.career === 'servant') {
+			if (V.personalAttention === PersonalAttention.MAID) {
+				if (V.PC.belly >= 5000) {
 					cost *= 0.80;
 				} else {
 					cost *= 0.75;
@@ -861,13 +801,13 @@ globalThis.calculateCosts = (function() {
 	}
 
 	function getEnvironmentCosts(cost = 0) {
-		if (State.variables.secExpEnabled > 0) {
-			if (State.variables.terrain === 'oceanic' || State.variables.terrain === 'marine') {
-				if (State.variables.docks > 0) {
-					cost *= (1 - State.variables.docks * 0.05);
+		if (V.secExpEnabled > 0) {
+			if (V.terrain === 'oceanic' || V.terrain === 'marine') {
+				if (V.docks > 0) {
+					cost *= (1 - V.docks * 0.05);
 				}
-			} else if (State.variables.railway > 0) {
-				cost *= (1 - State.variables.railway * 0.05);
+			} else if (V.railway > 0) {
+				cost *= (1 - V.railway * 0.05);
 			}
 		}
 		return Math.trunc(cost);
@@ -882,11 +822,11 @@ globalThis.calculateCosts = (function() {
 
 	function getWeatherCosts() {
 		let costs = 0;
-		if (State.variables.econWeatherDamage && State.variables.disasterResponse > 0) {
-			costs += Math.trunc(State.variables.disasterResponse * 200000 / State.variables.localEcon);
+		if (V.econWeatherDamage && V.disasterResponse > 0) {
+			costs += Math.trunc(V.disasterResponse * 200000 / V.localEcon);
 		}
-		if (State.variables.antiWeatherFreeze > 0) {
-			costs += Math.trunc(State.variables.antiWeatherFreeze * 200000 / State.variables.localEcon);
+		if (V.antiWeatherFreeze > 0) {
+			costs += Math.trunc(V.antiWeatherFreeze * 200000 / V.localEcon);
 		}
 		return costs;
 	}
@@ -927,7 +867,7 @@ globalThis.calculateCosts = (function() {
 		if (slave.assignment === Job.QUARTER) {
 			effectiveness *= 1.1;
 		}
-		if (setup.servantCareers.includes(slave.career) || slave.skill.servant >= State.variables.masteredXP) {
+		if (setup.servantCareers.includes(slave.career) || slave.skill.servant >= V.masteredXP) {
 			effectiveness *= 1.1;
 		}
 		effectiveness = Math.trunc(effectiveness * restEffects(slave) / 10);
@@ -947,9 +887,9 @@ globalThis.getSlaveCostArray = function(s) {
 	let cost = 0;
 	let retval = [];
 	let t = "";
-	const rulesCost = State.variables.rulesCost;
-	const foodCost = State.variables.foodCost;
-	const drugsCost = State.variables.drugsCost;
+	const rulesCost = V.rulesCost;
+	const foodCost = V.foodCost;
+	const drugsCost = V.drugsCost;
 
 	// Living expenses
 	switch (s.assignment) {
@@ -957,11 +897,11 @@ globalThis.getSlaveCostArray = function(s) {
 			cost += rulesCost * 0.75;
 			break;
 		case Job.DAIRY:
-			if (State.variables.dairyRestraintsSetting >= 2) {
+			if (V.dairyRestraintsSetting >= 2) {
 				cost += rulesCost * 0.75;
 			} else if (s.rules.living === LivingRule.NORMAL) {
 				cost += rulesCost * 1.5;
-			} else if (State.variables.dairyDecoration === 'Degradationist') {
+			} else if (V.dairyDecoration === 'Degradationist') {
 				cost += rulesCost * 0.90;
 			} else {
 				cost += rulesCost;
@@ -970,7 +910,7 @@ globalThis.getSlaveCostArray = function(s) {
 		case Job.FARMYARD:
 			if (s.rules.living === LivingRule.NORMAL) {
 				cost += rulesCost * 1.5;
-			} else if (State.variables.farmyardDecoration === 'Roman Revivalist') {
+			} else if (V.farmyardDecoration === 'Roman Revivalist') {
 				cost += rulesCost * 1.5;
 			} else {
 				cost += rulesCost;
@@ -1006,7 +946,7 @@ globalThis.getSlaveCostArray = function(s) {
 			if (s.rules.living === LivingRule.NORMAL) {
 				cost += rulesCost * 1.5;
 			} else {
-				cost += (State.variables.servantsQuartersDecoration === 'Degradationist') ? rulesCost * 0.90 : rulesCost;
+				cost += (V.servantsQuartersDecoration === 'Degradationist') ? rulesCost * 0.90 : rulesCost;
 			}
 			break;
 		case Job.CELLBLOCK:
@@ -1121,12 +1061,12 @@ globalThis.getSlaveCostArray = function(s) {
 		retval.push({text: t, value: foodCost * s.lactation * (1 + Math.trunc(s.boobs / 10000))});
 	}
 	if (s.preg > s.pregData.normalBirth / 8) {
-		if (s.assignment === Job.DAIRY && State.variables.dairyFeedersSetting > 0) {
+		if (s.assignment === Job.DAIRY && V.dairyFeedersSetting > 0) {
 			// Extra feeding costs to support pregnancy are covered by dairy feeders.
 			// TODO: Include them here anyway?
 			retval.push({text: "Extra feeding costs to support pregnancy are covered by dairy feeders", value: 0});
 		} else if ((s.assignment === Job.MASTERSUITE || s.assignment === Job.CONCUBINE) &&
-			State.variables.masterSuiteUpgradePregnancy === 1) {
+			V.masterSuiteUpgradePregnancy === 1) {
 			// Extra feeding costs to support pregnancy are covered by master suite luxuries.
 			// TODO: Include them here anyway?
 			retval.push({text: "Extra feeding costs to support pregnancy are covered by $masterSuiteName luxuries", value: 0});
@@ -1175,24 +1115,24 @@ globalThis.getSlaveCostArray = function(s) {
 	}
 
 	// Accessibility costs
-	if (State.variables.boobAccessibility !== 1 && s.boobs > 20000 &&
-		(s.assignment !== Job.DAIRY || State.variables.dairyRestraintsSetting < 2) && (s.assignment !== Job.ARCADE)) {
+	if (V.boobAccessibility !== 1 && s.boobs > 20000 &&
+		(s.assignment !== Job.DAIRY || V.dairyRestraintsSetting < 2) && (s.assignment !== Job.ARCADE)) {
 		retval.push({text: "Increased living expenses due to inconveniently huge boobs", value: 50});
 	}
-	if (State.variables.pregAccessibility !== 1 &&
-		(s.belly >= 60000) && s.assignment !== Job.BABY_FACTORY && (s.assignment !== Job.DAIRY || State.variables.dairyRestraintsSetting < 2) && (s.assignment !== Job.ARCADE)) {
+	if (V.pregAccessibility !== 1 &&
+		(s.belly >= 60000) && s.assignment !== Job.BABY_FACTORY && (s.assignment !== Job.DAIRY || V.dairyRestraintsSetting < 2) && (s.assignment !== Job.ARCADE)) {
 		retval.push({text: "Increased living expenses due to an inconveniently huge belly", value: 100});
 	}
-	if (State.variables.dickAccessibility !== 1 && s.dick > 45 && (s.assignment !== Job.DAIRY || State.variables.dairyRestraintsSetting < 2) && (s.assignment !== Job.ARCADE)) {
+	if (V.dickAccessibility !== 1 && s.dick > 45 && (s.assignment !== Job.DAIRY || V.dairyRestraintsSetting < 2) && (s.assignment !== Job.ARCADE)) {
 		retval.push({text: "Increased living expenses due to an inconveniently huge penis", value: 50});
 	}
-	if (State.variables.ballsAccessibility !== 1 && s.balls > 90 && (s.assignment !== Job.DAIRY || State.variables.dairyRestraintsSetting < 2) && (s.assignment !== Job.ARCADE)) {
+	if (V.ballsAccessibility !== 1 && s.balls > 90 && (s.assignment !== Job.DAIRY || V.dairyRestraintsSetting < 2) && (s.assignment !== Job.ARCADE)) {
 		retval.push({text: "Increased living expenses due to inconveniently huge balls", value: 50});
 	}
-	if (State.variables.buttAccessibility !== 1 && s.butt > 15 && (s.assignment !== Job.DAIRY || State.variables.dairyRestraintsSetting < 2) && (s.assignment !== Job.ARCADE)) {
+	if (V.buttAccessibility !== 1 && s.butt > 15 && (s.assignment !== Job.DAIRY || V.dairyRestraintsSetting < 2) && (s.assignment !== Job.ARCADE)) {
 		retval.push({text: "Increased living expenses due to an inconveniently huge butt", value: 50});
 	}
-	if (!canSee(s) && (s.assignment !== Job.DAIRY || State.variables.dairyRestraintsSetting < 2) && (s.assignment !== Job.ARCADE)) {
+	if (!canSee(s) && (s.assignment !== Job.DAIRY || V.dairyRestraintsSetting < 2) && (s.assignment !== Job.ARCADE)) {
 		retval.push({text: "Increased living expenses due to lack of sight", value: 50});
 	} else if (!canSeePerfectly(s)) {
 		if (getBestVision(s) < 2) {
@@ -1201,14 +1141,14 @@ globalThis.getSlaveCostArray = function(s) {
 			retval.push({text: "Increased living expenses due to blurred vision", value: 25});
 		}
 	}
-	if (!canHear(s) && (s.assignment !== Job.DAIRY || State.variables.dairyRestraintsSetting < 2) && (s.assignment !== Job.ARCADE)) {
+	if (!canHear(s) && (s.assignment !== Job.DAIRY || V.dairyRestraintsSetting < 2) && (s.assignment !== Job.ARCADE)) {
 		retval.push({text: "Increased living expenses due to lack of hearing", value: 40});
 	} else if (s.hears <= -1 && s.earwear !== 'hearing aids') {
 		retval.push({text: "Increased living expenses due to poor hearing", value: 15});
 	} else if (s.earwear === 'muffling ear plugs') {
 		retval.push({text: "Increased living expenses due to muffled hearing", value: 15});
 	}
-	if ((s.assignment !== Job.DAIRY || State.variables.dairyRestraintsSetting < 2) && (s.assignment !== Job.ARCADE)) {
+	if ((s.assignment !== Job.DAIRY || V.dairyRestraintsSetting < 2) && (s.assignment !== Job.ARCADE)) {
 		if (!canWalk) {
 			retval.push({text: "Increased living expenses due to immobility", value: rulesCost});
 		} else {
@@ -1234,8 +1174,8 @@ globalThis.getSlaveCostArray = function(s) {
 	if (s.buttImplant > 5 && s.buttImplantType === "string") {
 		retval.push({text: "Maintenance cost for oversized string implants", value: 50});
 	}
-	if ((s.assignment !== Job.DAIRY || State.variables.dairyRestraintsSetting < 2) && (s.assignment !== Job.ARCADE)) {
-		if (s.preg > s.pregData.minLiveBirth && State.variables.universalRulesBirthing === 1) {
+	if ((s.assignment !== Job.DAIRY || V.dairyRestraintsSetting < 2) && (s.assignment !== Job.ARCADE)) {
+		if (s.preg > s.pregData.minLiveBirth && V.universalRulesBirthing === 1) {
 			retval.push({text: "Coverage cost for daily pregnancy scanning", value: 50});
 		}
 	}
@@ -1347,7 +1287,7 @@ globalThis.getSlaveCostArray = function(s) {
 		retval.push({text: "Contraceptives", value: Math.trunc((drugsCost * 0.5))});
 	}
 
-	if ((Job.CONCUBINE === s.assignment || s.relationship === -3) && State.variables.arcologies[0].FSPetiteAdmirationLaw === 1) {
+	if ((Job.CONCUBINE === s.assignment || s.relationship === -3) && V.arcologies[0].FSPetiteAdmirationLaw === 1) {
 		retval.push({text: "Big & Small Subsidy", value: -200});
 	}
 
@@ -1369,10 +1309,10 @@ globalThis.getSlaveCost = function(s) {
  * @returns {number}
  */
 globalThis.menialSlaveCost = function(q = 0) {
-	const demand = State.variables.menialDemandFactor;
-	const supply = State.variables.menialSupplyFactor;
+	const demand = V.menialDemandFactor;
+	const supply = V.menialSupplyFactor;
 	const baseCost = 1000;
-	const random = State.variables.slaveCostRandom;
+	const random = V.slaveCostRandom;
 	return (Math.trunc(baseCost + demand / 400 - supply / 400 + q / 400) + random);
 };
 
@@ -1470,9 +1410,9 @@ globalThis.slaveJobValues = function(lowerClassSexDemandRef, middleClassSexDeman
 	let brothelSpots;
 	let toTheClubTotal = 0;
 	let toTheBrothelTotal = 0;
-	const AL = V.ArcadeiIDs.length;
-	const CL = V.ClubiIDs.length;
-	const BL = V.BrothiIDs.length;
+	const AL = App.Entity.facilities.arcade.employeesIDs().size;
+	const CL = App.Entity.facilities.club.employeesIDs().size;
+	const BL = App.Entity.facilities.brothel.employeesIDs().size;
 	V.clubSlavesGettingHelp = 0;
 	V.brothelSlavesGettingHelp = 0;
 
@@ -1484,7 +1424,7 @@ globalThis.slaveJobValues = function(lowerClassSexDemandRef, middleClassSexDeman
 
 	// Accounting for the DJ.
 	V.DJ = V.slaves.find(s => {
-		return s.assignment === "be the DJ";
+		return s.assignment === Job.DJ;
 	});
 	if (V.DJ !== 0) {
 		if (!canTalk(V.DJ)) {
@@ -1558,7 +1498,7 @@ globalThis.slaveJobValues = function(lowerClassSexDemandRef, middleClassSexDeman
 
 	// Accounting for the Madam
 	V.Madam = V.slaves.find(s => {
-		return s.assignment === "be the Madam";
+		return s.assignment === Job.MADAM;
 	});
 	if (V.Madam !== 0) {
 		if (!canTalk(V.Madam)) {
@@ -1627,37 +1567,36 @@ globalThis.slaveJobValues = function(lowerClassSexDemandRef, middleClassSexDeman
 			// $His turgid dick helps $him manage the bitches.
 			V.MadamCashBonus += 0.05;
 		}
-		for (let dI = 0; dI < BL; dI++) {
-			let i = V.slaveIndices[V.BrothiIDs[dI]];
-			if (V.Madam.relationshipTarget === V.slaves[i].ID) {
+		for (const slave of App.Entity.facilities.brothel.employees()) {
+			if (V.Madam.relationshipTarget === slave.ID) {
 				V.MadamCashBonus -= 0.05;
-			} else if (areRelated(V.Madam, V.slaves[i])) {
+			} else if (areRelated(V.Madam, slave)) {
 				V.MadamCashBonus += 0.05;
 			}
-			if (V.slaves[i].prestigeDesc === "$He is a famed Free Cities whore, and commands top prices.") {
+			if (slave.prestigeDesc === "$He is a famed Free Cities whore, and commands top prices.") {
 				V.MadamCashBonus += 0.15;
-			} else if (V.slaves[i].prestigeDesc === "$He is a famed Free Cities slut, and can please anyone.") {
+			} else if (slave.prestigeDesc === "$He is a famed Free Cities slut, and can please anyone.") {
 				V.MadamCashBonus += 0.15;
-			} else if (V.slaves[i].prestigeDesc === "$He is remembered for winning best in show as a dairy cow.") {
+			} else if (slave.prestigeDesc === "$He is remembered for winning best in show as a dairy cow.") {
 				if (V.arcologies[0].FSPhysicalIdealist !== "unset") {
-					if (V.slaves[i].muscles > 60 && V.slaves[i].weight < 30 && V.slaves[i].lactation > 0 && V.slaves[i].boobs - V.slaves[i].boobsImplant > 6000) {
+					if (slave.muscles > 60 && slave.weight < 30 && slave.lactation > 0 && slave.boobs - slave.boobsImplant > 6000) {
 						V.MadamCashBonus += 0.15;
 					}
-				} else if (V.slaves[i].lactation > 0 && V.slaves[i].boobs - V.slaves[i].boobsImplant > 6000) {
+				} else if (V.slaves[i].lactation > 0 && slave.boobs - slave.boobsImplant > 6000) {
 					V.MadamCashBonus += 0.10;
 				}
-			} else if (V.slaves[i].prestigeDesc === "$He is remembered for winning best in show as a cockmilker.") {
+			} else if (slave.prestigeDesc === "$He is remembered for winning best in show as a cockmilker.") {
 				if (V.arcologies[0].FSGenderFundamentalist !== "unset") {
-					if (V.slaves[i].balls === 0 && V.slaves[i].dick === 0 && V.slaves[i].vagina > -1) { /* this needs review - doesn't fit right. An XY slave would be expected to be masculine. */
+					if (slave.balls === 0 && slave.dick === 0 && slave.vagina > -1) { /* this needs review - doesn't fit right. An XY slave would be expected to be masculine. */
 						V.MadamCashBonus += 0.20;
 					}
-				} else if ((V.slaves[i].balls > 5 && V.slaves[i].dick !== 0) || (V.slaves[i].balls > 4 && V.slaves[i].dick !== 0 && V.slaves[i].prostate > 1)) {
+				} else if ((slave.balls > 5 && slave.dick !== 0) || (slave.balls > 4 && slave.dick !== 0 && slave.prostate > 1)) {
 					V.MadamCashBonus += 0.15;
 				}
-			} else if (V.slaves[i].prestigeDesc === "$He is remembered for winning best in show as a breeder.") {
-				if (canGetPregnant(V.slaves[i])) {
+			} else if (slave.prestigeDesc === "$He is remembered for winning best in show as a breeder.") {
+				if (canGetPregnant(slave)) {
 					V.MadamCashBonus += 0.15;
-				} else if (isPreg(V.slaves[i]) && V.slaves[i].bellyPreg >= 5000) {
+				} else if (isPreg(slave) && slave.bellyPreg >= 5000) {
 					V.madamCashBonus += 0.1;
 				}
 			}
@@ -1674,28 +1613,26 @@ globalThis.slaveJobValues = function(lowerClassSexDemandRef, middleClassSexDeman
 	}
 
 	// Glory hole slaves adding to 'arcade'
-	V.JobIDArray["work a glory hole"].forEach(ID => {
-		const s = V.slaves[V.slaveIndices[ID]];
+	App.Utils.jobForAssignment(Job.GLORYHOLE).employees().forEach(s => {
 		s.sexAmount = Math.trunc(restEffects(s, 20) * ((normalRandInt(600, 20) + (4 - s.anus) * 10 + (4 - s.vagina) * 10 + Math.trunc(s.health.condition / 2)) * 0.75));
 		tiredFucks(s);
 		slaveJobValues.arcade += s.sexAmount;
 	});
 
 	// Arcade slaves adding to 'arcade'
-	V.ArcadeiIDs.forEach(ID => {
-		const s = V.slaves[V.slaveIndices[ID]];
+	App.Utils.jobForAssignment(Job.ARCADE).employees().forEach(s => {
 		s.sexAmount = (normalRandInt(600, 20) + (4 - (s.anus - 2 * V.arcadeUpgradeInjectors)) * 10 + (4 - (s.vagina - 2 * V.arcadeUpgradeInjectors)) * 10 + Math.trunc(s.health.condition / 2));
 		slaveJobValues.arcade += s.sexAmount;
 	});
 
 	// Public sluts adding to 'club'
-	V.JobIDArray["serve the public"].forEach(ID => {
-		SJVClub(V.slaves[V.slaveIndices[ID]]);
+	App.Utils.jobForAssignment(Job.PUBLIC).employees().forEach(s => {
+		SJVClub(s);
 	});
 
 	// Club sluts adding to 'club'
-	V.ClubiIDs.forEach(ID => {
-		SJVClub(V.slaves[V.slaveIndices[ID]]);
+	App.Utils.jobForAssignment(Job.CLUB).employees().forEach(s => {
+		SJVClub(s);
 	});
 
 	// Saturation penalty for public servants. Even the most beautiful slaves lose some of their shine if they have too much competition.
@@ -1704,13 +1641,13 @@ globalThis.slaveJobValues = function(lowerClassSexDemandRef, middleClassSexDeman
 	}
 
 	// Street whores adding to 'brothel'
-	V.JobIDArray["whore"].forEach(ID => {
-		SJVBrothel(V.slaves[V.slaveIndices[ID]]);
+	App.Utils.jobForAssignment(Job.WHORE).employees().forEach(s => {
+		SJVBrothel(s);
 	});
 
 	// Brothel whores adding to 'brothel'
-	V.BrothiIDs.forEach(ID => {
-		SJVBrothel(V.slaves[V.slaveIndices[ID]], lowerClassSexDemandRef, middleClassSexDemandRef, upperClassSexDemandRef, topClassSexDemandRef);
+	App.Utils.jobForAssignment(Job.BROTHEL).employees().forEach(s => {
+		SJVBrothel(s, lowerClassSexDemandRef, middleClassSexDemandRef, upperClassSexDemandRef, topClassSexDemandRef);
 	});
 
 	function SJVClub(s) {
@@ -1726,8 +1663,8 @@ globalThis.slaveJobValues = function(lowerClassSexDemandRef, middleClassSexDeman
 		if (V.arcologies[0].FSEdoRevivalist !== "unset") {
 			beautyMultiplier += V.arcologies[0].FSEdoRevivalist / (V.FSLockinLevel * 3);
 		}
-		if (((V.universalRulesFacilityWork === 1) && (s.assignment === "serve the public") && (clubSpots > 0)) || (s.assignment === "serve in the club")) {
-			if (s.assignment === "serve the public") {
+		if (((V.universalRulesFacilityWork === 1) && (s.assignment === Job.PUBLIC) && (clubSpots > 0)) || (s.assignment === Job.CLUB)) {
+			if (s.assignment === Job.PUBLIC) {
 				toTheClub = 1;
 				toTheClubTotal += 1;
 				V.clubSlavesGettingHelp += 1;
@@ -1736,7 +1673,7 @@ globalThis.slaveJobValues = function(lowerClassSexDemandRef, middleClassSexDeman
 				beautyMultiplier += 0.05 * App.Ads.getMatchedCategoryCount(s, "club");
 			}
 		}
-		if (s.assignment === "serve in the club" || toTheClub === 1) {
+		if (s.assignment === Job.CLUB || toTheClub === 1) {
 			beautyMultiplier += V.DJRepBonus;
 			if (canHear(s) === false) {
 				beautyMultiplier -= 0.65;
@@ -1747,7 +1684,7 @@ globalThis.slaveJobValues = function(lowerClassSexDemandRef, middleClassSexDeman
 		}
 
 		// Injuries
-		if (s.assignment === "serve the public" && !toTheClub) {
+		if (s.assignment === Job.PUBLIC && !toTheClub) {
 			if (s.curatives < 1 && s.inflationType !== "curative") {
 				if (s.health.condition < -50) {
 					healthDamage(s, 13);
@@ -1793,7 +1730,7 @@ globalThis.slaveJobValues = function(lowerClassSexDemandRef, middleClassSexDeman
 		// The amount of sexual acts
 		s.sexAmount = Beauty(s) / 2 + 100;
 
-		if (s.assignment === "be the DJ") {
+		if (s.assignment === Job.DJ) {
 			if ((CL + toTheClubTotal > 0) && (CL + toTheClubTotal < 10)) {
 				s.sexAmount *= (10 - CL - toTheClubTotal) / 10;
 			}
@@ -1826,7 +1763,7 @@ globalThis.slaveJobValues = function(lowerClassSexDemandRef, middleClassSexDeman
 		} else if (s.trust < -20) {
 			s.sexQuality -= 2;
 		}
-		if (s.assignment === "serve in the club") {
+		if (s.assignment === Job.CLUB) {
 			s.sexQuality += 2;
 		} else if (toTheClub === 1) {
 			s.sexQuality += 2;
@@ -1835,7 +1772,7 @@ globalThis.slaveJobValues = function(lowerClassSexDemandRef, middleClassSexDeman
 		if (healthPenalty(s) < restEffect) {
 			s.sexQuality = Math.trunc(s.sexQuality * healthPenalty(s) / restEffect);
 		}
-		if (s.assignment !== "recruit girls") {
+		if (s.assignment !== Job.RECRUITER) {
 			slaveJobValues.club += Math.trunc(s.sexAmount * s.sexQuality);
 		}
 	}
@@ -1864,8 +1801,8 @@ globalThis.slaveJobValues = function(lowerClassSexDemandRef, middleClassSexDeman
 			}
 		}
 		if (V.brothel > 0) {
-			if ((V.universalRulesFacilityWork === 1 && s.assignment === "whore" && brothelSpots > 0) || (s.assignment === "work in the brothel")) {
-				if (s.assignment === "whore") {
+			if ((V.universalRulesFacilityWork === 1 && s.assignment === Job.WHORE && brothelSpots > 0) || (s.assignment === Job.BROTHEL)) {
+				if (s.assignment === Job.WHORE) {
 					toTheBrothel = 1;
 					toTheBrothelTotal += 1;
 					V.brothelSlavesGettingHelp += 1;
@@ -1887,7 +1824,7 @@ globalThis.slaveJobValues = function(lowerClassSexDemandRef, middleClassSexDeman
 		}
 
 		// Injuries
-		if (s.assignment === "whore" && !toTheBrothel) {
+		if (s.assignment === Job.WHORE && !toTheBrothel) {
 			if (s.curatives < 1 && s.inflationType !== "curative") {
 				if (s.health.condition < -50) {
 					healthDamage(s, 13);
@@ -1953,7 +1890,7 @@ globalThis.slaveJobValues = function(lowerClassSexDemandRef, middleClassSexDeman
 		} else if (s.trust < -20) {
 			s.sexQuality -= 2;
 		}
-		if (s.assignment === "work in the brothel" || s.assignment === "be the Madam") {
+		if (s.assignment === Job.BROTHEL || s.assignment === Job.MADAM) {
 			s.sexQuality += 2;
 		} else if (toTheBrothel === 1) {
 			s.sexQuality += 2;
@@ -1998,7 +1935,7 @@ globalThis.slaveJobValues = function(lowerClassSexDemandRef, middleClassSexDeman
 			let demandBoost = 1;
 			let priceBoost = 1;
 
-			if (toTheBrothel === 1 || s.assignment === "work in the brothel") {
+			if (toTheBrothel === 1 || s.assignment === Job.BROTHEL) {
 				demandBoost += V.brothelBoost.eligible / 50;
 				priceBoost += V.brothelBoost.eligible / 20;
 			}
@@ -2056,7 +1993,7 @@ globalThis.slaveJobValues = function(lowerClassSexDemandRef, middleClassSexDeman
 
 			s.sexQuality = Math.trunc((income * demandBoost * priceBoost) / s.sexAmount);
 			const incomeBoostCorrected = Math.trunc(s.sexAmount * s.sexQuality / priceBoost);
-			if ((toTheBrothel === 1 || s.assignment === "work in the brothel") && V.brothelBoost.eligible > 0) {
+			if ((toTheBrothel === 1 || s.assignment === Job.BROTHEL) && V.brothelBoost.eligible > 0) {
 				slaveJobValues.brothel.boost += Math.max(Math.trunc(s.sexAmount * s.sexQuality / demandBoost) - Math.trunc(income), 0); // Keeping track of additional benefits from boosting the brothel on the price side and not the amount side.
 			}
 
@@ -2080,7 +2017,7 @@ globalThis.slaveJobValues = function(lowerClassSexDemandRef, middleClassSexDeman
 
 		whoreScore(s, lowerClassSexDemandRef, middleClassSexDemandRef, upperClassSexDemandRef, topClassSexDemandRef, toTheBrothel);
 
-		if (s.assignment === "be the Madam") {
+		if (s.assignment === Job.MADAM) {
 			if ((BL + toTheBrothelTotal > 0) && (BL + toTheBrothelTotal < 10)) {
 				s.sexAmount = Math.trunc(s.sexAmount * ((10 - BL - toTheBrothelTotal) / 10));
 				s.sexQuality = Math.trunc(s.sexQuality * 1.2);
diff --git a/src/js/eventSelectionJS.js b/src/js/eventSelectionJS.js
index cbdee18db3891340a50bbb9c5c80b091cbb09cb5..d78a79f5bb789ec126f89799655b89b154e601d3 100644
--- a/src/js/eventSelectionJS.js
+++ b/src/js/eventSelectionJS.js
@@ -6,22 +6,22 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 	if (eventSlave.fetish !== "mindbroken") {
 		if (hasAnyArms(eventSlave) && hasAnyLegs(eventSlave)) {
 			if (canTalk(eventSlave)) {
-				if (State.variables.RECockmilkInterceptionIDs.length > 1 || (State.variables.RECockmilkInterceptionIDs.length === 1 && eventSlave.ID !== State.variables.RECockmilkInterceptionIDs[0])) {
+				if (V.RECockmilkInterceptionIDs.length > 1 || (V.RECockmilkInterceptionIDs.length === 1 && eventSlave.ID !== V.RECockmilkInterceptionIDs[0])) {
 					if (eventSlave.devotion > 20) {
 						if (eventSlave.dietCum > 0 || (eventSlave.fetishKnown && eventSlave.fetish === "cumslut")) {
-							State.variables.RETSevent.push("cockmilk interception");
+							V.RETSevent.push("cockmilk interception");
 						}
 					}
 				}
 
-				if (State.variables.REInterslaveBeggingIDs.length > 1 || (State.variables.REInterslaveBeggingIDs.length === 1 && eventSlave.ID !== State.variables.REInterslaveBeggingIDs[0])) {
-					if (State.variables.universalRulesConsent === 1) {
+				if (V.REInterslaveBeggingIDs.length > 1 || (V.REInterslaveBeggingIDs.length === 1 && eventSlave.ID !== V.REInterslaveBeggingIDs[0])) {
+					if (V.universalRulesConsent === 1) {
 						if (eventSlave.devotion > 20) {
 							if (eventSlave.energy > 40) {
 								if (canPenetrate(eventSlave)) {
 									if (canSee(eventSlave)) {
 										if (eventSlave.rules.release.slaves === 1) {
-											State.variables.RETSevent.push("interslave begging");
+											V.RETSevent.push("interslave begging");
 										}
 									}
 								}
@@ -30,7 +30,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 					}
 				}
 
-				if (State.variables.seeIncest === 1) {
+				if (V.seeIncest === 1) {
 					if (eventSlave.devotion > 20) {
 						if (eventSlave.sexualQuirk === "perverted" || eventSlave.energy > 80) {
 							if (eventSlave.belly < 100000) {
@@ -38,7 +38,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 									if (eventSlave.nipples !== "fuckable") {
 										if (eventSlave.rules.release.family === 1) {
 											if (eventSlave.daughters > 0) {
-												State.variables.RETSevent.push("incestuous nursing");
+												V.RETSevent.push("incestuous nursing");
 											}
 										}
 									}
@@ -52,7 +52,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 					if (eventSlave.devotion > 50) {
 						if (eventSlave.intelligenceImplant >= 15) {
 							if (eventSlave.accent < 4) {
-								State.variables.RESSevent.push("devoted educated slave");
+								V.RESSevent.push("devoted educated slave");
 							}
 						}
 					}
@@ -63,39 +63,39 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 						if (eventSlave.health.condition > 40) {
 							if (eventSlave.devotion > 50) {
 								if (eventSlave.trust > 50) {
-									State.variables.RESSevent.push("happy dance");
+									V.RESSevent.push("happy dance");
 								}
 							}
 						}
 					}
 				}
 
-				if (State.variables.RERepressedAnalVirginSubIDs.length > 0) {
+				if (V.RERepressedAnalVirginSubIDs.length > 0) {
 					if (eventSlave.anus === 0) {
 						if (eventSlave.devotion >= -50) {
 							if (eventSlave.trust >= -50) {
 								if (eventSlave.sexualFlaw === "repressed") {
-									State.variables.RETSevent.push("repressed anal virgin");
+									V.RETSevent.push("repressed anal virgin");
 								}
 							}
 						}
 					}
 				}
 
-				if (State.variables.assistant > 0) {
-					if (State.variables.assistant.appearance !== "normal") {
+				if (V.assistant > 0) {
+					if (V.assistant.appearance !== "normal") {
 						if (eventSlave.devotion >= -20) {
 							if (canSee(eventSlave)) {
 								if (eventSlave.devotion <= 50) {
-									if (eventSlave.assignment === "be a servant") {
+									if (eventSlave.assignment === Job.HOUSE) {
 										if (canDoAnal(eventSlave) || canDoVaginal(eventSlave)) {
-											State.variables.RESSevent.push("PA servant");
+											V.RESSevent.push("PA servant");
 										}
 									}
 								} else if (eventSlave.trust > 75) {
 									if (eventSlave.energy > 60) {
 										if ((canDoAnal(eventSlave) && eventSlave.anus > 0) || (canDoVaginal(eventSlave) && eventSlave.vagina > 0)) {
-											State.variables.RESSevent.push("PA flirting");
+											V.RESSevent.push("PA flirting");
 										}
 									}
 								}
@@ -107,34 +107,34 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				if (eventSlave.clothes === "a succubus outfit") {
 					if (eventSlave.devotion > 20) {
 						if (eventSlave.trust > 20) {
-							State.variables.RESSevent.push("sexy succubus");
+							V.RESSevent.push("sexy succubus");
 						}
 					}
 				}
 
-				if (State.variables.HeadGirl !== 0) {
+				if (V.HeadGirl !== 0) {
 					if (eventSlave.devotion <= 50) {
 						if (eventSlave.anus !== 0 && canDoAnal(eventSlave)) {
-							if (State.variables.HGSeverity >= 0) {
-								State.variables.events.push("RE anal punishment");
+							if (V.HGSeverity >= 0) {
+								V.events.push("RE anal punishment");
 							}
-							State.variables.events.push("RE shower punishment");
+							V.events.push("RE shower punishment");
 						}
 					}
-					if (eventSlave.ID === State.variables.HeadGirl.ID) {
+					if (eventSlave.ID === V.HeadGirl.ID) {
 						if (eventSlave.trust > 50) {
-							State.variables.RESSevent.push("trusting HG");
+							V.RESSevent.push("trusting HG");
 						}
 					}
-					if (eventSlave.ID !== State.variables.HeadGirl.ID) {
+					if (eventSlave.ID !== V.HeadGirl.ID) {
 						if (canSee(eventSlave) && canWalk(eventSlave)) {
 							if (eventSlave.rules.speech !== "restrictive") {
 								if (eventSlave.trust > 75) {
 									if (eventSlave.devotion > 50) {
 										if (eventSlave.skill.oral > 30) {
-											if (eventSlave.intelligence + eventSlave.intelligenceImplant >= State.variables.HeadGirl.intelligence + State.variables.HeadGirl.intelligenceImplant) {
-												if (eventSlave.skill.oral > State.variables.HeadGirl.skill.oral) {
-													State.variables.events.push("RE HG replacement");
+											if (eventSlave.intelligence + eventSlave.intelligenceImplant >= V.HeadGirl.intelligence + V.HeadGirl.intelligenceImplant) {
+												if (eventSlave.skill.oral > V.HeadGirl.skill.oral) {
+													V.events.push("RE HG replacement");
 												}
 											}
 										}
@@ -148,10 +148,10 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				if (eventSlave.rules.living === "spare") {
 					if (eventSlave.devotion <= 20) {
 						if (eventSlave.devotion > -10) {
-							State.variables.RESSevent.push("sleeping ambivalent");
+							V.RESSevent.push("sleeping ambivalent");
 						}
 						if (eventSlave.trust < -20) {
-							State.variables.RESSevent.push("bad dream");
+							V.RESSevent.push("bad dream");
 						}
 					}
 				}
@@ -159,11 +159,11 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				if (eventSlave.devotion <= 50) {
 					if (eventSlave.devotion >= -20) {
 						if (eventSlave.weekAcquired > 0) {
-							if (State.variables.week - eventSlave.weekAcquired < 10) {
+							if (V.week - eventSlave.weekAcquired < 10) {
 								if (eventSlave.energy > 20) {
 									if (eventSlave.anus !== 0) {
 										if (eventSlave.vagina !== 0) {
-											State.variables.RESSevent.push("ignorant horny");
+											V.RESSevent.push("ignorant horny");
 										}
 									}
 								}
@@ -172,19 +172,19 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 					}
 				}
 
-				if (State.variables.RETasteTestSubIDs.length > 1) {
+				if (V.RETasteTestSubIDs.length > 1) {
 					if (eventSlave.rules.living === "luxurious") {
 						if (eventSlave.devotion > 20) {
 							if (eventSlave.energy > 80) {
 								if (canTaste(eventSlave)) {
-									State.variables.RETSevent.push("taste test");
+									V.RETSevent.push("taste test");
 								}
 							}
 						}
 					}
 				}
 
-				if (State.variables.modRequestsAllowed > 0) {
+				if (V.modRequestsAllowed > 0) {
 					if (eventSlave.trust > 50) {
 						if (eventSlave.devotion > 20) {
 							if (eventSlave.dick !== 0 || eventSlave.vagina !== -1) {
@@ -198,7 +198,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 															if (eventSlave.vaginaPiercing === 0) {
 																if (eventSlave.lipsTat === 0 || eventSlave.lipsTat === "none") {
 																	if (eventSlave.vaginaTat === 0 || eventSlave.vaginaTat === "none") {
-																		State.variables.RESSevent.push("mods please");
+																		V.RESSevent.push("mods please");
 																	}
 																}
 															}
@@ -217,26 +217,26 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				if (eventSlave.muscles > 5) {
 					if (eventSlave.devotion > 20) {
 						if (eventSlave.diet !== "slimming") {
-							State.variables.RESSevent.push("sore shoulders");
+							V.RESSevent.push("sore shoulders");
 						}
 					}
 				}
 
 				if (eventSlave.relationship > 3) {
-					let relationshipSlave = State.variables.slaves.find(s => s.ID === eventSlave.relationshipTarget);
+					let relationshipSlave = V.slaves.find(s => s.ID === eventSlave.relationshipTarget);
 					if (relationshipSlave.devotion > 20) {
 						if (canWalk(relationshipSlave)) {
 							if (canTalk(relationshipSlave)) {
 								if (eventSlave.devotion > 50) {
 									if (eventSlave.trust > 50) {
 										if (eventSlave.rules.speech !== "restrictive") {
-											State.variables.RETSevent.push("date please");
+											V.RETSevent.push("date please");
 										}
 										if (relationshipSlave.anus !== 0) {
 											if (relationshipSlave.dick !== 1) {
 												if (relationshipSlave.dick === 0 || canAchieveErection(relationshipSlave)) {
 													if (relationshipSlave.fetish === "dom" || relationshipSlave.fetish === "sadist") {
-														State.variables.RETSevent.push("top exhaustion");
+														V.RETSevent.push("top exhaustion");
 													}
 												}
 											}
@@ -248,36 +248,36 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 					}
 				}
 
-				if (State.variables.REAnalCowgirlSubIDs.length > 1 || (State.variables.REAnalCowgirlSubIDs.length === 1 && eventSlave.ID !== State.variables.REAnalCowgirlSubIDs[0])) {
+				if (V.REAnalCowgirlSubIDs.length > 1 || (V.REAnalCowgirlSubIDs.length === 1 && eventSlave.ID !== V.REAnalCowgirlSubIDs[0])) {
 					if (eventSlave.devotion > 20) {
 						if (eventSlave.rules.release.slaves === 1) {
 							if (eventSlave.fetish === "buttslut" || eventSlave.fetish === "sadist" || eventSlave.fetish === "dom") {
 								if ((eventSlave.chastityPenis !== 1) || (eventSlave.dick === 0)) {
-									State.variables.RETSevent.push("anal cowgirl");
+									V.RETSevent.push("anal cowgirl");
 								}
 							}
 						}
 					}
 				}
 
-				if (State.variables.REBoobCollisionSubIDs.length > 1) {
+				if (V.REBoobCollisionSubIDs.length > 1) {
 					if (eventSlave.devotion > 20) {
 						if (eventSlave.trust > 20) {
 							if (eventSlave.boobs > 3000) {
 								if (eventSlave.attrXX >= 50 || (eventSlave.fetish === "boobs" && eventSlave.fetishStrength > 95)) {
-									State.variables.RETSevent.push("boob collision");
+									V.RETSevent.push("boob collision");
 								}
 							}
 						}
 					}
 				}
 
-				if (State.variables.weatherToday.severity <= 1) {
+				if (V.weatherToday.severity <= 1) {
 					if (eventSlave.trust > 50) {
 						if (eventSlave.devotion > 20) {
 							if (eventSlave.anus !== 0 && canDoAnal(eventSlave)) {
 								if (eventSlave.vagina !== 0) {
-									State.variables.RESSevent.push("confident tanning");
+									V.RESSevent.push("confident tanning");
 								}
 							}
 						}
@@ -287,13 +287,13 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				if (eventSlave.devotion > 50) {
 					if (eventSlave.trust > 50) {
 						let giver = 0;
-						if (State.variables.HeadGirl === 0) {
+						if (V.HeadGirl === 0) {
 							giver = 1;
-						} else if (State.variables.HeadGirl.ID !== eventSlave.ID) {
+						} else if (V.HeadGirl.ID !== eventSlave.ID) {
 							giver = 1;
 						}
 						if (giver === 1) {
-							State.variables.RESSevent.push("a gift");
+							V.RESSevent.push("a gift");
 						}
 					}
 				}
@@ -302,7 +302,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 					if (eventSlave.relationship < 5) {
 						if (eventSlave.devotion > 20) {
 							if (eventSlave.trust >= -20) {
-								State.variables.events.push("RE relationship advice");
+								V.events.push("RE relationship advice");
 							}
 						}
 					}
@@ -312,16 +312,16 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 					if (eventSlave.anus > 0) {
 						if (eventSlave.vagina !== 0) {
 							if (eventSlave.trust > 20) {
-								State.variables.RESSevent.push("devoted exhibition");
-								State.variables.RESSevent.push("devoted lotion");
+								V.RESSevent.push("devoted exhibition");
+								V.RESSevent.push("devoted lotion");
 							}
 							if (eventSlave.energy > 95 && canDoAnal(eventSlave)) {
-								State.variables.RESSevent.push("devoted nympho");
+								V.RESSevent.push("devoted nympho");
 							}
 							if (eventSlave.rules.release.masturbation === 1) {
 								if (hasBothArms(eventSlave)) {
 									if ((eventSlave.chastityPenis !== 1) || (eventSlave.dick === 0)) {
-										State.variables.RESSevent.push("permitted masturbation");
+										V.RESSevent.push("permitted masturbation");
 									}
 								}
 							}
@@ -331,20 +331,20 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 
 				if (eventSlave.trust < -50) {
 					if (eventSlave.devotion <= 20) {
-						State.variables.RESSevent.push("terrified inspection");
+						V.RESSevent.push("terrified inspection");
 					}
 				}
 
 				if (eventSlave.dick > 0) {
 					if (eventSlave.anus > 0) {
 						if (eventSlave.devotion >= 10) {
-							if (State.variables.REFeminizationCheckinIDs.includes(eventSlave.ID)) {
-								State.variables.RECIevent.push("feminization");
+							if (V.REFeminizationCheckinIDs.includes(eventSlave.ID)) {
+								V.RECIevent.push("feminization");
 							}
 							if (eventSlave.trust >= 10) {
 								if (canAchieveErection(eventSlave)) {
-									if (State.variables.REFutaSisterCheckinIDs.includes(eventSlave.ID)) {
-										State.variables.RECIevent.push("futa");
+									if (V.REFutaSisterCheckinIDs.includes(eventSlave.ID)) {
+										V.RECIevent.push("futa");
 									}
 								}
 							}
@@ -354,8 +354,8 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 
 				if (eventSlave.skill.anal > 30) {
 					if (eventSlave.devotion >= 10) {
-						if (State.variables.REMILFCheckinIDs.includes(eventSlave.ID)) {
-							State.variables.RECIevent.push("MILF");
+						if (V.REMILFCheckinIDs.includes(eventSlave.ID)) {
+							V.RECIevent.push("MILF");
 						}
 					}
 				}
@@ -364,8 +364,8 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 					if (eventSlave.anus !== 0) {
 						if (eventSlave.vagina !== 0) {
 							if (eventSlave.devotion >= 10) {
-								if (State.variables.REOrientationCheckinIDs.includes(eventSlave.ID)) {
-									State.variables.RECIevent.push("orientation");
+								if (V.REOrientationCheckinIDs.includes(eventSlave.ID)) {
+									V.RECIevent.push("orientation");
 								}
 							}
 						}
@@ -375,9 +375,9 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				if (canSee(eventSlave)) {
 					if (eventSlave.face >= -10) {
 						if (eventSlave.devotion >= 10) {
-							if (["serve the public", "whore"].includes(eventSlave.assignment)) {
-								if (State.variables.REUglyCheckinIDs.includes(eventSlave.ID)) {
-									State.variables.RECIevent.push("ugly");
+							if ([Job.PUBLIC, Job.WHORE].includes(eventSlave.assignment)) {
+								if (V.REUglyCheckinIDs.includes(eventSlave.ID)) {
+									V.RECIevent.push("ugly");
 								}
 							}
 						}
@@ -389,8 +389,8 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 						if (eventSlave.analArea > 1) {
 							if (eventSlave.devotion > 50) {
 								if (eventSlave.trust > 50) {
-									if (State.variables.REButtholeCheckinIDs.includes(eventSlave.ID)) {
-										State.variables.RECIevent.push("butthole");
+									if (V.REButtholeCheckinIDs.includes(eventSlave.ID)) {
+										V.RECIevent.push("butthole");
 									}
 								}
 							}
@@ -404,8 +404,8 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 						if(eventSlave.devotion <= 50) {
 							if(eventSlave.devotion >= -20) {
 								if(eventSlave.trust >= -50) {
-									if(State.variables.REReductionCheckinIDs.includes(eventSlave.ID)) {
-										State.variables.RECIevent.push("reduction");
+									if(V.REReductionCheckinIDs.includes(eventSlave.ID)) {
+										V.RECIevent.push("reduction");
 									}
 								}
 							}
@@ -414,39 +414,39 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				}
 				*/
 
-				if (eventSlave.assignment === "be a servant") {
+				if (eventSlave.assignment === Job.HOUSE) {
 					if (eventSlave.devotion <= 95) {
 						if (eventSlave.intelligence + eventSlave.intelligenceImplant < -50) {
-							State.variables.RESSevent.push("cooler lockin");
+							V.RESSevent.push("cooler lockin");
 						}
 					}
 				}
 
-				if (State.variables.universalRulesConsent === 0) {
+				if (V.universalRulesConsent === 0) {
 					if (eventSlave.devotion > 50) {
 						if (eventSlave.fetish === "sadist" || eventSlave.fetish === "dom" || eventSlave.energy > 95) {
-							if (State.variables.REShowerForceSubIDs.length > 0) {
+							if (V.REShowerForceSubIDs.length > 0) {
 								if (eventSlave.trust <= 75) {
-									State.variables.RETSevent.push("shower force");
+									V.RETSevent.push("shower force");
 								}
 							}
 							if (eventSlave.anus > 0) {
-								if (State.variables.RESadisticDescriptionSubIDs.length > 0) {
-									State.variables.RETSevent.push("sadistic description");
+								if (V.RESadisticDescriptionSubIDs.length > 0) {
+									V.RETSevent.push("sadistic description");
 								}
 							}
-							if (State.variables.cockFeeder > 0) {
+							if (V.cockFeeder > 0) {
 								if (canPenetrate(eventSlave) || eventSlave.dick === 0) {
-									State.variables.RESSevent.push("kitchen molestation");
+									V.RESSevent.push("kitchen molestation");
 								}
 							}
 						}
-						if (State.variables.REIfYouEnjoyItSubIDs.length > 0) {
-							State.variables.RETSevent.push("if you enjoy it");
+						if (V.REIfYouEnjoyItSubIDs.length > 0) {
+							V.RETSevent.push("if you enjoy it");
 						}
-						if (State.variables.RESimpleAssaultIDs.length > 0) {
+						if (V.RESimpleAssaultIDs.length > 0) {
 							if (canPenetrate(eventSlave)) {
-								State.variables.RETSevent.push("simple assault");
+								V.RETSevent.push("simple assault");
 							}
 						}
 					}
@@ -455,17 +455,17 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				if (eventSlave.devotion < -50) {
 					if (eventSlave.trust >= -20) {
 						if (eventSlave.rules.speech === "restrictive") {
-							State.variables.RESSevent.push("vocal disobedience");
+							V.RESSevent.push("vocal disobedience");
 						}
 					}
 				}
 
-				if (State.variables.boobAccessibility !== 1 && State.variables.ballsAccessibility !== 1 && State.variables.pregAccessibility !== 1) {
+				if (V.boobAccessibility !== 1 && V.ballsAccessibility !== 1 && V.pregAccessibility !== 1) {
 					if (eventSlave.boobs > 10000) {
 						if (eventSlave.devotion >= -20) {
-							if (State.variables.slaves.length > 2) {
+							if (V.slaves.length > 2) {
 								if (canDoAnal(eventSlave) || canDoVaginal(eventSlave)) {
-									State.variables.RESSevent.push("huge tits");
+									V.RESSevent.push("huge tits");
 								}
 							}
 						}
@@ -475,24 +475,24 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				if (eventSlave.physicalAge > 30) {
 					if (eventSlave.ageImplant > 0) {
 						if (eventSlave.devotion > 20) {
-							State.variables.RESSevent.push("age implant");
+							V.RESSevent.push("age implant");
 						}
 					}
 				}
 
-				if (State.variables.seeAge !== 0) {
+				if (V.seeAge !== 0) {
 					if (eventSlave.devotion > 50) {
 						if (eventSlave.rules.speech !== "restrictive") {
 							if (eventSlave.birthWeek >= 51) {
 								/* let's give this a much higher chance of appearing */
-								State.variables.RESSevent.push("birthday");
-								State.variables.RESSevent.push("birthday");
-								State.variables.RESSevent.push("birthday");
-								State.variables.RESSevent.push("birthday");
-								State.variables.RESSevent.push("birthday");
-								State.variables.RESSevent.push("birthday");
-								State.variables.RESSevent.push("birthday");
-								State.variables.RESSevent.push("birthday");
+								V.RESSevent.push("birthday");
+								V.RESSevent.push("birthday");
+								V.RESSevent.push("birthday");
+								V.RESSevent.push("birthday");
+								V.RESSevent.push("birthday");
+								V.RESSevent.push("birthday");
+								V.RESSevent.push("birthday");
+								V.RESSevent.push("birthday");
 							}
 						}
 					}
@@ -502,7 +502,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 					if (eventSlave.anus > 0) {
 						if (eventSlave.devotion >= -20) {
 							if (eventSlave.devotion <= 50) {
-								State.variables.RESSevent.push("penitent");
+								V.RESSevent.push("penitent");
 							}
 						}
 					}
@@ -512,17 +512,17 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 					if (eventSlave.devotion <= 20) {
 						if (eventSlave.trust >= -20) {
 							if (eventSlave.anus > 0 && canDoAnal(eventSlave)) {
-								State.variables.RESSevent.push("not my name");
+								V.RESSevent.push("not my name");
 							}
 						}
 					}
 				}
 
-				if (State.variables.slaves.length > 2) {
+				if (V.slaves.length > 2) {
 					if (eventSlave.devotion >= -20) {
 						if (eventSlave.heels === 1) {
 							if (eventSlave.shoes === "heels" || eventSlave.shoes === "boots" || eventSlave.shoes === "extreme heels") {
-								State.variables.RESSevent.push("tendon fall");
+								V.RESSevent.push("tendon fall");
 							}
 						}
 					}
@@ -534,7 +534,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 							if (canDoAnal(eventSlave)) {
 								if (eventSlave.anus > 0) {
 									if (eventSlave.skill.anal <= 30) {
-										State.variables.RESSevent.push("obedient shemale");
+										V.RESSevent.push("obedient shemale");
 									}
 								}
 							}
@@ -547,7 +547,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 						if (eventSlave.physicalAge > 37) {
 							if (eventSlave.anus > 0) {
 								if (eventSlave.vagina > 0) {
-									State.variables.RESSevent.push("devoted old");
+									V.RESSevent.push("devoted old");
 								}
 							}
 						}
@@ -558,8 +558,8 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 					if (eventSlave.trust > 20) {
 						if (eventSlave.actualAge > 35) {
 							if (canDoAnal(eventSlave) || canDoVaginal(eventSlave)) {
-								if (State.variables.PC.actualAge < 25) {
-									State.variables.RESSevent.push("young PC age difference");
+								if (V.PC.actualAge < 25) {
+									V.RESSevent.push("young PC age difference");
 								}
 							}
 						}
@@ -570,8 +570,8 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 					if (eventSlave.trust > 20) {
 						if (eventSlave.actualAge < 22) {
 							if (canDoAnal(eventSlave) || canDoVaginal(eventSlave)) {
-								if (State.variables.PC.actualAge >= 50) {
-									State.variables.RESSevent.push("old PC age difference");
+								if (V.PC.actualAge >= 50) {
+									V.RESSevent.push("old PC age difference");
 								}
 							}
 						}
@@ -585,7 +585,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 								if (eventSlave.vagina !== 0) {
 									if (eventSlave.anus !== 0) {
 										if (eventSlave.fetishKnown === 1) {
-											State.variables.RESSevent.push("fearful humiliation");
+											V.RESSevent.push("fearful humiliation");
 										}
 									}
 								}
@@ -597,18 +597,18 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				if (eventSlave.rules.living === "luxurious") {
 					if (eventSlave.devotion <= 75) {
 						if (eventSlave.devotion > 50) {
-							State.variables.RESSevent.push("newly devoted sunrise");
+							V.RESSevent.push("newly devoted sunrise");
 						}
 					}
 				}
 
-				if (State.variables.PC.dick > 0) {
-					if (State.variables.PC.belly < 5000) {
-						if (eventSlave.assignment === "be a servant") {
+				if (V.PC.dick > 0) {
+					if (V.PC.belly < 5000) {
+						if (eventSlave.assignment === Job.HOUSE) {
 							if (eventSlave.attrXY <= 35 || eventSlave.behavioralFlaw === "hates men" || eventSlave.sexualFlaw === "repressed") {
 								if (eventSlave.devotion >= -20) {
 									if (eventSlave.trust > 20) {
-										State.variables.RESSevent.push("frightening dick");
+										V.RESSevent.push("frightening dick");
 									}
 								}
 							}
@@ -616,12 +616,12 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 					}
 				}
 
-				if (State.variables.spa > 0) {
+				if (V.spa > 0) {
 					if (eventSlave.boobs > 2000) {
 						if (eventSlave.devotion > 20) {
 							if (eventSlave.trust > 20) {
 								if (canDoAnal(eventSlave) || canDoVaginal(eventSlave)) {
-									State.variables.RESSevent.push("spa boobs");
+									V.RESSevent.push("spa boobs");
 								}
 							}
 						}
@@ -633,7 +633,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 						if (eventSlave.nipples !== "fuckable") {
 							if (eventSlave.devotion > 20) {
 								if (eventSlave.trust > 20) {
-									State.variables.RESSevent.push("cow milking");
+									V.RESSevent.push("cow milking");
 								}
 							}
 						}
@@ -643,21 +643,21 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				if (eventSlave.dietCum > 0) {
 					if (eventSlave.devotion <= 20) {
 						if ((eventSlave.fetish !== "cumslut" && eventSlave.fetish !== "masochist" && eventSlave.fetishStrength < 60) || eventSlave.fetishKnown === 0) {
-							State.variables.RESSevent.push("retching cum feeding");
+							V.RESSevent.push("retching cum feeding");
 						}
 					}
 				}
 
-				if (State.variables.arcologies[0].FSSubjugationist !== "unset") {
-					if (eventSlave.race !== State.variables.arcologies[0].FSSubjugationistRace) {
-						if (State.variables.week - eventSlave.weekAcquired > 1) {
-							if (State.variables.week - eventSlave.weekAcquired < 10) {
+				if (V.arcologies[0].FSSubjugationist !== "unset") {
+					if (eventSlave.race !== V.arcologies[0].FSSubjugationistRace) {
+						if (V.week - eventSlave.weekAcquired > 1) {
+							if (V.week - eventSlave.weekAcquired < 10) {
 								if (eventSlave.devotion < -20) {
 									if (eventSlave.trust >= -20) {
 										if (eventSlave.health.condition > -20) {
 											if (eventSlave.race === eventSlave.origRace) {
 												if (eventSlave.indentureRestrictions < 1) {
-													State.variables.RESSevent.push("subjugation blues");
+													V.RESSevent.push("subjugation blues");
 												}
 											}
 										}
@@ -678,7 +678,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 											if (eventSlave.behavioralFlaw !== "anorexic") {
 												if (eventSlave.sexualFlaw !== "self hating") {
 													if (eventSlave.fetishStrength <= 60 || eventSlave.fetishKnown !== 1) {
-														State.variables.RESSevent.push("too thin for cum diet");
+														V.RESSevent.push("too thin for cum diet");
 													}
 												}
 											}
@@ -698,7 +698,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 									if (eventSlave.trust >= -50) {
 										if (eventSlave.fetish !== "boobs") {
 											if (eventSlave.intelligence + eventSlave.intelligenceImplant >= -50) {
-												State.variables.RESSevent.push("breast expansion blues");
+												V.RESSevent.push("breast expansion blues");
 											}
 										}
 									}
@@ -710,10 +710,10 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 
 				if (eventSlave.physicalAge > 35) {
 					if (eventSlave.rules.speech !== "restrictive") {
-						if (["serve the public", "whore"].includes(eventSlave.assignment)) {
+						if ([Job.PUBLIC, Job.WHORE].includes(eventSlave.assignment)) {
 							if (eventSlave.devotion >= -20) {
 								if (eventSlave.devotion <= 95) {
-									State.variables.RESSevent.push("ara ara");
+									V.RESSevent.push("ara ara");
 								}
 							}
 						}
@@ -723,7 +723,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				if (eventSlave.anus > 3) {
 					if (eventSlave.devotion > 50) {
 						if (eventSlave.trust > 50) {
-							State.variables.RESSevent.push("gaped asshole");
+							V.RESSevent.push("gaped asshole");
 						}
 					}
 				}
@@ -734,7 +734,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 							if (eventSlave.weight >= -30) {
 								if (eventSlave.trust > 50) {
 									if (eventSlave.devotion > 50) {
-										State.variables.RESSevent.push("passing declaration");
+										V.RESSevent.push("passing declaration");
 									}
 								}
 							}
@@ -744,17 +744,17 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 
 				if (eventSlave.trust < -50) {
 					if (eventSlave.devotion <= 50) {
-						State.variables.RESSevent.push("im scared");
+						V.RESSevent.push("im scared");
 					}
 				}
 
 				if (eventSlave.fetish === "sadist") {
 					if (eventSlave.fetishStrength > 20) {
-						if (State.variables.ArcadeiIDs.length > 0) {
+						if (App.Entity.facilities.arcade.established) {
 							if (eventSlave.trust >= -20) {
 								if (eventSlave.devotion > 50) {
 									if (eventSlave.belly < 300000) {
-										State.variables.RESSevent.push("arcade sadist");
+										V.RESSevent.push("arcade sadist");
 									}
 								}
 							}
@@ -769,7 +769,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 								if (eventSlave.devotion >= -50) {
 									if (eventSlave.fetish !== "buttslut" || eventSlave.fetishStrength <= 20) {
 										if (eventSlave.nipples !== "fuckable") {
-											State.variables.RESSevent.push("desperate null");
+											V.RESSevent.push("desperate null");
 										}
 									}
 								}
@@ -780,7 +780,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 
 				if (eventSlave.devotion > 20) {
 					if (eventSlave.boobs > 2000) {
-						State.variables.RESSevent.push("back stretch");
+						V.RESSevent.push("back stretch");
 					}
 				}
 
@@ -789,22 +789,22 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 						if (eventSlave.rules.speech !== "restrictive") {
 							if (eventSlave.choosesOwnClothes !== 1) {
 								if (setup.modestClothes.includes(eventSlave.clothes)) {
-									State.variables.RESSevent.push("modest clothes");
+									V.RESSevent.push("modest clothes");
 								}
 							}
 						}
 					}
 				}
 
-				if (State.variables.PC.vagina > -1) {
+				if (V.PC.vagina > -1) {
 					if (eventSlave.devotion <= 20) {
 						if ((eventSlave.trust >= -20 && eventSlave.behavioralFlaw === "arrogant") || (eventSlave.trust > 20)) {
 							if (eventSlave.muscles > 30) {
 								if (eventSlave.health.condition > 20) {
 									if (eventSlave.energy > 50) {
 										if (canPenetrate(eventSlave)) {
-											if (State.variables.Bodyguard === 0) {
-												State.variables.RESSevent.push("mutinery attempt");
+											if (V.Bodyguard === 0) {
+												V.RESSevent.push("mutinery attempt");
 											}
 										}
 									}
@@ -817,7 +817,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 
 			if (eventSlave.devotion > 20) {
 				if (eventSlave.mouthAccessory !== "none") {
-					State.variables.RESSevent.push("gagged slave");
+					V.RESSevent.push("gagged slave");
 				}
 			}
 
@@ -825,9 +825,9 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				if (eventSlave.devotion > 20) {
 					if (eventSlave.energy > 40) {
 						if (eventSlave.belly < 300000) {
-							if (State.variables.PC.belly < 5000 && State.variables.PC.balls < 10) {
+							if (V.PC.belly < 5000 && V.PC.balls < 10) {
 								if (canSee(eventSlave)) {
-									State.variables.RESSevent.push("comfortable seat");
+									V.RESSevent.push("comfortable seat");
 								}
 							}
 						}
@@ -842,7 +842,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 							if (eventSlave.chastityPenis !== 1) {
 								if (eventSlave.vagina === -1) {
 									if (eventSlave.attrXY < 50) {
-										State.variables.RESSevent.push("transition anxiety");
+										V.RESSevent.push("transition anxiety");
 									}
 								}
 							}
@@ -851,14 +851,14 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				}
 			}
 
-			if (State.variables.seeAge === 1) {
+			if (V.seeAge === 1) {
 				if (eventSlave.actualAge < 18) {
 					if (eventSlave.devotion > 20) {
 						if (eventSlave.ovaries === 1) {
 							if (eventSlave.pubertyXX === 0) {
 								if (eventSlave.preg === 0) {
 									if (eventSlave.physicalAge + eventSlave.birthWeek / 52 >= eventSlave.pubertyAgeXX - 0.5) {
-										State.variables.RESSevent.push(...Array.from({length: 10}, () => "first period"));
+										V.RESSevent.push(...Array.from({length: 10}, () => "first period"));
 									}
 								}
 							}
@@ -867,7 +867,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 							if (eventSlave.balls > 0) {
 								if (eventSlave.pubertyXY === 0) {
 									if (eventSlave.physicalAge + eventSlave.birthWeek / 52 >= eventSlave.pubertyAgeXY - 0.5) {
-										State.variables.RESSevent.push(...Array.from({length: 10}, () => "wet dreams"));
+										V.RESSevent.push(...Array.from({length: 10}, () => "wet dreams"));
 									}
 								}
 							}
@@ -879,23 +879,23 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 
 			if (eventSlave.devotion >= -150) {
 				if (eventSlave.devotion <= 50) {
-					State.variables.events.push("RE standard punishment");
+					V.events.push("RE standard punishment");
 				}
 			}
 
 			if (eventSlave.boobs > 600) {
 				if (eventSlave.boobShape === "torpedo-shaped") {
 					if (eventSlave.devotion >= -50) {
-						State.variables.RESSevent.push("torpedo squeeze");
+						V.RESSevent.push("torpedo squeeze");
 					}
 				}
 			}
 
-			if (eventSlave.assignment === "serve the public") {
+			if (eventSlave.assignment === Job.PUBLIC) {
 				if (eventSlave.fetishKnown === 1) {
-					if (State.variables.arcologies[0].FSDegradationist === "unset") {
-						if (State.variables.arcologyUpgrade.drones === 1) {
-							State.variables.RESSevent.push("mean girls");
+					if (V.arcologies[0].FSDegradationist === "unset") {
+						if (V.arcologyUpgrade.drones === 1) {
+							V.RESSevent.push("mean girls");
 						}
 					}
 				}
@@ -903,11 +903,11 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 
 			if (eventSlave.balls > 0) {
 				if (eventSlave.hormoneBalance >= 100) {
-					if (State.variables.hormoneUpgradeMood === 0) {
+					if (V.hormoneUpgradeMood === 0) {
 						if (eventSlave.trust >= -50) {
 							if (eventSlave.devotion >= -20) {
 								if (eventSlave.devotion <= 50) {
-									State.variables.RESSevent.push("orchiectomy please");
+									V.RESSevent.push("orchiectomy please");
 								}
 							}
 						}
@@ -917,11 +917,11 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 
 			if (eventSlave.trust > 20) {
 				if (eventSlave.devotion > 50) {
-					if (State.variables.PC.belly < 5000) {
-						State.variables.RESSevent.push("shower slip");
+					if (V.PC.belly < 5000) {
+						V.RESSevent.push("shower slip");
 					}
 					if (getLimbCount(eventSlave, 102) === 4) {
-						State.variables.RESSevent.push("plimb help");
+						V.RESSevent.push("plimb help");
 					}
 				}
 			}
@@ -929,14 +929,14 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 			if (eventSlave.devotion <= 20) {
 				if (eventSlave.devotion >= -50) {
 					if (eventSlave.trust >= -20) {
-						if (State.variables.suppository !== 0) {
+						if (V.suppository !== 0) {
 							if (eventSlave.fetish !== "buttslut") {
-								State.variables.RESSevent.push("suppository resistance");
+								V.RESSevent.push("suppository resistance");
 							}
 						}
-						if (State.variables.cockFeeder !== 0) {
+						if (V.cockFeeder !== 0) {
 							if (eventSlave.fetish !== "cumslut") {
-								State.variables.RESSevent.push("cockfeeder resistance");
+								V.RESSevent.push("cockfeeder resistance");
 							}
 						}
 					}
@@ -946,23 +946,23 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 			if (eventSlave.relationship <= -2) {
 				if (eventSlave.trust > 50) {
 					if (eventSlave.devotion > 50) {
-						State.variables.RESSevent.push("bonded love");
+						V.RESSevent.push("bonded love");
 					}
 				}
 			}
 
 			if (eventSlave.trust > 20) {
 				if (eventSlave.devotion > 50) {
-					State.variables.RESSevent.push("objectifying visit");
+					V.RESSevent.push("objectifying visit");
 				}
 			}
 
 			if (canWalk(eventSlave)) {
 				if (eventSlave.devotion > 20) {
 					if (eventSlave.trust > -10) {
-						if (eventSlave.ID !== State.variables.HeadGirl.ID) {
-							if (eventSlave.ID !== State.variables.Concubine.ID) {
-								State.variables.RESSevent.push("refreshment delivery");
+						if (eventSlave.ID !== V.HeadGirl.ID) {
+							if (eventSlave.ID !== V.Concubine.ID) {
+								V.RESSevent.push("refreshment delivery");
 							}
 						}
 					}
@@ -976,7 +976,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 							if (eventSlave.trust > 50) {
 								if (canDoAnal(eventSlave) || canDoVaginal(eventSlave)) {
 									if (eventSlave.belly < 100000) {
-										State.variables.RESSevent.push("dick wringing");
+										V.RESSevent.push("dick wringing");
 									}
 								}
 							}
@@ -992,7 +992,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 							if (eventSlave.energy > 50) {
 								if (eventSlave.energy < 95) {
 									if (eventSlave.devotion >= -20 || eventSlave.trust < -20) {
-										State.variables.RESSevent.push("cage relief");
+										V.RESSevent.push("cage relief");
 									}
 								}
 							}
@@ -1001,13 +1001,13 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				}
 			}
 
-			if (State.variables.PC.dick > 0) {
-				if (State.variables.PC.boobs >= 300) {
+			if (V.PC.dick > 0) {
+				if (V.PC.boobs >= 300) {
 					if (canSee(eventSlave)) {
 						if (eventSlave.devotion <= 50) {
 							if (eventSlave.devotion >= -20) {
 								if (((eventSlave.attrXY <= 35) && (eventSlave.attrXX > 65)) || ((eventSlave.attrXX <= 35) && (eventSlave.attrXY > 65))) {
-									State.variables.RESSevent.push("dickgirl PC");
+									V.RESSevent.push("dickgirl PC");
 								}
 							}
 						}
@@ -1022,7 +1022,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 							if (eventSlave.devotion <= 50) {
 								if (eventSlave.trust > -10) {
 									if (eventSlave.devotion >= -20 || eventSlave.trust < -20) {
-										State.variables.RESSevent.push("language lesson");
+										V.RESSevent.push("language lesson");
 									}
 								}
 							}
@@ -1035,7 +1035,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				if (eventSlave.trust >= -75) {
 					if (eventSlave.devotion <= 30) {
 						if (eventSlave.devotion >= -20) {
-							State.variables.RESSevent.push("like me");
+							V.RESSevent.push("like me");
 						}
 					}
 				}
@@ -1045,7 +1045,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				if (eventSlave.boobsImplant === 0) {
 					if (eventSlave.nipples !== "tiny" && eventSlave.nipples !== "fuckable") {
 						if (eventSlave.devotion > 20) {
-							State.variables.RESSevent.push("huge naturals");
+							V.RESSevent.push("huge naturals");
 						}
 					}
 				}
@@ -1054,7 +1054,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 			if (eventSlave.boobs > 800) {
 				if (Math.floor(eventSlave.boobsImplant / eventSlave.boobs) >= 0.60) {
 					if (eventSlave.devotion > 20) {
-						State.variables.RESSevent.push("implant inspection");
+						V.RESSevent.push("implant inspection");
 					}
 				}
 			}
@@ -1062,7 +1062,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 			if (eventSlave.devotion < -20) {
 				if (eventSlave.trust >= -20) {
 					if (eventSlave.clothes === "uncomfortable straps") {
-						State.variables.RESSevent.push("bondage gear");
+						V.RESSevent.push("bondage gear");
 					}
 				}
 			}
@@ -1072,7 +1072,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 					if (eventSlave.belly < 10000) {
 						if (eventSlave.devotion > 20) {
 							if (eventSlave.trust > 20) {
-								State.variables.RESSevent.push("inconvenient labia");
+								V.RESSevent.push("inconvenient labia");
 							}
 						}
 					}
@@ -1082,16 +1082,16 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 			if (eventSlave.devotion > 20 || eventSlave.trust < -20) {
 				if (eventSlave.addict > 20) {
 					if (eventSlave.aphrodisiacs > 0 || eventSlave.inflationType === "aphrodisiac") {
-						State.variables.RESSevent.push("obedient addict");
+						V.RESSevent.push("obedient addict");
 					}
 				}
 			}
 
 			if (eventSlave.devotion < -50) {
 				if (eventSlave.trust >= -50) {
-					if (eventSlave.assignment !== "stay confined") {
+					if (eventSlave.assignment !== Job.CONFINEMENT) {
 						if (eventSlave.heels !== 1) {
-							State.variables.RESSevent.push("escapee");
+							V.RESSevent.push("escapee");
 						}
 					}
 				}
@@ -1101,7 +1101,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				if (eventSlave.trust >= -50) {
 					if (eventSlave.behavioralFlaw === "gluttonous") {
 						if (eventSlave.diet === "restricted") {
-							State.variables.RESSevent.push("diet");
+							V.RESSevent.push("diet");
 						}
 					}
 				}
@@ -1109,7 +1109,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 
 			if (eventSlave.devotion <= 20) {
 				if (eventSlave.devotion >= -50) {
-					State.variables.RESSevent.push("resistant shower");
+					V.RESSevent.push("resistant shower");
 				}
 			}
 
@@ -1119,7 +1119,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 						if (eventSlave.energy > 75) {
 							if (eventSlave.fetish !== "buttslut") {
 								if (eventSlave.vagina !== 0 || eventSlave.anus !== 0) {
-									State.variables.RESSevent.push("night visit");
+									V.RESSevent.push("night visit");
 								}
 							}
 						}
@@ -1132,13 +1132,13 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 					if (eventSlave.devotion <= 95) {
 						if (eventSlave.trust >= -20) {
 							if ((eventSlave.chastityPenis !== 1) || (eventSlave.dick === 0)) {
-								State.variables.RESSevent.push("forbidden masturbation");
+								V.RESSevent.push("forbidden masturbation");
 							}
 						}
 					}
 					if (eventSlave.devotion >= -20) {
 						if (eventSlave.trust >= -50) {
-							State.variables.RESSevent.push("desperately horny");
+							V.RESSevent.push("desperately horny");
 						}
 					}
 				}
@@ -1146,14 +1146,14 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 
 			if (App.Utils.hasFamilySex(eventSlave) || eventSlave.rules.release.slaves === 1) {
 				if (canPenetrate(eventSlave)) {
-					State.variables.RESSevent.push("slave dick on slave");
+					V.RESSevent.push("slave dick on slave");
 				}
 			}
 
 			if (eventSlave.devotion >= -20) {
 				if (eventSlave.lactation > 1) {
 					if (canDoVaginal(eventSlave) || canDoAnal(eventSlave)) {
-						State.variables.RESSevent.push("milkgasm");
+						V.RESSevent.push("milkgasm");
 					}
 				}
 			}
@@ -1163,7 +1163,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 					if (eventSlave.trust >= -20) {
 						if (eventSlave.belly < 30000) {
 							if (eventSlave.weight <= 95) {
-								State.variables.RESSevent.push("devoted waist");
+								V.RESSevent.push("devoted waist");
 							}
 						}
 					}
@@ -1172,16 +1172,16 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 
 			if (eventSlave.skill.entertainment >= 100) {
 				if (eventSlave.trust > 50) {
-					if (eventSlave.assignment === "serve the public") {
-						State.variables.RESSevent.push("masterful entertainer");
+					if (eventSlave.assignment === Job.PUBLIC) {
+						V.RESSevent.push("masterful entertainer");
 					}
 				}
 			}
 
 			if (eventSlave.skill.whoring >= 100) {
 				if (eventSlave.trust > 50) {
-					if (eventSlave.assignment === "whore") {
-						State.variables.RESSevent.push("masterful whore");
+					if (eventSlave.assignment === Job.WHORE) {
+						V.RESSevent.push("masterful whore");
 					}
 				}
 			}
@@ -1193,7 +1193,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 							if (eventSlave.trust < -50) {
 								if (eventSlave.anus > 0) {
 									if (canDoAnal(eventSlave)) {
-										State.variables.RESSevent.push("resistant gelding");
+										V.RESSevent.push("resistant gelding");
 									}
 								}
 							}
@@ -1202,10 +1202,10 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				}
 			}
 
-			if (State.variables.seePreg !== 0) {
+			if (V.seePreg !== 0) {
 				if (isFertile(eventSlave)) {
 					if (eventSlave.devotion > 50) {
-						if (State.variables.PC.dick !== 0) {
+						if (V.PC.dick !== 0) {
 							if (eventSlave.fetish === "pregnancy" || eventSlave.energy > 95) {
 								if (eventSlave.eggType === "human") {
 									if (eventSlave.fetishKnown === 1) {
@@ -1213,10 +1213,10 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 											if (eventSlave.anus > 0) {
 												if (eventSlave.geneticQuirks.superfetation === 2 && (eventSlave.intelligence + eventSlave.intelligenceImplant > 15) && eventSlave.womb.length > 0) {
 													if (eventSlave.belly < (eventSlave.pregAdaptation * 1750)) {
-														State.variables.RESSevent.push("impregnation please");
+														V.RESSevent.push("impregnation please");
 													}
 												} else {
-													State.variables.RESSevent.push("impregnation please");
+													V.RESSevent.push("impregnation please");
 												}
 											}
 										}
@@ -1229,33 +1229,33 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 			}
 
 			if (["huge plug", "large plug", "long, huge plug", "long, large plug"].includes(eventSlave.buttplug)) {
-				if (eventSlave.assignment !== "stay confined" && isSlaveAvailable(eventSlave)) {
+				if (eventSlave.assignment !== Job.CONFINEMENT && isSlaveAvailable(eventSlave)) {
 					if (eventSlave.devotion <= 20) {
 						if (eventSlave.trust >= -50) {
 							if (eventSlave.anus < 3) {
-								State.variables.RESSevent.push("plug disobedience");
+								V.RESSevent.push("plug disobedience");
 							}
 						}
 					}
 				}
 			}
 
-			if (["serve the public", "whore"].includes(eventSlave.assignment)) {
+			if ([Job.PUBLIC, Job.WHORE].includes(eventSlave.assignment)) {
 				if (eventSlave.vagina !== 0) {
 					if (eventSlave.anus !== 0) {
 						if (canDoAnal(eventSlave)) {
 							if (eventSlave.devotion <= 50) {
-								State.variables.RESSevent.push("used whore");
+								V.RESSevent.push("used whore");
 							}
 						}
 					}
 				}
 			}
 
-			if (eventSlave.assignment === "serve the public") {
+			if (eventSlave.assignment === Job.PUBLIC) {
 				if (eventSlave.devotion >= -20) {
 					if (canDoAnal(eventSlave) || canDoVaginal(eventSlave)) {
-						State.variables.RESSevent.push("nice guys");
+						V.RESSevent.push("nice guys");
 					}
 				}
 			}
@@ -1265,7 +1265,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 					if (canDoAnal(eventSlave)) {
 						if (eventSlave.devotion > 20) {
 							if (eventSlave.trust <= 95) {
-								State.variables.RESSevent.push("devoted shortstack");
+								V.RESSevent.push("devoted shortstack");
 							}
 						}
 					}
@@ -1279,35 +1279,35 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 					if (eventSlave.lipsImplant >= 30) {
 						if (eventSlave.buttImplant > 3) {
 							if (eventSlave.boobs < 9000 || eventSlave.butt < 8) {
-								State.variables.RESSevent.push("surgery addict");
+								V.RESSevent.push("surgery addict");
 							}
 						}
 					}
 				}
 			}
 
-			if (["be your Concubine", "please you", "serve in the master suite"].includes(eventSlave.assignment)) {
+			if ([Job.CONCUBINE, Job.FUCKTOY, Job.MASTERSUITE].includes(eventSlave.assignment)) {
 				if (eventSlave.devotion > 20) {
 					if (eventSlave.trust >= -20) {
 						if (canDoAnal(eventSlave) || canDoVaginal(eventSlave)) {
 							if ((eventSlave.chastityPenis !== 1) || (eventSlave.dick === 0)) {
-								if (State.variables.corp.Incorporated !== 0) {
-									State.variables.RESSevent.push("shift sleep");
+								if (V.corp.Incorporated !== 0) {
+									V.RESSevent.push("shift sleep");
 								}
 								if (canWalk(eventSlave)) {
 									if (eventSlave.rules.release.masturbation === 1) {
-										State.variables.RESSevent.push("shift masturbation");
+										V.RESSevent.push("shift masturbation");
 									}
 								}
 								if (eventSlave.skill.entertainment >= 60) {
-									State.variables.RESSevent.push("shift doorframe");
+									V.RESSevent.push("shift doorframe");
 								}
 							}
 							if (canDoVaginal(eventSlave)) {
-								if (State.variables.PC.vagina > -1) {
+								if (V.PC.vagina > -1) {
 									if (eventSlave.dick === 0) {
-										if (State.variables.fuckSlaves > 2) {
-											State.variables.RESSevent.push("fucktoy tribbing");
+										if (V.fuckSlaves > 2) {
+											V.RESSevent.push("fucktoy tribbing");
 										}
 									}
 								}
@@ -1323,7 +1323,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 						if (eventSlave.vagina !== 0) {
 							if (eventSlave.anus > 0) {
 								if (canDoAnal(eventSlave) || canDoVaginal(eventSlave)) {
-									State.variables.RESSevent.push("millenary");
+									V.RESSevent.push("millenary");
 								}
 							}
 						}
@@ -1331,16 +1331,16 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				}
 			}
 
-			if (eventSlave.assignment === "stay confined") {
+			if (eventSlave.assignment === Job.CONFINEMENT) {
 				if (eventSlave.devotion <= 50) {
-					State.variables.RESSevent.push("solitary desperation");
+					V.RESSevent.push("solitary desperation");
 				}
 			}
 
 			if (eventSlave.rules.speech === "restrictive") {
 				if (eventSlave.devotion > 60) {
 					if (eventSlave.trust >= -20) {
-						State.variables.RESSevent.push("restricted profession");
+						V.RESSevent.push("restricted profession");
 					}
 				}
 			}
@@ -1349,20 +1349,20 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				if (eventSlave.intelligence > 15) {
 					if (eventSlave.trust >= -20) {
 						if (eventSlave.devotion <= 20) {
-							State.variables.RESSevent.push("restricted smart");
+							V.RESSevent.push("restricted smart");
 						}
 					}
 				}
 			}
 
-			if (State.variables.expansionRequestsAllowed > 0) {
+			if (V.expansionRequestsAllowed > 0) {
 				if (eventSlave.drugs === "no drugs") {
 					if (eventSlave.rules.speech === "permissive") {
 						if (eventSlave.health.condition > 20) {
 							if (eventSlave.devotion >= -20) {
 								if (eventSlave.trust > 20) {
-									if (State.variables.arcologies[0].FSSlimnessEnthusiast === "unset") {
-										State.variables.RESSevent.push("injections please");
+									if (V.arcologies[0].FSSlimnessEnthusiast === "unset") {
+										V.RESSevent.push("injections please");
 									}
 								}
 							}
@@ -1371,10 +1371,10 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				}
 			}
 
-			if (eventSlave.assignment === "serve the public") {
+			if (eventSlave.assignment === Job.PUBLIC) {
 				if (canDoAnal(eventSlave) || canDoVaginal(eventSlave)) {
 					if (eventSlave.devotion > 50) {
-						State.variables.RESSevent.push("serve the public devoted");
+						V.RESSevent.push("serve the public devoted");
 					}
 				}
 			}
@@ -1383,18 +1383,18 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				if (canSee(eventSlave)) {
 					if (eventSlave.devotion > 20) {
 						if (eventSlave.trust >= -20) {
-							State.variables.RESSevent.push("obedient bitchy");
+							V.RESSevent.push("obedient bitchy");
 						}
 					}
 				}
 			}
 		} /* closes mute exempt */
 
-		if (State.variables.cockFeeder === 0) {
+		if (V.cockFeeder === 0) {
 			if (eventSlave.intelligence + eventSlave.intelligenceImplant < -50) {
 				if (eventSlave.devotion <= 50) {
 					if (eventSlave.devotion >= -20 || eventSlave.trust < -20) {
-						State.variables.RESSevent.push("obedient idiot");
+						V.RESSevent.push("obedient idiot");
 					}
 				}
 			}
@@ -1402,16 +1402,16 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 
 		if (eventSlave.boobs > 25000) {
 			if (eventSlave.belly < 100000) {
-				State.variables.RESSevent.push("tittymonster inspection");
+				V.RESSevent.push("tittymonster inspection");
 			}
 		}
 
-		if (State.variables.assistant > 1) {
+		if (V.assistant > 1) {
 			if (eventSlave.fetishKnown === 1) {
 				if (eventSlave.energy > 95) {
 					if (eventSlave.devotion > 20) {
 						if (eventSlave.rules.release.masturbation === 1) {
-							State.variables.RESSevent.push("nympho with assistant");
+							V.RESSevent.push("nympho with assistant");
 						}
 					}
 				}
@@ -1420,22 +1420,22 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 
 		if (eventSlave.devotion > 50) {
 			if (eventSlave.trust > 50) {
-				if (["be your Concubine", "please you", "serve in the master suite"].includes(eventSlave.assignment)) {
-					State.variables.RESSevent.push("bed snuggle");
+				if ([Job.CONCUBINE, Job.FUCKTOY, Job.MASTERSUITE].includes(eventSlave.assignment)) {
+					V.RESSevent.push("bed snuggle");
 				}
 			}
 		}
 
 		if (eventSlave.minorInjury === "sore ass") {
 			if (eventSlave.devotion <= 50) {
-				State.variables.RESSevent.push("sore ass");
+				V.RESSevent.push("sore ass");
 			}
 		}
 
 		if (eventSlave.sexualFlaw === "hates oral") {
-			if (State.variables.PC.dick !== 0) {
+			if (V.PC.dick !== 0) {
 				if (eventSlave.devotion <= 50) {
-					State.variables.RESSevent.push("hates oral");
+					V.RESSevent.push("hates oral");
 				}
 			}
 		}
@@ -1445,7 +1445,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				if (eventSlave.devotion > 50) {
 					if (eventSlave.trust > 20) {
 						if (eventSlave.rules.speech !== "restrictive") {
-							State.variables.RESSevent.push("devoted virgin");
+							V.RESSevent.push("devoted virgin");
 						}
 					}
 				}
@@ -1455,20 +1455,20 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 				if (eventSlave.devotion > 50) {
 					if (eventSlave.trust > 20) {
 						if (eventSlave.rules.speech !== "restrictive") {
-							State.variables.RESSevent.push("devoted anal virgin");
+							V.RESSevent.push("devoted anal virgin");
 						}
 					}
 				}
 			}
 		}
 
-		if (State.variables.seeExtreme === 1) {
+		if (V.seeExtreme === 1) {
 			if (eventSlave.balls > 1) {
 				if (eventSlave.scrotum > 0) {
 					if (eventSlave.devotion <= 20) {
 						if (eventSlave.trust <= 20) {
 							if (eventSlave.rules.speech !== "restrictive") {
-								State.variables.RESSevent.push("fearful balls");
+								V.RESSevent.push("fearful balls");
 							}
 						}
 					}
@@ -1477,15 +1477,15 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 		}
 
 		if (eventSlave.devotion <= 50) {
-			if (eventSlave.assignment === "work as a servant" || eventSlave.assignment === "be a servant") {
-				State.variables.RESSevent.push("scrubbing");
+			if (eventSlave.assignment === Job.QUARTER || eventSlave.assignment === Job.HOUSE) {
+				V.RESSevent.push("scrubbing");
 			}
 		}
 
 		if (eventSlave.devotion <= 20) {
-			if (eventSlave.assignment === "work as a servant" || eventSlave.assignment === "be a servant") {
+			if (eventSlave.assignment === Job.QUARTER || eventSlave.assignment === Job.HOUSE) {
 				if (eventSlave.clothes === "a slutty maid outfit" || eventSlave.clothes === "a nice maid outfit") {
-					State.variables.RESSevent.push("servant maid");
+					V.RESSevent.push("servant maid");
 				}
 			}
 		}
@@ -1496,7 +1496,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 					if (eventSlave.vagina === 0) {
 						if (eventSlave.anus !== 0) {
 							if (eventSlave.counter.oral + eventSlave.counter.vaginal + eventSlave.counter.anal > 100) {
-								State.variables.RESSevent.push("unhappy virgin");
+								V.RESSevent.push("unhappy virgin");
 							}
 						}
 					}
@@ -1506,13 +1506,13 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 
 		if (eventSlave.aphrodisiacs > 1 || eventSlave.inflationType === "aphrodisiac") {
 			if (eventSlave.rules.speech === "restrictive" && eventSlave.rules.release.master === 1 && App.Utils.releaseRestricted(eventSlave)) {
-				State.variables.RESSevent.push("extreme aphrodisiacs");
+				V.RESSevent.push("extreme aphrodisiacs");
 			}
 		}
 
 		if (App.Utils.hasFamilySex(eventSlave) || eventSlave.rules.release.slaves === 1) {
 			if (eventSlave.clit > 2) {
-				State.variables.RESSevent.push("slave clit on slave");
+				V.RESSevent.push("slave clit on slave");
 			}
 		}
 
@@ -1522,7 +1522,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 					if (canAchieveErection(eventSlave)) {
 						if (eventSlave.belly < 10000) {
 							if (eventSlave.chastityPenis !== 1) {
-								State.variables.RESSevent.push("slave dick huge");
+								V.RESSevent.push("slave dick huge");
 							}
 						}
 					}
@@ -1533,7 +1533,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 		if (eventSlave.heels === 1) {
 			if (eventSlave.shoes === "heels" || eventSlave.shoes === "extreme heels") {
 				if (canDoAnal(eventSlave) || canDoVaginal(eventSlave)) {
-					State.variables.RESSevent.push("heels");
+					V.RESSevent.push("heels");
 				}
 			}
 		}
@@ -1545,7 +1545,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 						if (eventSlave.fetish !== "none") {
 							if (canHold(eventSlave)) {
 								if (canDoAnal(eventSlave)) {
-									State.variables.RESSevent.push("loose buttslut");
+									V.RESSevent.push("loose buttslut");
 								}
 							}
 						}
@@ -1554,10 +1554,10 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 			}
 		}
 
-		if (eventSlave.assignment === "whore") {
+		if (eventSlave.assignment === Job.WHORE) {
 			if (canDoAnal(eventSlave) && (eventSlave.vagina < 0 || canDoVaginal(eventSlave))) {
 				if (eventSlave.devotion < -20 && eventSlave.trust >= -20) {
-					State.variables.RESSevent.push("whore rebellious");
+					V.RESSevent.push("whore rebellious");
 				}
 			}
 		}
@@ -1565,11 +1565,11 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 		if (isAmputee(eventSlave)) {
 			if (eventSlave.devotion > 20) {
 				if (eventSlave.anus > 0 && canDoAnal(eventSlave)) {
-					State.variables.RESSevent.push("devoted amp");
+					V.RESSevent.push("devoted amp");
 				}
 			}
-			if (eventSlave.assignment === "rest") {
-				State.variables.RESSevent.push("resting amp");
+			if (eventSlave.assignment === Job.REST) {
+				V.RESSevent.push("resting amp");
 			}
 		}
 
@@ -1580,7 +1580,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 						if (eventSlave.devotion > 20 && eventSlave.trust >= -20) {
 							if (eventSlave.weight <= 10) {
 								if (eventSlave.muscles <= 30) {
-									State.variables.RESSevent.push("obedient girlish");
+									V.RESSevent.push("obedient girlish");
 								}
 							}
 						}
@@ -1592,7 +1592,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 		if (eventSlave.boobs > 1200) {
 			if (eventSlave.areolaeShape !== "circle") {
 				if (eventSlave.devotion > 50) {
-					State.variables.RESSevent.push("shaped areolae");
+					V.RESSevent.push("shaped areolae");
 				}
 			}
 		}
@@ -1600,14 +1600,14 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 		if (eventSlave.behavioralFlaw === "arrogant") {
 			if (eventSlave.devotion < -50) {
 				if (eventSlave.trust >= -50) {
-					State.variables.RESSevent.push("rebellious arrogant");
+					V.RESSevent.push("rebellious arrogant");
 				}
 			}
 		}
 
-		if (State.variables.seePreg !== 0) {
+		if (V.seePreg !== 0) {
 			if (eventSlave.bellyPreg >= 10000) {
-				State.variables.RESSevent.push("hugely pregnant");
+				V.RESSevent.push("hugely pregnant");
 			}
 		}
 
@@ -1618,7 +1618,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 						if (eventSlave.devotion <= 50) {
 							if (eventSlave.fetish !== "buttslut") {
 								if (eventSlave.rules.speech === "permissive") {
-									State.variables.RESSevent.push("hormone dysfunction");
+									V.RESSevent.push("hormone dysfunction");
 								}
 							}
 						}
@@ -1633,7 +1633,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 					if (eventSlave.devotion > 20 || eventSlave.trust < -20) {
 						if (eventSlave.devotion <= 50) {
 							if (canDoAnal(eventSlave) || canDoVaginal(eventSlave)) {
-								State.variables.RESSevent.push("heavy piercing");
+								V.RESSevent.push("heavy piercing");
 							}
 						}
 					}
@@ -1643,10 +1643,10 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 
 		if (eventSlave.fetishKnown === 1) {
 			if (eventSlave.fetish === "cumslut" || eventSlave.energy > 95) {
-				if (["serve the public", "whore", "work a glory hole"].includes(eventSlave.assignment)) {
+				if ([Job.PUBLIC, Job.WHORE, Job.GLORYHOLE].includes(eventSlave.assignment)) {
 					if (eventSlave.devotion > 20) {
-						if (State.variables.PC.dick !== 0) {
-							State.variables.RESSevent.push("cumslut whore");
+						if (V.PC.dick !== 0) {
+							V.RESSevent.push("cumslut whore");
 						}
 					}
 				}
@@ -1656,21 +1656,21 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 		if (eventSlave.anus === 0) {
 			if (eventSlave.devotion < -20) {
 				if (eventSlave.trust >= -20) {
-					State.variables.RESSevent.push("resistant anal virgin");
+					V.RESSevent.push("resistant anal virgin");
 				}
 			}
 		}
 
-		if (State.variables.PC.dick !== 0) {
+		if (V.PC.dick !== 0) {
 			if (eventSlave.bellyPreg >= 300000) {
-				State.variables.RESSevent.push("hyperpreg stuck");
+				V.RESSevent.push("hyperpreg stuck");
 			}
 		}
 
 		if (eventSlave.devotion >= 50) {
 			if (eventSlave.trust <= 20) {
 				if (canWalk(eventSlave)) {
-					State.variables.RESSevent.push("devoted fearful slave");
+					V.RESSevent.push("devoted fearful slave");
 				}
 			}
 		}
@@ -1679,21 +1679,21 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 			if (eventSlave.devotion > 50) {
 				if (eventSlave.trust > 50) {
 					if (eventSlave.skill.entertainment >= 100) {
-						if (eventSlave.assignment === "serve the public") {
-							State.variables.events.push("RE legendary entertainer");
+						if (eventSlave.assignment === Job.PUBLIC) {
+							V.events.push("RE legendary entertainer");
 						}
 					}
 
 					if (eventSlave.skill.whoring >= 100) {
-						if (eventSlave.assignment === "whore") {
-							State.variables.events.push("RE legendary whore");
+						if (eventSlave.assignment === Job.WHORE) {
+							V.events.push("RE legendary whore");
 						}
 					}
 
 					if (eventSlave.lactation > 0) {
 						if ((eventSlave.boobs - eventSlave.boobsImplant) > 6000) {
-							if (eventSlave.assignment === "get milked") {
-								State.variables.events.push("RE legendary cow");
+							if (eventSlave.assignment === Job.MILKED) {
+								V.events.push("RE legendary cow");
 							}
 						}
 					}
@@ -1701,9 +1701,9 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 					if (eventSlave.bellyPreg >= 14000) {
 						if (eventSlave.broodmother === 0) {
 							if (eventSlave.counter.births > 10) {
-								if (eventSlave.assignment === "whore" || eventSlave.assignment === "serve the public") {
+								if (eventSlave.assignment === Job.WHORE || eventSlave.assignment === Job.PUBLIC) {
 									if (!isAmputee(eventSlave)) {
-										State.variables.events.push("RE legendary womb");
+										V.events.push("RE legendary womb");
 									}
 								}
 							}
@@ -1712,15 +1712,15 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 
 					if (eventSlave.balls > 6) {
 						if (eventSlave.dick > 6) {
-							if (eventSlave.assignment === "get milked") {
-								State.variables.events.push("RE legendary balls");
+							if (eventSlave.assignment === Job.MILKED) {
+								V.events.push("RE legendary balls");
 							}
 						}
 					}
 
 					if (eventSlave.origin === "You sentenced $him to enslavement as a punishment for attempted theft of a slave." || eventSlave.origin === "$He is an enslaved Daughter of Liberty." || eventSlave.origin === "You got $him at the Slave Shelter. $He is an enslaved Daughter of Liberty, caught some weeks after the failed coup. $His previous owner used $him as a punching bag and dart board, then when he was bored of $him tattooed obscenities all over $his body and threw $him away." || eventSlave.origin === "$He is an enslaved member of an anti-slavery extremist group." || eventSlave.career === "an antislavery activist") {
-						if (eventSlave.devotion > 95 && eventSlave.assignment === "please you") {
-							State.variables.events.push("RE former abolitionist");
+						if (eventSlave.devotion > 95 && eventSlave.assignment === Job.FUCKTOY) {
+							V.events.push("RE former abolitionist");
 						}
 					}
 				}
@@ -1730,7 +1730,7 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 		if (eventSlave.relationship === 4) {
 			if (eventSlave.devotion > 20) {
 				if (eventSlave.trust > 20) {
-					State.variables.events.push("RE slave marriage");
+					V.events.push("RE slave marriage");
 				}
 			}
 		}
@@ -1746,12 +1746,12 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 
 		/* NICKNAME EVENTS */
 
-		if (State.variables.nicknamesAllowed === 1) {
+		if (V.nicknamesAllowed === 1) {
 			let toSearch = eventSlave.slaveName.toLowerCase();
 			if (!toSearch.includes("'")) {
-				if (State.variables.week - eventSlave.weekAcquired >= 4) {
-					State.variables.events.push("RE nickname");
-					State.variables.seed = 0;
+				if (V.week - eventSlave.weekAcquired >= 4) {
+					V.events.push("RE nickname");
+					V.seed = 0;
 				}
 			} /* closes nickname check */
 		} /* closes no nicknames option */
@@ -1759,26 +1759,26 @@ globalThis.generateRandomEventPoolStandard = function(eventSlave) {
 
 	if (eventSlave.fetish === "mindbroken") {
 		if (canWalk(eventSlave)) {
-			State.variables.RESSevent.push("mindbroken morning");
+			V.RESSevent.push("mindbroken morning");
 		}
 		if (eventSlave.kindness !== undefined && eventSlave.kindness >= 100) {
-			if ((isSlaveAvailable(eventSlave) && canWalk(eventSlave)) || (["be your Concubine", "please you", "serve in the master suite"].includes(eventSlave.assignment))) {
+			if ((isSlaveAvailable(eventSlave) && canWalk(eventSlave)) || ([Job.CONCUBINE, Job.FUCKTOY, Job.MASTERSUITE].includes(eventSlave.assignment))) {
 				if (eventSlave.relationship === -3) {
 					if (jsRandom(1, 200) < eventSlave.kindness || V.cheatMode) {
-						State.variables.RESSevent.push("surprising wakeup");
+						V.RESSevent.push("surprising wakeup");
 					}
 				}
 			}
 		}
-		if (eventSlave.career === "a breeding bull" && canImpreg(V.PC, eventSlave) && eventSlave.assignment === "serve in the master suite" && canPenetrate(eventSlave) && eventSlave.dick >= 5 && hasAllLimbs(eventSlave) && V.PC.vagina > -1 && V.PC.preg === 0 && (eventSlave.muscles > 30 || eventSlave.weight > 30)) {
-			State.variables.RESSevent.push("breeding bull");
-			if (State.variables.PC.fertDrugs > 0) {
-				State.variables.RESSevent.push("breeding bull");
-				State.variables.RESSevent.push("breeding bull");
+		if (eventSlave.career === "a breeding bull" && canImpreg(V.PC, eventSlave) && eventSlave.assignment === Job.MASTERSUITE && canPenetrate(eventSlave) && eventSlave.dick >= 5 && hasAllLimbs(eventSlave) && V.PC.vagina > -1 && V.PC.preg === 0 && (eventSlave.muscles > 30 || eventSlave.weight > 30)) {
+			V.RESSevent.push("breeding bull");
+			if (V.PC.fertDrugs > 0) {
+				V.RESSevent.push("breeding bull");
+				V.RESSevent.push("breeding bull");
 			}
-			if (State.variables.PC.forcedFertDrugs > 0) {
-				State.variables.RESSevent.push("breeding bull");
-				State.variables.RESSevent.push("breeding bull");
+			if (V.PC.forcedFertDrugs > 0) {
+				V.RESSevent.push("breeding bull");
+				V.RESSevent.push("breeding bull");
 			}
 		}
 	}
@@ -1794,22 +1794,22 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 	if (eventSlave.fetish !== "mindbroken") {
 		if (hasAnyArms(eventSlave) && hasAnyLegs(eventSlave)) {
 			if (canTalk(eventSlave)) {
-				if (State.variables.RECockmilkInterceptionIDs.length > 1 || (State.variables.RECockmilkInterceptionIDs.length === 1 && eventSlave.ID !== State.variables.RECockmilkInterceptionIDs[0])) {
+				if (V.RECockmilkInterceptionIDs.length > 1 || (V.RECockmilkInterceptionIDs.length === 1 && eventSlave.ID !== V.RECockmilkInterceptionIDs[0])) {
 					if (eventSlave.devotion > 20) {
 						if (eventSlave.dietCum > 0 || (eventSlave.fetishKnown && eventSlave.fetish === "cumslut")) {
-							State.variables.RETSevent.push("cockmilk interception");
+							V.RETSevent.push("cockmilk interception");
 						}
 					}
 				}
 
-				if (State.variables.REInterslaveBeggingIDs.length > 1 || (State.variables.REInterslaveBeggingIDs.length === 1 && eventSlave.ID !== State.variables.REInterslaveBeggingIDs[0])) {
-					if (State.variables.universalRulesConsent === 1) {
+				if (V.REInterslaveBeggingIDs.length > 1 || (V.REInterslaveBeggingIDs.length === 1 && eventSlave.ID !== V.REInterslaveBeggingIDs[0])) {
+					if (V.universalRulesConsent === 1) {
 						if (eventSlave.devotion > 20) {
 							if (eventSlave.energy > 40) {
 								if (canPenetrate(eventSlave)) {
 									if (canSee(eventSlave)) {
 										if (eventSlave.rules.release.slaves === 1) {
-											State.variables.RETSevent.push("interslave begging");
+											V.RETSevent.push("interslave begging");
 										}
 									}
 								}
@@ -1818,7 +1818,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 					}
 				}
 
-				if (State.variables.seeIncest === 1) {
+				if (V.seeIncest === 1) {
 					if (eventSlave.devotion > 20) {
 						if (eventSlave.sexualQuirk === "perverted" || eventSlave.energy > 80) {
 							if (eventSlave.belly < 100000) {
@@ -1826,7 +1826,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 									if (eventSlave.nipples !== "fuckable") {
 										if (eventSlave.rules.release.family === 1) {
 											if (eventSlave.daughters > 0) {
-												State.variables.RETSevent.push("incestuous nursing");
+												V.RETSevent.push("incestuous nursing");
 											}
 										}
 									}
@@ -1836,13 +1836,13 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 					}
 				}
 
-				if (State.variables.assistant > 0) {
-					if (State.variables.assistant.appearance !== "normal") {
+				if (V.assistant > 0) {
+					if (V.assistant.appearance !== "normal") {
 						if (eventSlave.devotion >= -20) {
 							if (canSee(eventSlave)) {
 								if (eventSlave.devotion <= 50) {
 									if (canDoAnal(eventSlave) || canDoVaginal(eventSlave)) {
-										State.variables.RESSevent.push("PA servant");
+										V.RESSevent.push("PA servant");
 									}
 								}
 							}
@@ -1850,23 +1850,23 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 					}
 				}
 
-				if (State.variables.HeadGirl !== 0) {
+				if (V.HeadGirl !== 0) {
 					if (eventSlave.devotion <= 50) {
 						if (eventSlave.anus !== 0 && canDoAnal(eventSlave)) {
-							if (State.variables.HGSeverity >= 0) {
-								State.variables.events.push("RE anal punishment");
+							if (V.HGSeverity >= 0) {
+								V.events.push("RE anal punishment");
 							}
-							State.variables.events.push("RE shower punishment");
+							V.events.push("RE shower punishment");
 						}
 					}
 				}
 
-				if (State.variables.RETasteTestSubIDs.length > 1) {
+				if (V.RETasteTestSubIDs.length > 1) {
 					if (eventSlave.rules.living === "luxurious") {
 						if (eventSlave.devotion > 20) {
 							if (eventSlave.energy > 80) {
 								if (canTaste(eventSlave)) {
-									State.variables.RETSevent.push("taste test");
+									V.RETSevent.push("taste test");
 								}
 							}
 						}
@@ -1874,7 +1874,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 				}
 
 				if (eventSlave.relationship > 3) {
-					let relationshipSlave = State.variables.slaves.find(s => s.ID === eventSlave.relationshipTarget);
+					let relationshipSlave = V.slaves.find(s => s.ID === eventSlave.relationshipTarget);
 					if (relationshipSlave.devotion > 20) {
 						if (canWalk(relationshipSlave)) {
 							if (canTalk(relationshipSlave)) {
@@ -1884,7 +1884,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 											if (relationshipSlave.dick !== 1) {
 												if (relationshipSlave.dick === 0 || canAchieveErection(relationshipSlave)) {
 													if (relationshipSlave.fetish === "dom" || relationshipSlave.fetish === "sadist") {
-														State.variables.RETSevent.push("top exhaustion");
+														V.RETSevent.push("top exhaustion");
 													}
 												}
 											}
@@ -1896,12 +1896,12 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 					}
 				}
 
-				if (State.variables.weatherToday.severity <= 1) {
+				if (V.weatherToday.severity <= 1) {
 					if (eventSlave.trust > 50) {
 						if (eventSlave.devotion > 20) {
 							if (eventSlave.anus !== 0 && canDoAnal(eventSlave)) {
 								if (eventSlave.vagina !== 0) {
-									State.variables.RESSevent.push("confident tanning");
+									V.RESSevent.push("confident tanning");
 								}
 							}
 						}
@@ -1911,13 +1911,13 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 				if (eventSlave.devotion > 50) {
 					if (eventSlave.trust > 50) {
 						let giver = 0;
-						if (State.variables.HeadGirl === 0) {
+						if (V.HeadGirl === 0) {
 							giver = 1;
-						} else if (State.variables.HeadGirl.ID !== eventSlave.ID) {
+						} else if (V.HeadGirl.ID !== eventSlave.ID) {
 							giver = 1;
 						}
 						if (giver === 1) {
-							State.variables.RESSevent.push("a gift");
+							V.RESSevent.push("a gift");
 						}
 					}
 				}
@@ -1926,7 +1926,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 					if (eventSlave.anus > 0) {
 						if (eventSlave.vagina !== 0) {
 							if (eventSlave.trust > 20) {
-								State.variables.RESSevent.push("devoted lotion");
+								V.RESSevent.push("devoted lotion");
 							}
 						}
 					}
@@ -1934,65 +1934,65 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 
 				if (eventSlave.devotion <= 95) {
 					if (eventSlave.intelligence + eventSlave.intelligenceImplant < -50) {
-						State.variables.RESSevent.push("cooler lockin");
+						V.RESSevent.push("cooler lockin");
 					}
 				}
 
-				if (State.variables.universalRulesConsent === 0) {
+				if (V.universalRulesConsent === 0) {
 					if (eventSlave.devotion > 50) {
 						if (eventSlave.fetish === "sadist" || eventSlave.fetish === "dom" || eventSlave.energy > 95) {
-							if (State.variables.REShowerForceSubIDs.length > 0) {
+							if (V.REShowerForceSubIDs.length > 0) {
 								if (eventSlave.trust <= 75) {
-									State.variables.RETSevent.push("shower force");
+									V.RETSevent.push("shower force");
 								}
 							}
 							if (eventSlave.anus > 0) {
-								if (State.variables.RESadisticDescriptionSubIDs.length > 0) {
-									State.variables.RETSevent.push("sadistic description");
+								if (V.RESadisticDescriptionSubIDs.length > 0) {
+									V.RETSevent.push("sadistic description");
 								}
 							}
-							if (State.variables.cockFeeder > 0) {
+							if (V.cockFeeder > 0) {
 								if (canPenetrate(eventSlave) || eventSlave.dick === 0) {
-									State.variables.RESSevent.push("kitchen molestation");
+									V.RESSevent.push("kitchen molestation");
 								}
 							}
 						}
-						if (State.variables.REIfYouEnjoyItSubIDs.length > 0) {
-							State.variables.RETSevent.push("if you enjoy it");
+						if (V.REIfYouEnjoyItSubIDs.length > 0) {
+							V.RETSevent.push("if you enjoy it");
 						}
-						if (State.variables.RESimpleAssaultIDs.length > 0) {
+						if (V.RESimpleAssaultIDs.length > 0) {
 							if (canPenetrate(eventSlave)) {
-								State.variables.RETSevent.push("simple assault");
+								V.RETSevent.push("simple assault");
 							}
 						}
 					}
 				}
 
-				if (State.variables.boobAccessibility !== 1 && State.variables.ballsAccessibility !== 1 && State.variables.pregAccessibility !== 1) {
+				if (V.boobAccessibility !== 1 && V.ballsAccessibility !== 1 && V.pregAccessibility !== 1) {
 					if (eventSlave.boobs > 10000) {
 						if (eventSlave.devotion >= -20) {
-							if (State.variables.slaves.length > 2) {
+							if (V.slaves.length > 2) {
 								if (canDoAnal(eventSlave) || canDoVaginal(eventSlave)) {
-									State.variables.RESSevent.push("huge tits");
+									V.RESSevent.push("huge tits");
 								}
 							}
 						}
 					}
 				}
 
-				if (State.variables.seeAge !== 0) {
+				if (V.seeAge !== 0) {
 					if (eventSlave.devotion > 50) {
 						if (eventSlave.rules.speech !== "restrictive") {
 							if (eventSlave.birthWeek >= 51) {
 								/* let's give this a much higher chance of appearing */
-								State.variables.RESSevent.push("birthday");
-								State.variables.RESSevent.push("birthday");
-								State.variables.RESSevent.push("birthday");
-								State.variables.RESSevent.push("birthday");
-								State.variables.RESSevent.push("birthday");
-								State.variables.RESSevent.push("birthday");
-								State.variables.RESSevent.push("birthday");
-								State.variables.RESSevent.push("birthday");
+								V.RESSevent.push("birthday");
+								V.RESSevent.push("birthday");
+								V.RESSevent.push("birthday");
+								V.RESSevent.push("birthday");
+								V.RESSevent.push("birthday");
+								V.RESSevent.push("birthday");
+								V.RESSevent.push("birthday");
+								V.RESSevent.push("birthday");
 							}
 						}
 					}
@@ -2002,17 +2002,17 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 					if (eventSlave.devotion <= 20) {
 						if (eventSlave.trust >= -20) {
 							if (eventSlave.anus > 0 && canDoAnal(eventSlave)) {
-								State.variables.RESSevent.push("not my name");
+								V.RESSevent.push("not my name");
 							}
 						}
 					}
 				}
 
-				if (State.variables.slaves.length > 2) {
+				if (V.slaves.length > 2) {
 					if (eventSlave.devotion >= -20) {
 						if (eventSlave.heels === 1) {
 							if (eventSlave.shoes === "heels" || eventSlave.shoes === "boots" || eventSlave.shoes === "extreme heels") {
-								State.variables.RESSevent.push("tendon fall");
+								V.RESSevent.push("tendon fall");
 							}
 						}
 					}
@@ -2024,7 +2024,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 							if (canDoAnal(eventSlave)) {
 								if (eventSlave.anus > 0) {
 									if (eventSlave.skill.anal <= 30) {
-										State.variables.RESSevent.push("obedient shemale");
+										V.RESSevent.push("obedient shemale");
 									}
 								}
 							}
@@ -2037,7 +2037,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 						if (eventSlave.physicalAge > 37) {
 							if (eventSlave.anus > 0) {
 								if (eventSlave.vagina > 0) {
-									State.variables.RESSevent.push("devoted old");
+									V.RESSevent.push("devoted old");
 								}
 							}
 						}
@@ -2048,8 +2048,8 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 					if (eventSlave.trust > 20) {
 						if (eventSlave.actualAge > 35) {
 							if (canDoAnal(eventSlave) || canDoVaginal(eventSlave)) {
-								if (State.variables.PC.actualAge < 25) {
-									State.variables.RESSevent.push("young PC age difference");
+								if (V.PC.actualAge < 25) {
+									V.RESSevent.push("young PC age difference");
 								}
 							}
 						}
@@ -2060,8 +2060,8 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 					if (eventSlave.trust > 20) {
 						if (eventSlave.actualAge < 22) {
 							if (canDoAnal(eventSlave) || canDoVaginal(eventSlave)) {
-								if (State.variables.PC.actualAge >= 50) {
-									State.variables.RESSevent.push("old PC age difference");
+								if (V.PC.actualAge >= 50) {
+									V.RESSevent.push("old PC age difference");
 								}
 							}
 						}
@@ -2075,7 +2075,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 								if (eventSlave.vagina !== 0) {
 									if (eventSlave.anus !== 0) {
 										if (eventSlave.fetishKnown === 1) {
-											State.variables.RESSevent.push("fearful humiliation");
+											V.RESSevent.push("fearful humiliation");
 										}
 									}
 								}
@@ -2087,29 +2087,29 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 				if (eventSlave.rules.living === "luxurious") {
 					if (eventSlave.devotion <= 75) {
 						if (eventSlave.devotion > 50) {
-							State.variables.RESSevent.push("newly devoted sunrise");
+							V.RESSevent.push("newly devoted sunrise");
 						}
 					}
 				}
 
-				if (State.variables.PC.dick > 0) {
-					if (State.variables.PC.belly < 5000) {
+				if (V.PC.dick > 0) {
+					if (V.PC.belly < 5000) {
 						if (eventSlave.attrXY <= 35 || eventSlave.behavioralFlaw === "hates men" || eventSlave.sexualFlaw === "repressed") {
 							if (eventSlave.devotion >= -20) {
 								if (eventSlave.trust > 20) {
-									State.variables.RESSevent.push("frightening dick");
+									V.RESSevent.push("frightening dick");
 								}
 							}
 						}
 					}
 				}
 
-				if (State.variables.spa > 0) {
+				if (V.spa > 0) {
 					if (eventSlave.boobs > 2000) {
 						if (eventSlave.devotion > 20) {
 							if (eventSlave.trust > 20) {
 								if (canDoAnal(eventSlave) || canDoVaginal(eventSlave)) {
-									State.variables.RESSevent.push("spa boobs");
+									V.RESSevent.push("spa boobs");
 								}
 							}
 						}
@@ -2121,23 +2121,23 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 						if (eventSlave.nipples !== "fuckable") {
 							if (eventSlave.devotion > 20) {
 								if (eventSlave.trust > 20) {
-									State.variables.RESSevent.push("cow milking");
+									V.RESSevent.push("cow milking");
 								}
 							}
 						}
 					}
 				}
 
-				if (State.variables.arcologies[0].FSSubjugationist !== "unset") {
-					if (eventSlave.race !== State.variables.arcologies[0].FSSubjugationistRace) {
-						if (State.variables.week - eventSlave.weekAcquired > 1) {
-							if (State.variables.week - eventSlave.weekAcquired < 10) {
+				if (V.arcologies[0].FSSubjugationist !== "unset") {
+					if (eventSlave.race !== V.arcologies[0].FSSubjugationistRace) {
+						if (V.week - eventSlave.weekAcquired > 1) {
+							if (V.week - eventSlave.weekAcquired < 10) {
 								if (eventSlave.devotion < -20) {
 									if (eventSlave.trust >= -20) {
 										if (eventSlave.health.condition > -20) {
 											if (eventSlave.race === eventSlave.origRace) {
 												if (eventSlave.indentureRestrictions < 1) {
-													State.variables.RESSevent.push("subjugation blues");
+													V.RESSevent.push("subjugation blues");
 												}
 											}
 										}
@@ -2158,7 +2158,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 											if (eventSlave.behavioralFlaw !== "anorexic") {
 												if (eventSlave.sexualFlaw !== "self hating") {
 													if (eventSlave.fetishStrength <= 60 || eventSlave.fetishKnown !== 1) {
-														State.variables.RESSevent.push("too thin for cum diet");
+														V.RESSevent.push("too thin for cum diet");
 													}
 												}
 											}
@@ -2176,7 +2176,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 							if (eventSlave.weight >= -30) {
 								if (eventSlave.trust > 50) {
 									if (eventSlave.devotion > 50) {
-										State.variables.RESSevent.push("passing declaration");
+										V.RESSevent.push("passing declaration");
 									}
 								}
 							}
@@ -2186,11 +2186,11 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 
 				if (eventSlave.fetish === "sadist") {
 					if (eventSlave.fetishStrength > 20) {
-						if (State.variables.ArcadeiIDs.length > 0) {
+						if (App.Entity.facilities.arcade.established) {
 							if (eventSlave.trust >= -20) {
 								if (eventSlave.devotion > 50) {
 									if (eventSlave.belly < 300000) {
-										State.variables.RESSevent.push("arcade sadist");
+										V.RESSevent.push("arcade sadist");
 									}
 								}
 							}
@@ -2198,15 +2198,15 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 					}
 				}
 
-				if (State.variables.PC.vagina > -1) {
+				if (V.PC.vagina > -1) {
 					if (eventSlave.devotion <= 20) {
 						if ((eventSlave.trust >= -20 && eventSlave.behavioralFlaw === "arrogant") || (eventSlave.trust > 20)) {
 							if (eventSlave.muscles > 30) {
 								if (eventSlave.health.condition > 20) {
 									if (eventSlave.energy > 50) {
 										if (canPenetrate(eventSlave)) {
-											if (State.variables.Bodyguard === 0) {
-												State.variables.RESSevent.push("mutinery attempt");
+											if (V.Bodyguard === 0) {
+												V.RESSevent.push("mutinery attempt");
 											}
 										}
 									}
@@ -2219,7 +2219,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 
 			if (eventSlave.devotion > 20) {
 				if (eventSlave.mouthAccessory !== "none") {
-					State.variables.RESSevent.push("gagged slave");
+					V.RESSevent.push("gagged slave");
 				}
 			}
 
@@ -2227,9 +2227,9 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 				if (eventSlave.devotion > 20) {
 					if (eventSlave.energy > 40) {
 						if (eventSlave.belly < 300000) {
-							if (State.variables.PC.belly < 5000 && State.variables.PC.balls < 10) {
+							if (V.PC.belly < 5000 && V.PC.balls < 10) {
 								if (canSee(eventSlave)) {
-									State.variables.RESSevent.push("comfortable seat");
+									V.RESSevent.push("comfortable seat");
 								}
 							}
 						}
@@ -2237,14 +2237,14 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 				}
 			}
 
-			if (State.variables.seeAge === 1) {
+			if (V.seeAge === 1) {
 				if (eventSlave.actualAge < 18) {
 					if (eventSlave.devotion > 20) {
 						if (eventSlave.ovaries === 1) {
 							if (eventSlave.pubertyXX === 0) {
 								if (eventSlave.preg === 0) {
 									if (eventSlave.physicalAge + eventSlave.birthWeek / 52 >= eventSlave.pubertyAgeXX - 0.5) {
-										State.variables.RESSevent.push(...Array.from({length: 10}, () => "first period"));
+										V.RESSevent.push(...Array.from({length: 10}, () => "first period"));
 									}
 								}
 							}
@@ -2253,7 +2253,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 							if (eventSlave.balls > 0) {
 								if (eventSlave.pubertyXY === 0) {
 									if (eventSlave.physicalAge + eventSlave.birthWeek / 52 >= eventSlave.pubertyAgeXY - 0.5) {
-										State.variables.RESSevent.push(...Array.from({length: 10}, () => "wet dreams"));
+										V.RESSevent.push(...Array.from({length: 10}, () => "wet dreams"));
 									}
 								}
 							}
@@ -2265,17 +2265,17 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 
 			if (eventSlave.devotion >= -150) {
 				if (eventSlave.devotion <= 50) {
-					State.variables.events.push("RE standard punishment");
+					V.events.push("RE standard punishment");
 				}
 			}
 
 			if (eventSlave.trust > 20) {
 				if (eventSlave.devotion > 50) {
-					if (State.variables.PC.belly < 5000) {
-						State.variables.RESSevent.push("shower slip");
+					if (V.PC.belly < 5000) {
+						V.RESSevent.push("shower slip");
 					}
 					if (getLimbCount(eventSlave, 102) === 4) {
-						State.variables.RESSevent.push("plimb help");
+						V.RESSevent.push("plimb help");
 					}
 				}
 			}
@@ -2283,14 +2283,14 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 			if (eventSlave.devotion <= 20) {
 				if (eventSlave.devotion >= -50) {
 					if (eventSlave.trust >= -20) {
-						if (State.variables.suppository !== 0) {
+						if (V.suppository !== 0) {
 							if (eventSlave.fetish !== "buttslut") {
-								State.variables.RESSevent.push("suppository resistance");
+								V.RESSevent.push("suppository resistance");
 							}
 						}
-						if (State.variables.cockFeeder !== 0) {
+						if (V.cockFeeder !== 0) {
 							if (eventSlave.fetish !== "cumslut") {
-								State.variables.RESSevent.push("cockfeeder resistance");
+								V.RESSevent.push("cockfeeder resistance");
 							}
 						}
 					}
@@ -2300,23 +2300,23 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 			if (eventSlave.relationship <= -2) {
 				if (eventSlave.trust > 50) {
 					if (eventSlave.devotion > 50) {
-						State.variables.RESSevent.push("bonded love");
+						V.RESSevent.push("bonded love");
 					}
 				}
 			}
 
 			if (eventSlave.trust > 20) {
 				if (eventSlave.devotion > 50) {
-					State.variables.RESSevent.push("objectifying visit");
+					V.RESSevent.push("objectifying visit");
 				}
 			}
 
 			if (canWalk(eventSlave)) {
 				if (eventSlave.devotion > 20) {
 					if (eventSlave.trust > -10) {
-						if (eventSlave.ID !== State.variables.HeadGirl.ID) {
-							if (eventSlave.ID !== State.variables.Concubine.ID) {
-								State.variables.RESSevent.push("refreshment delivery");
+						if (eventSlave.ID !== V.HeadGirl.ID) {
+							if (eventSlave.ID !== V.Concubine.ID) {
+								V.RESSevent.push("refreshment delivery");
 							}
 						}
 					}
@@ -2330,7 +2330,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 							if (eventSlave.trust > 50) {
 								if (canDoAnal(eventSlave) || canDoVaginal(eventSlave)) {
 									if (eventSlave.belly < 100000) {
-										State.variables.RESSevent.push("dick wringing");
+										V.RESSevent.push("dick wringing");
 									}
 								}
 							}
@@ -2346,7 +2346,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 							if (eventSlave.energy > 50) {
 								if (eventSlave.energy < 95) {
 									if (eventSlave.devotion >= -20 || eventSlave.trust < -20) {
-										State.variables.RESSevent.push("cage relief");
+										V.RESSevent.push("cage relief");
 									}
 								}
 							}
@@ -2355,13 +2355,13 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 				}
 			}
 
-			if (State.variables.PC.dick > 0) {
-				if (State.variables.PC.boobs >= 300) {
+			if (V.PC.dick > 0) {
+				if (V.PC.boobs >= 300) {
 					if (canSee(eventSlave)) {
 						if (eventSlave.devotion <= 50) {
 							if (eventSlave.devotion >= -20) {
 								if (((eventSlave.attrXY <= 35) && (eventSlave.attrXX > 65)) || ((eventSlave.attrXX <= 35) && (eventSlave.attrXY > 65))) {
-									State.variables.RESSevent.push("dickgirl PC");
+									V.RESSevent.push("dickgirl PC");
 								}
 							}
 						}
@@ -2373,7 +2373,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 				if (eventSlave.trust >= -75) {
 					if (eventSlave.devotion <= 30) {
 						if (eventSlave.devotion >= -20) {
-							State.variables.RESSevent.push("like me");
+							V.RESSevent.push("like me");
 						}
 					}
 				}
@@ -2382,7 +2382,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 			if (eventSlave.devotion < -20) {
 				if (eventSlave.trust >= -20) {
 					if (eventSlave.clothes === "uncomfortable straps") {
-						State.variables.RESSevent.push("bondage gear");
+						V.RESSevent.push("bondage gear");
 					}
 				}
 			}
@@ -2392,7 +2392,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 					if (eventSlave.belly < 10000) {
 						if (eventSlave.devotion > 20) {
 							if (eventSlave.trust > 20) {
-								State.variables.RESSevent.push("inconvenient labia");
+								V.RESSevent.push("inconvenient labia");
 							}
 						}
 					}
@@ -2402,7 +2402,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 			if (eventSlave.devotion > 20 || eventSlave.trust < -20) {
 				if (eventSlave.addict > 20) {
 					if (eventSlave.aphrodisiacs > 0 || eventSlave.inflationType === "aphrodisiac") {
-						State.variables.RESSevent.push("obedient addict");
+						V.RESSevent.push("obedient addict");
 					}
 				}
 			}
@@ -2410,7 +2410,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 			if (eventSlave.devotion < -50) {
 				if (eventSlave.trust >= -50) {
 					if (eventSlave.heels !== 1) {
-						State.variables.RESSevent.push("escapee");
+						V.RESSevent.push("escapee");
 					}
 				}
 			}
@@ -2419,7 +2419,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 				if (eventSlave.trust >= -50) {
 					if (eventSlave.behavioralFlaw === "gluttonous") {
 						if (eventSlave.diet === "restricted") {
-							State.variables.RESSevent.push("diet");
+							V.RESSevent.push("diet");
 						}
 					}
 				}
@@ -2427,7 +2427,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 
 			if (eventSlave.devotion <= 20) {
 				if (eventSlave.devotion >= -50) {
-					State.variables.RESSevent.push("resistant shower");
+					V.RESSevent.push("resistant shower");
 				}
 			}
 
@@ -2437,7 +2437,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 						if (eventSlave.energy > 75) {
 							if (eventSlave.fetish !== "buttslut") {
 								if (eventSlave.vagina !== 0 || eventSlave.anus !== 0) {
-									State.variables.RESSevent.push("night visit");
+									V.RESSevent.push("night visit");
 								}
 							}
 						}
@@ -2450,13 +2450,13 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 					if (eventSlave.devotion <= 95) {
 						if (eventSlave.trust >= -20) {
 							if ((eventSlave.chastityPenis !== 1) || (eventSlave.dick === 0)) {
-								State.variables.RESSevent.push("forbidden masturbation");
+								V.RESSevent.push("forbidden masturbation");
 							}
 						}
 					}
 					if (eventSlave.devotion >= -20) {
 						if (eventSlave.trust >= -50) {
-							State.variables.RESSevent.push("desperately horny");
+							V.RESSevent.push("desperately horny");
 						}
 					}
 				}
@@ -2464,14 +2464,14 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 
 			if (App.Utils.hasFamilySex(eventSlave) || eventSlave.rules.release.slaves === 1) {
 				if (canPenetrate(eventSlave)) {
-					State.variables.RESSevent.push("slave dick on slave");
+					V.RESSevent.push("slave dick on slave");
 				}
 			}
 
 			if (eventSlave.devotion >= -20) {
 				if (eventSlave.lactation > 1) {
 					if (canDoVaginal(eventSlave) || canDoAnal(eventSlave)) {
-						State.variables.RESSevent.push("milkgasm");
+						V.RESSevent.push("milkgasm");
 					}
 				}
 			}
@@ -2481,7 +2481,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 					if (eventSlave.trust >= -20) {
 						if (eventSlave.belly < 30000) {
 							if (eventSlave.weight <= 95) {
-								State.variables.RESSevent.push("devoted waist");
+								V.RESSevent.push("devoted waist");
 							}
 						}
 					}
@@ -2495,7 +2495,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 							if (eventSlave.trust < -50) {
 								if (eventSlave.anus > 0) {
 									if (canDoAnal(eventSlave)) {
-										State.variables.RESSevent.push("resistant gelding");
+										V.RESSevent.push("resistant gelding");
 									}
 								}
 							}
@@ -2504,10 +2504,10 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 				}
 			}
 
-			if (State.variables.seePreg !== 0) {
+			if (V.seePreg !== 0) {
 				if (isFertile(eventSlave)) {
 					if (eventSlave.devotion > 50) {
-						if (State.variables.PC.dick !== 0) {
+						if (V.PC.dick !== 0) {
 							if (eventSlave.fetish === "pregnancy" || eventSlave.energy > 95) {
 								if (eventSlave.eggType === "human") {
 									if (eventSlave.fetishKnown === 1) {
@@ -2515,10 +2515,10 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 											if (eventSlave.anus > 0) {
 												if (eventSlave.geneticQuirks.superfetation === 2 && (eventSlave.intelligence + eventSlave.intelligenceImplant > 15) && eventSlave.womb.length > 0) {
 													if (eventSlave.belly < (eventSlave.pregAdaptation * 1750)) {
-														State.variables.RESSevent.push("impregnation please");
+														V.RESSevent.push("impregnation please");
 													}
 												} else {
-													State.variables.RESSevent.push("impregnation please");
+													V.RESSevent.push("impregnation please");
 												}
 											}
 										}
@@ -2535,7 +2535,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 					if (eventSlave.devotion <= 20) {
 						if (eventSlave.trust >= -50) {
 							if (eventSlave.anus < 3) {
-								State.variables.RESSevent.push("plug disobedience");
+								V.RESSevent.push("plug disobedience");
 							}
 						}
 					}
@@ -2549,7 +2549,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 					if (eventSlave.lipsImplant >= 30) {
 						if (eventSlave.buttImplant > 3) {
 							if (eventSlave.boobs < 9000 || eventSlave.butt < 8) {
-								State.variables.RESSevent.push("surgery addict");
+								V.RESSevent.push("surgery addict");
 							}
 						}
 					}
@@ -2562,7 +2562,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 						if (eventSlave.vagina !== 0) {
 							if (eventSlave.anus > 0) {
 								if (canDoAnal(eventSlave) || canDoVaginal(eventSlave)) {
-									State.variables.RESSevent.push("millenary");
+									V.RESSevent.push("millenary");
 								}
 							}
 						}
@@ -2570,14 +2570,14 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 				}
 			}
 
-			if (State.variables.expansionRequestsAllowed > 0) {
+			if (V.expansionRequestsAllowed > 0) {
 				if (eventSlave.drugs === "no drugs") {
 					if (eventSlave.rules.speech === "permissive") {
 						if (eventSlave.health.condition > 20) {
 							if (eventSlave.devotion >= -20) {
 								if (eventSlave.trust > 20) {
-									if (State.variables.arcologies[0].FSSlimnessEnthusiast === "unset") {
-										State.variables.RESSevent.push("injections please");
+									if (V.arcologies[0].FSSlimnessEnthusiast === "unset") {
+										V.RESSevent.push("injections please");
 									}
 								}
 							}
@@ -2590,29 +2590,29 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 				if (canSee(eventSlave)) {
 					if (eventSlave.devotion > 20) {
 						if (eventSlave.trust >= -20) {
-							State.variables.RESSevent.push("obedient bitchy");
+							V.RESSevent.push("obedient bitchy");
 						}
 					}
 				}
 			}
 		} /* closes mute exempt */
 
-		if (State.variables.cockFeeder === 0) {
+		if (V.cockFeeder === 0) {
 			if (eventSlave.intelligence + eventSlave.intelligenceImplant < -50) {
 				if (eventSlave.devotion <= 50) {
 					if (eventSlave.devotion >= -20 || eventSlave.trust < -20) {
-						State.variables.RESSevent.push("obedient idiot");
+						V.RESSevent.push("obedient idiot");
 					}
 				}
 			}
 		}
 
-		if (State.variables.assistant > 1) {
+		if (V.assistant > 1) {
 			if (eventSlave.fetishKnown === 1) {
 				if (eventSlave.energy > 95) {
 					if (eventSlave.devotion > 20) {
 						if (eventSlave.rules.release.masturbation === 1) {
-							State.variables.RESSevent.push("nympho with assistant");
+							V.RESSevent.push("nympho with assistant");
 						}
 					}
 				}
@@ -2622,14 +2622,14 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 
 		if (eventSlave.minorInjury === "sore ass") {
 			if (eventSlave.devotion <= 50) {
-				State.variables.RESSevent.push("sore ass");
+				V.RESSevent.push("sore ass");
 			}
 		}
 
 		if (eventSlave.sexualFlaw === "hates oral") {
-			if (State.variables.PC.dick !== 0) {
+			if (V.PC.dick !== 0) {
 				if (eventSlave.devotion <= 50) {
-					State.variables.RESSevent.push("hates oral");
+					V.RESSevent.push("hates oral");
 				}
 			}
 		}
@@ -2639,7 +2639,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 				if (eventSlave.devotion > 50) {
 					if (eventSlave.trust > 20) {
 						if (eventSlave.rules.speech !== "restrictive") {
-							State.variables.RESSevent.push("devoted virgin");
+							V.RESSevent.push("devoted virgin");
 						}
 					}
 				}
@@ -2649,7 +2649,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 				if (eventSlave.devotion > 50) {
 					if (eventSlave.trust > 20) {
 						if (eventSlave.rules.speech !== "restrictive") {
-							State.variables.RESSevent.push("devoted anal virgin");
+							V.RESSevent.push("devoted anal virgin");
 						}
 					}
 				}
@@ -2657,24 +2657,24 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 		}
 
 		if (eventSlave.devotion <= 50) {
-			State.variables.RESSevent.push("scrubbing");
+			V.RESSevent.push("scrubbing");
 		}
 
 		if (eventSlave.devotion <= 20) {
 			if (eventSlave.clothes === "a slutty maid outfit" || eventSlave.clothes === "a nice maid outfit") {
-				State.variables.RESSevent.push("servant maid");
+				V.RESSevent.push("servant maid");
 			}
 		}
 
 		if (eventSlave.aphrodisiacs > 1 || eventSlave.inflationType === "aphrodisiac") {
 			if (eventSlave.rules.speech === "restrictive" && eventSlave.rules.release.master === 1 && App.Utils.releaseRestricted(eventSlave)) {
-				State.variables.RESSevent.push("extreme aphrodisiacs");
+				V.RESSevent.push("extreme aphrodisiacs");
 			}
 		}
 
 		if (App.Utils.hasFamilySex(eventSlave) || eventSlave.rules.release.slaves === 1) {
 			if (eventSlave.clit > 2) {
-				State.variables.RESSevent.push("slave clit on slave");
+				V.RESSevent.push("slave clit on slave");
 			}
 		}
 
@@ -2684,7 +2684,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 					if (canAchieveErection(eventSlave)) {
 						if (eventSlave.belly < 10000) {
 							if (eventSlave.chastityPenis !== 1) {
-								State.variables.RESSevent.push("slave dick huge");
+								V.RESSevent.push("slave dick huge");
 							}
 						}
 					}
@@ -2695,7 +2695,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 		if (eventSlave.heels === 1) {
 			if (eventSlave.shoes === "heels" || eventSlave.shoes === "extreme heels") {
 				if (canDoAnal(eventSlave) || canDoVaginal(eventSlave)) {
-					State.variables.RESSevent.push("heels");
+					V.RESSevent.push("heels");
 				}
 			}
 		}
@@ -2707,7 +2707,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 						if (eventSlave.fetish !== "none") {
 							if (canHold(eventSlave)) {
 								if (canDoAnal(eventSlave)) {
-									State.variables.RESSevent.push("loose buttslut");
+									V.RESSevent.push("loose buttslut");
 								}
 							}
 						}
@@ -2719,14 +2719,14 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 		if (eventSlave.boobs > 1200) {
 			if (eventSlave.areolaeShape !== "circle") {
 				if (eventSlave.devotion > 50) {
-					State.variables.RESSevent.push("shaped areolae");
+					V.RESSevent.push("shaped areolae");
 				}
 			}
 		}
 
-		if (State.variables.seePreg !== 0) {
+		if (V.seePreg !== 0) {
 			if (eventSlave.bellyPreg >= 10000) {
-				State.variables.RESSevent.push("hugely pregnant");
+				V.RESSevent.push("hugely pregnant");
 			}
 		}
 
@@ -2737,7 +2737,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 						if (eventSlave.devotion <= 50) {
 							if (eventSlave.fetish !== "buttslut") {
 								if (eventSlave.rules.speech === "permissive") {
-									State.variables.RESSevent.push("hormone dysfunction");
+									V.RESSevent.push("hormone dysfunction");
 								}
 							}
 						}
@@ -2752,7 +2752,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 					if (eventSlave.devotion > 20 || eventSlave.trust < -20) {
 						if (eventSlave.devotion <= 50) {
 							if (canDoAnal(eventSlave) || canDoVaginal(eventSlave)) {
-								State.variables.RESSevent.push("heavy piercing");
+								V.RESSevent.push("heavy piercing");
 							}
 						}
 					}
@@ -2763,21 +2763,21 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 		if (eventSlave.anus === 0) {
 			if (eventSlave.devotion < -20) {
 				if (eventSlave.trust >= -20) {
-					State.variables.RESSevent.push("resistant anal virgin");
+					V.RESSevent.push("resistant anal virgin");
 				}
 			}
 		}
 
-		if (State.variables.PC.dick !== 0) {
+		if (V.PC.dick !== 0) {
 			if (eventSlave.bellyPreg >= 300000) {
-				State.variables.RESSevent.push("hyperpreg stuck");
+				V.RESSevent.push("hyperpreg stuck");
 			}
 		}
 
 		if (eventSlave.devotion >= 50) {
 			if (eventSlave.trust <= 20) {
 				if (canWalk(eventSlave)) {
-					State.variables.RESSevent.push("devoted fearful slave");
+					V.RESSevent.push("devoted fearful slave");
 				}
 			}
 		}
@@ -2785,7 +2785,7 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 		if (eventSlave.relationship === 4) {
 			if (eventSlave.devotion > 20) {
 				if (eventSlave.trust > 20) {
-					State.variables.events.push("RE slave marriage");
+					V.events.push("RE slave marriage");
 				}
 			}
 		}
@@ -2801,12 +2801,12 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 
 		/* NICKNAME EVENTS */
 
-		if (State.variables.nicknamesAllowed === 1) {
+		if (V.nicknamesAllowed === 1) {
 			let toSearch = eventSlave.slaveName.toLowerCase();
 			if (!toSearch.includes("'")) {
-				if (State.variables.week - eventSlave.weekAcquired >= 4) {
-					State.variables.events.push("RE nickname");
-					State.variables.seed = 0;
+				if (V.week - eventSlave.weekAcquired >= 4) {
+					V.events.push("RE nickname");
+					V.seed = 0;
 				}
 			} /* closes nickname check */
 		} /* closes no nicknames option */
@@ -2814,14 +2814,14 @@ globalThis.generateRandomEventPoolServant = function(eventSlave) {
 
 	if (eventSlave.fetish === "mindbroken") {
 		if (canWalk(eventSlave)) {
-			State.variables.RESSevent.push("mindbroken morning");
+			V.RESSevent.push("mindbroken morning");
 		}
 	}
 };
 
-globalThis.populateEventArray = function(RESS = State.variables.RESSevent.length, RESSTR = State.variables.RESSTRevent.length, RETS = State.variables.RETSevent.length, RECI = State.variables.RECIevent.length) {
+globalThis.populateEventArray = function(RESS = V.RESSevent.length, RESSTR = V.RESSTRevent.length, RETS = V.RETSevent.length, RECI = V.RECIevent.length) {
 	/* EVENT RANDOMIZATION */
-	let events = State.variables.events;
+	let events = V.events;
 	let i = 0;
 
 	for (i = 0; i < RESS; i++) {
diff --git a/src/js/extendedFamilyModeJS.js b/src/js/extendedFamilyModeJS.js
index 8fcf7cf52901e4cd877118569def6aae9b477e16..c467ec7bcb5b56fab5970e9e910ba256e1a11444 100644
--- a/src/js/extendedFamilyModeJS.js
+++ b/src/js/extendedFamilyModeJS.js
@@ -141,7 +141,7 @@ globalThis.specificMom = function(slave) {
  * @returns {boolean}
  */
 globalThis.isAunt = function(niece, aunt) {
-	if (!State.variables.showDistantRelatives) {
+	if (!V.showDistantRelatives) {
 		return false;
 	}
 
@@ -208,7 +208,7 @@ globalThis.areSisters = function(slave1, slave2) {
  * @returns {boolean}
  */
 globalThis.areCousins = function(slave1, slave2) {
-	if (!State.variables.showDistantRelatives) {
+	if (!V.showDistantRelatives) {
 		return false;
 	}
 
diff --git a/src/js/facilityUINaming.js b/src/js/facilityUINaming.js
deleted file mode 100644
index 890755833a6db80f8162fc274b287049844e3d95..0000000000000000000000000000000000000000
--- a/src/js/facilityUINaming.js
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * @returns {string}
- */
-globalThis.masterSuiteUIName = function() {
-	return V.masterSuiteNameCaps === "The Master Suite" ? "Master Suite" : V.masterSuiteNameCaps;
-};
-
-/**
- * @returns {string}
- */
-globalThis.headGirlSuiteUIName = function() {
-	return V.HGSuiteNameCaps === "The Head Girl Suite" ? "Head Girl Suite" : V.HGSuiteNameCaps;
-};
-
-/**
- * @returns {string}
- */
-globalThis.servantQuartersUIName = function() {
-	return V.servantsQuartersNameCaps === "The Servants' Quarters" ? "Servants' Quarters" : V.servantsQuartersNameCaps;
-};
-
-/**
- * @returns {string}
- */
-globalThis.spaUIName = function() {
-	return V.spaNameCaps === "The Spa" ? "Spa" : V.spaNameCaps;
-};
-
-/**
- * @returns {string}
- */
-globalThis.nurseryUIName = function() {
-	return V.nurseryNameCaps === "The Nursery" ? "Nursery" : V.nurseryNameCaps;
-};
-
-/**
- * @returns {string}
- */
-globalThis.clinicUIName = function() {
-	return V.clinicNameCaps === "The Clinic" ? "Clinic" : V.clinicNameCaps;
-};
-
-/**
- * @returns {string}
- */
-globalThis.schoolRoomUIName = function() {
-	return V.schoolroomNameCaps === "The Schoolroom" ? "Schoolroom" : V.schoolroomNameCaps;
-};
-
-/**
- * @returns {string}
- */
-globalThis.cellblockUIName = function() {
-	return V.cellblockNameCaps === "The Cellblock" ? "Cellblock" : V.cellblockNameCaps;
-};
-
-/**
- * @returns {string}
- */
-globalThis.incubatorUIName = function() {
-	return V.incubatorNameCaps === "The Incubator" ? "Incubator" : V.incubatorNameCaps;
-};
-
-/**
- * @returns {string}
- */
-globalThis.clubUIName = function() {
-	return V.clubNameCaps === "The Club" ? "Club" : V.clubNameCaps;
-};
-
-/**
- * @returns {string}
- */
-globalThis.brothelUIName = function() {
-	return V.brothelNameCaps === "The Brothel" ? "Brothel" : V.brothelNameCaps;
-};
-
-/**
- * @returns {string}
- */
-globalThis.pitUIName = function() {
-	return V.pitNameCaps === "The Pit" ? "Pit" : V.pitNameCaps;
-};
-
-/**
- * @returns {string}
- */
-globalThis.arcadeUIName = function() {
-	return V.arcadeNameCaps === "The Arcade" ? "Arcade" : V.arcadeNameCaps;
-};
-
-/**
- * @returns {string}
- */
-globalThis.dairyUIName = function() {
-	return V.dairyNameCaps === "The Dairy" ? "Dairy" : V.dairyNameCaps;
-};
diff --git a/src/js/familyTreeJS.js b/src/js/familyTreeJS.js
index 2cef01d4dc267e810a006f8bce6a68497fb85656..f451441c52dc514fea3110d6fc0548448fcebc6a 100644
--- a/src/js/familyTreeJS.js
+++ b/src/js/familyTreeJS.js
@@ -224,23 +224,23 @@ globalThis.buildFamilyTree = function(slaves, filterID) {
 	let kids = {};
 
 	let fake_pc = {
-		slaveName: `${State.variables.PC.slaveName}(You)`,
-		mother: State.variables.PC.mother,
-		father: State.variables.PC.father,
-		dick: State.variables.PC.dick,
-		vagina: State.variables.PC.vagina,
-		ID: State.variables.PC.ID
+		slaveName: `${V.PC.slaveName}(You)`,
+		mother: V.PC.mother,
+		father: V.PC.father,
+		dick: V.PC.dick,
+		vagina: V.PC.vagina,
+		ID: V.PC.ID
 	};
 	let charList = [fake_pc];
 	charList.push.apply(charList, slaves);
-	charList.push.apply(charList, State.variables.tanks);
+	charList.push.apply(charList, V.tanks);
 
 	let unborn = {};
-	for (let i = 0; i < State.variables.tanks.length; i++) {
-		unborn[State.variables.tanks[i].ID] = true;
+	for (let i = 0; i < V.tanks.length; i++) {
+		unborn[V.tanks[i].ID] = true;
 	}
-	for (let i = 0; i < State.variables.cribs.length; i++) {
-		unborn[State.variables.cribs[i].ID] = true;
+	for (let i = 0; i < V.cribs.length; i++) {
+		unborn[V.cribs[i].ID] = true;
 	}
 
 	for (let i = 0; i < charList.length; i++) {
@@ -268,10 +268,10 @@ globalThis.buildFamilyTree = function(slaves, filterID) {
 		}
 		let mom = character.mother;
 		if (mom < -6) {
-			if (mom in State.variables.missingTable && State.variables.showMissingSlaves) {
+			if (mom in V.missingTable && V.showMissingSlaves) {
 				if (typeof node_lookup[mom] === 'undefined') {
 					node_lookup[mom] = family_graph.nodes.length;
-					let missing = State.variables.missingTable[mom];
+					let missing = V.missingTable[mom];
 					charList.push({
 						ID: mom,
 						mother: 0,
@@ -303,10 +303,10 @@ globalThis.buildFamilyTree = function(slaves, filterID) {
 
 		let dad = character.father;
 		if (dad < -6) {
-			if (dad in State.variables.missingTable && State.variables.showMissingSlaves) {
+			if (dad in V.missingTable && V.showMissingSlaves) {
 				if (typeof node_lookup[dad] === 'undefined') {
 					node_lookup[dad] = family_graph.nodes.length;
-					let missing = State.variables.missingTable[dad];
+					let missing = V.missingTable[dad];
 					charList.push({
 						ID: dad,
 						mother: 0,
diff --git a/src/js/futureSocietyJS.js b/src/js/futureSocietyJS.js
index 683c9aef65c846c6d8f0c22af258e6e0d3efdb21..1acce03ff5659e9377fb997d13b63348d8de1c2c 100644
--- a/src/js/futureSocietyJS.js
+++ b/src/js/futureSocietyJS.js
@@ -261,7 +261,7 @@ globalThis.FutureSocieties = (function() {
 	/* call as FutureSocieties.ChangePorn() */
 	/* FSString should be in the FSString2Property object above */
 	function FSChangePorn(FSString, magnitude) {
-		return FSChange(FSString, magnitude, State.variables.pornFameBonus);
+		return FSChange(FSString, magnitude, V.pornFameBonus);
 	}
 
 	/**
@@ -269,7 +269,7 @@ globalThis.FutureSocieties = (function() {
 	 * @returns {number}
 	 */
 	function FSHighestDecoration() {
-		const arcology = State.variables.arcologies[0];
+		const arcology = V.arcologies[0];
 		const decorationList = SocietyList.map(FS => `${FS}Decoration`);
 		let level = 20; // All decorations start at 20
 
diff --git a/src/js/generateRelatedSlave.js b/src/js/generateRelatedSlave.js
index 4707f55d938e4cf5e7b59d8062357c9a592b89af..b901cb77e300a50f1f021ed5bd8bc064b2ce9415 100644
--- a/src/js/generateRelatedSlave.js
+++ b/src/js/generateRelatedSlave.js
@@ -328,7 +328,7 @@ globalThis.generateRelatedSlave = (function() {
 		}
 
 		/* if we've reduced breast size because of age, reapply minimum weight modifiers */
-		if (origBoobs > slave.boobs && State.variables.weightAffectsAssets !== 0) {
+		if (origBoobs > slave.boobs && V.weightAffectsAssets !== 0) {
 			if (slave.weight > 190) {
 				slave.boobs += 300;
 			} else if (slave.weight > 160) {
diff --git a/src/js/health.js b/src/js/health.js
index bc874f9cda6ebaed76ba90db1f0dba1158416518..824a1a3376aab8d9b4c8d17c84319d9dafe83abc 100644
--- a/src/js/health.js
+++ b/src/js/health.js
@@ -7,7 +7,7 @@
 globalThis.healthPenalty = function(slave) {
 	const H = slave.health;
 	let penalty = 100;
-	if (slave.assignment !== "work a glory hole") {
+	if (slave.assignment !== Job.GLORYHOLE) {
 		if (H.illness > 0) {
 			penalty *= (100 - Math.min((Math.pow(H.illness, 2) * 5 + 5), 95)) / 100;
 		}
@@ -60,7 +60,7 @@ globalThis.healthCure = function(slave, cure) {
  * @returns {void}
  */
 globalThis.surgeryDamage = function(slave, damage) {
-	const playerSkillFactor = 1 + Math.clamp(Math.pow(State.variables.PC.skill.medicine / 100, 2), 0, 1);
+	const playerSkillFactor = 1 + Math.clamp(Math.pow(V.PC.skill.medicine / 100, 2), 0, 1);
 	healthDamage(slave, Math.trunc(damage / playerSkillFactor));
 };
 
diff --git a/src/js/main.js b/src/js/main.js
index 983005dedc82567bb276bc5cd30e95c7f331f43e..e65ab93f01e88162c8087e8b24104f8c0d9e0978 100644
--- a/src/js/main.js
+++ b/src/js/main.js
@@ -84,7 +84,7 @@ App.MainView.fcnn = function() {
 App.MainView.useFucktoys = function() {
 	const fragment = document.createDocumentFragment();
 	for (const slave of V.slaves) {
-		if (slave.assignment !== "please you") {
+		if (slave.assignment !== Job.FUCKTOY) {
 			continue;
 		}
 		fragment.append(App.MainView.useFucktoy(slave));
diff --git a/src/js/pregJS.js b/src/js/pregJS.js
index 7020d4edc56737f81f8b6163fc32f43c4d08f02a..39d567cde31dcd49e6c25b1b4319d4480907a95e 100644
--- a/src/js/pregJS.js
+++ b/src/js/pregJS.js
@@ -144,10 +144,10 @@ globalThis.setPregType = function(actor) {
 				if (actor.diet === "fertility") {
 					fertilityStack += 0.3;
 				}
-				if (State.variables.masterSuitePregnancyFertilitySupplements === 1 && ((actor.assignment === "serve in the master suite" || actor.assignment === "be your Concubine"))) {
+				if (V.masterSuitePregnancyFertilitySupplements === 1 && ((actor.assignment === Job.MASTERSUITE || actor.assignment === Job.CONCUBINE))) {
 					fertilityStack += 0.5;
 				}
-				if (State.variables.reproductionFormula === 1 && (State.variables.week - actor.weekAcquired > 0)) {
+				if (V.reproductionFormula === 1 && (V.week - actor.weekAcquired > 0)) {
 					fertilityStack += 0.2;
 				}
 				if (actor.drugs === "super fertility drugs") {
@@ -156,7 +156,7 @@ globalThis.setPregType = function(actor) {
 					fertilityStack += 0.6;
 				}
 				fertilityStack = Math.floor(fertilityStack);
-				if (State.variables.seeHyperPreg === 1) {
+				if (V.seeHyperPreg === 1) {
 					if (actor.drugs === "super fertility drugs") {
 						ovum += jsRandom(0, fertilityStack * 2);
 					} else {
@@ -206,12 +206,12 @@ globalThis.setPregType = function(actor) {
 					ovum += jsEither([0, 0, 0, 0, 0, 0, 0, 0, 1]);
 					fertilityStack++;
 				}
-				if (State.variables.masterSuitePregnancyFertilitySupplements === 1 && ((actor.assignment === "serve in the master suite" || actor.assignment === "be your Concubine"))) {
+				if (V.masterSuitePregnancyFertilitySupplements === 1 && ((actor.assignment === Job.MASTERSUITE || actor.assignment === Job.CONCUBINE))) {
 					ovum += jsEither([0, 0, 0, 1, 1, 2, 2, 2, 3, 3]);
 					fertilityStack++;
 					fertilityStack++;
 				}
-				if (State.variables.reproductionFormula === 1 && (State.variables.week - actor.weekAcquired > 0)) {
+				if (V.reproductionFormula === 1 && (V.week - actor.weekAcquired > 0)) {
 					fertilityStack++;
 				}
 				if (actor.drugs === "super fertility drugs") {
@@ -225,7 +225,7 @@ globalThis.setPregType = function(actor) {
 					ovum += jsEither([0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3]);
 					fertilityStack++;
 				}
-				if (State.variables.seeHyperPreg === 1) {
+				if (V.seeHyperPreg === 1) {
 					if (actor.drugs === "super fertility drugs") {
 						ovum += jsRandom(0, fertilityStack * 2);
 					} else {
@@ -272,11 +272,11 @@ globalThis.setPregType = function(actor) {
 					ovum += jsRandom(4, 10);
 					fertilityStack += 6;
 				}
-				if (State.variables.masterSuitePregnancyFertilitySupplements === 1 && ((actor.assignment === "serve in the master suite" || actor.assignment === "be your Concubine"))) {
+				if (V.masterSuitePregnancyFertilitySupplements === 1 && ((actor.assignment === Job.MASTERSUITE || actor.assignment === Job.CONCUBINE))) {
 					ovum += jsRandom(8, 16);
 					fertilityStack += 10;
 				}
-				if (State.variables.reproductionFormula === 1 && (State.variables.week - actor.weekAcquired > 0)) {
+				if (V.reproductionFormula === 1 && (V.week - actor.weekAcquired > 0)) {
 					fertilityStack += 2;
 				}
 				if (actor.drugs === "super fertility drugs") {
@@ -286,7 +286,7 @@ globalThis.setPregType = function(actor) {
 					ovum += jsRandom(10, 20);
 					fertilityStack += 16;
 				}
-				if (State.variables.seeHyperPreg === 1) {
+				if (V.seeHyperPreg === 1) {
 					if (actor.drugs === "super fertility drugs") {
 						ovum += jsRandom(fertilityStack / 2, fertilityStack * 2);
 					} else {
@@ -339,12 +339,12 @@ globalThis.setPregType = function(actor) {
 					ovum += jsEither([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]);
 					fertilityStack++;
 				}
-				if (State.variables.masterSuitePregnancyFertilitySupplements === 1 && ((actor.assignment === "serve in the master suite" || actor.assignment === "be your Concubine"))) {
+				if (V.masterSuitePregnancyFertilitySupplements === 1 && ((actor.assignment === Job.MASTERSUITE || actor.assignment === Job.CONCUBINE))) {
 					ovum += jsEither([0, 0, 0, 1, 1, 2, 2, 2, 3, 3]);
 					fertilityStack++;
 					fertilityStack++;
 				}
-				if (State.variables.reproductionFormula === 1 && (State.variables.week - actor.weekAcquired > 0)) {
+				if (V.reproductionFormula === 1 && (V.week - actor.weekAcquired > 0)) {
 					fertilityStack++;
 				}
 				if (actor.drugs === "super fertility drugs") {
@@ -358,7 +358,7 @@ globalThis.setPregType = function(actor) {
 					ovum += jsEither([0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3]);
 					fertilityStack++;
 				}
-				if (State.variables.seeHyperPreg === 1) {
+				if (V.seeHyperPreg === 1) {
 					if (actor.drugs === "super fertility drugs") {
 						ovum += jsRandom(0, fertilityStack * 2);
 					} else {
@@ -386,7 +386,7 @@ globalThis.setPregType = function(actor) {
 		let ftvol = FetusGetPrediction(actor, actor.pregData.normalBirth);
 		let cmvol = ftvol * actor.womb.length;
 		let maxvol = actor.pregAdaptation*2000;
-		if (State.variables.seeHyperPreg === 0) {
+		if (V.seeHyperPreg === 0) {
 			maxvol /= 10; // without hyperpreg enabled it's limited to be roughly ten times smaller.
 		}
 		let freevol = maxvol - cmvol;
@@ -394,7 +394,7 @@ globalThis.setPregType = function(actor) {
 
 		if (coeff < 0) { coeff = 0; }
 
-		if (State.variables.seeHyperPreg !== 0) {
+		if (V.seeHyperPreg !== 0) {
 			coeff += jsRandom(0, fertilityStack/2); // this second chance for implantation. Should be affected only by chemical and genetic for easier implantation. Not directly related to ova count, only to body/womb condition. Raise successful implantation chance with already overfull womb. AFTER previous check.
 		}
 
diff --git a/src/js/quickListJS.js b/src/js/quickListJS.js
index 55d77886b3cf0d507cade41176153eea71680385..7a5f3757026d8e74fea6f426244fbb77d1ec4c0c 100644
--- a/src/js/quickListJS.js
+++ b/src/js/quickListJS.js
@@ -71,7 +71,7 @@ globalThis.sortIncubatorPossiblesByReservedSpots = function() {
 };
 
 globalThis.sortIncubatorPossiblesByPreviousSort = function() {
-	let sort = State.variables.sortIncubatorList;
+	let sort = V.sortIncubatorList;
 	if (sort !== 'unsorted') {
 		if (sort === 'Name') {
 			sortIncubatorPossiblesByName();
@@ -110,7 +110,7 @@ globalThis.sortNurseryPossiblesByReservedSpots = function() {
 };
 
 globalThis.sortNurseryPossiblesByPreviousSort = function() {
-	let sort = State.variables.sortNurseryList;
+	let sort = V.sortNurseryList;
 	if (sort !== 'unsorted') {
 		if (sort === 'Name') {
 			sortNurseryPossiblesByName();
diff --git a/src/js/removeActiveSlave.js b/src/js/removeActiveSlave.js
index 96ff072885d60422f1cd9c7db8f5d83587b9b322..6cecd81599ac51d47aca9c44f156914f2c609500 100644
--- a/src/js/removeActiveSlave.js
+++ b/src/js/removeActiveSlave.js
@@ -235,7 +235,7 @@ globalThis.removeActiveSlave = function() {
 		removeSlave(INDEX);
 		LENGTH--;
 		V.activeSlave = 0;
-		V.JobIDArray = resetJobIDArray(); /* need to call this once more to update count of resting slaves*/
+		V.JobIDMap = makeJobIdMap(); /* need to call this once more to update count of resting slaves*/
 	}
 };
 /**
@@ -276,7 +276,7 @@ globalThis.removeNonNGPSlave = function(removedSlave) {
 
 	if (INDEX >= 0 && INDEX < LENGTH) {
 		V.slaves.forEach(slave => {
-			if (slave.assignment === "be imported") {
+			if (slave.assignment === this.Job.IMPORTED) {
 				WombChangeID(slave, ID, V.missingParentID); /* This check is complex, should be done in JS now, all needed will be done here. */
 				WombChangeGeneID(slave, ID, V.missingParentID);
 				if (slave.pregSource === V.missingParentID) {
diff --git a/src/js/rulesAssistant.js b/src/js/rulesAssistant.js
index 60b8f258a82b3a7610e9e03eb6ec41d4c71d3446..20623049ed540e3d35afd9dbe3034a8a8b53485c 100644
--- a/src/js/rulesAssistant.js
+++ b/src/js/rulesAssistant.js
@@ -94,48 +94,7 @@ globalThis.RAFacilityRemove = function(slave, rule) {
 	let r = "";
 	if (!rule.facilityRemove) { return r; }
 	if (slave.assignment === rule.setAssignment) {
-		let facilityName;
-		switch (rule.setAssignment) {
-			case "be confined in the arcade":
-				facilityName = V.arcadeName;
-				break;
-			case "work in the brothel":
-				facilityName = V.brothelName;
-				break;
-			case "serve in the club":
-				facilityName = V.clubName;
-				break;
-			case "work in the dairy":
-				facilityName = V.dairyName;
-				break;
-			case "work as farmhand":
-				facilityName = V.farmyardName;
-				break;
-			case "rest in the spa":
-				facilityName = V.spaName;
-				break;
-			case "work as a nanny":
-				facilityName = V.nurseryName;
-				break;
-			case "get treatment in the clinic":
-				facilityName = V.clinicName;
-				break;
-			case "serve in the master suite":
-				facilityName = V.masterSuiteName;
-				break;
-			case "live with your Head Girl":
-				facilityName = V.HGSuiteName;
-				break;
-			case "work as a servant":
-				facilityName = V.servantsQuartersName;
-				break;
-			case "learn in the schoolroom":
-				facilityName = V.schoolroomName;
-				break;
-			case "be confined in the cellblock":
-				facilityName = V.cellblockName;
-				break;
-		}
+		const  facilityName = App.Utils.jobForAssignment(rule.setAssignment).facility.name;
 		r += `<br>${slave.slaveName} has been removed from ${facilityName} and has been assigned to ${rule.removalAssignment}.`;
 		assignJob(slave, rule.removalAssignment);
 	}
@@ -326,7 +285,7 @@ App.RA.newRule = function() {
 			setAssignment: null,
 			pitRules: null,
 			facilityRemove: false,
-			removalAssignment: "rest",
+			removalAssignment: Job.REST,
 			surgery: emptySurgery(),
 			underArmHColor: null,
 			underArmHStyle: null,
@@ -409,7 +368,7 @@ globalThis.emptyDefaultRule = App.RA.newRule.rule;
 globalThis.RulesDeconfliction = function(slave) {
 	const before = clone(slave);
 	DefaultRules(slave);
-	State.variables.slaveAfterRA = clone(slave);
+	V.slaveAfterRA = clone(slave);
 	slave = before;
 };
 
diff --git a/src/js/rulesAssistantOptions.js b/src/js/rulesAssistantOptions.js
index af35326512a842f6cb9d7845337d7be85c21d4c4..68863ea0200b4645f1f59e2c27fae27ac04efa76 100644
--- a/src/js/rulesAssistantOptions.js
+++ b/src/js/rulesAssistantOptions.js
@@ -4091,55 +4091,22 @@ globalThis.rulesAssistantOptions = (function() {
 
 	class AutomaticAssignmentList extends ListSelector {
 		constructor() {
-			const items = [
-				["Rest", "rest"],
-				["Fucktoy", "please you"],
-				["Subordinate Slave", "be a subordinate slave"],
-				["House Servant", "be a servant"],
-				["Confined", "stay confined"],
-				["Whore", "whore"],
-				["Public Servant", "serve the public"],
-				["Classes", "take classes"],
-				["Milked", "get milked"],
-				["Gloryhole", "work a glory hole"],
-				["Choose Her Own", "choose her own job"]
-			];
-
-			if (V.HGSuite > 0) {
-				items.push(["Head Girl Suite", "live with your Head Girl"]);
-			}
-			if (V.brothel > 0) {
-				items.push(["Brothel", "work in the brothel"]);
-			}
-			if (V.club > 0) {
-				items.push(["Club", "serve in the club"]);
-			}
-			if (V.arcade > 0) {
-				items.push(["Arcade", "be confined in the arcade"]);
-			}
-			if (V.dairy > 0) {
-				items.push(["Dairy", "work in the dairy"]);
-			}
-			if (V.farmyard > 0) {
-				items.push(["Farmyard", "work as a farmhand"]);
-			}
-			if (V.servantsQuarters > 0) {
-				items.push(["Servant Quarters", "work as a servant"]);
-			}
-			if (V.masterSuite > 0) {
-				items.push(["Master Suite", "serve in the master suite"]);
-			}
-			if (V.schoolroom > 0) {
-				items.push(["Schoolroom", "learn in the schoolroom"]);
-			}
-			if (V.spa > 0) {
-				items.push(["Spa", "rest in the spa"]);
-			}
-			if (V.clinic > 0) {
-				items.push(["Clinic", "get treatment in the clinic"]);
-			}
-			if (V.cellblock > 0) {
-				items.push(["Cellblock", "be confined in the cellblock"]);
+			const items = [];
+			const penthouseDesc = App.Data.Facilities.penthouse;
+			for (const jn in penthouseDesc.jobs) {
+				/** @type {App.Data.JobDesc} */
+				const jd = penthouseDesc.jobs[jn];
+				items.push([jd.position, jd.assignment]);
+			}
+
+			const penthouse = App.Entity.facilities.penthouse;
+			/** @type {Object.<string, App.Entity.Facilities.Facility>} */
+			const facilities = App.Entity.facilities;
+			const facilitiesToSkip = [penthouse, facilities.pit, facilities.armory, facilities.arcologyAgent];
+			for (const fn in facilities) {
+				const f = facilities[fn];
+				if (facilitiesToSkip.includes(f)) { continue; }
+				items.push([f.name, f.job().desc.assignment]);
 			}
 
 			super("Automatically set assignment", items);
diff --git a/src/js/slaveGenerationJS.js b/src/js/slaveGenerationJS.js
index 59d8bff58ad784a0716ef853b06c3bbbc5441b01..d48bafc181e9b08b80317d5dbe1dbd313d548bfb 100644
--- a/src/js/slaveGenerationJS.js
+++ b/src/js/slaveGenerationJS.js
@@ -1526,7 +1526,7 @@ globalThis.BaseSlave = function() {
 globalThis.generatePronouns = function(slave) {
 	if (slave.fuckdoll > 0) {
 		slave.pronoun = App.Data.Pronouns.Kind.toy;
-	} else if (slave.dick > 0 && slave.vagina === -1 && State.variables.diversePronouns === 1) {
+	} else if (slave.dick > 0 && slave.vagina === -1 && V.diversePronouns === 1) {
 		slave.pronoun = App.Data.Pronouns.Kind.male;
 	} else {
 		slave.pronoun = App.Data.Pronouns.Kind.female;
diff --git a/src/js/slaveListing.js b/src/js/slaveListing.js
index c21b3f7f0832b3ccfd6d1da3646eff15ca64d76b..e5208fd3b3e0ea7c6494343ac7e2e0794cdbf91d 100644
--- a/src/js/slaveListing.js
+++ b/src/js/slaveListing.js
@@ -10,19 +10,18 @@ App.UI.SlaveList = {};
 /**
  * @callback slaveTextGenerator
  * @param {App.Entity.SlaveState} slave
- * @param {number} index
  * @returns {string}
  */
 
 /**
  * @callback slaveToElement
  * @param {App.Entity.SlaveState} slave
- * @param {number} index
  * @returns {HTMLElement|DocumentFragment}
  */
 
 App.UI.SlaveList.render = function() {
-	'use strict';
+	const facilityPassages = new Set(
+		["Main", "Head Girl Suite", "Spa", "Brothel", "Club", "Arcade", "Clinic", "Schoolroom", "Dairy", "Farmyard", "Servants' Quarters" , "Master Suite", "Cellblock"]);
 
 	/** @type {string} */
 	let passageName;
@@ -43,39 +42,46 @@ App.UI.SlaveList.render = function() {
 	};
 
 	/**
-	 * @param {number[]} indices
-	 * @param {Array.<{index: number, rejects: string[]}>} rejectedSlaves
+	 * @param {number[]} IDs
+	 * @param {Array.<{id: number, rejects: string[]}>} rejectedSlaves
 	 * @param {slaveToElement} interactionLink
 	 * @param {slaveToElement} [postNote]
 	 * @returns {DocumentFragment}
 	 */
-	function listDOM(indices, rejectedSlaves, interactionLink, postNote) {
+	function listDOM(IDs, rejectedSlaves, interactionLink, postNote) {
 		passageName = passage();
 		slaves = V.slaves;
 
 		let res = document.createDocumentFragment();
 
 		if (V.useSlaveListInPageJSNavigation === 1) {
-			res.appendChild(createQuickList(indices));
+			res.appendChild(createQuickList(IDs));
 		}
 
 		const fcs = App.Entity.facilities;
+		const penthouse = fcs.penthouse;
 
-		// can't simply loop over fcs attributes, as there is the penthouse among them, which always exists
-		const anyFacilityExists = fcs.brothel.established || fcs.club.established || fcs.dairy.established || fcs.farmyard.established || fcs.servantsQuarters.established || fcs.masterSuite.established || fcs.spa.established || fcs.clinic + fcs.schoolroom.established || fcs.cellblock.established || fcs.arcade.established || fcs.headGirlSuite.established;
+		let anyFacilityExists = false;
+
+		for (const f of Object.values(fcs)) {
+			if (f !== penthouse && f.established) {
+				anyFacilityExists = true;
+				break;
+			}
+		}
 
 		let showTransfers = false;
 		if (anyFacilityExists) {
-			if (passageName === "Main" || passageName === "Head Girl Suite" || passageName === "Spa" || passageName === "Brothel" || passageName === "Club" || passageName === "Arcade" || passageName === "Clinic" || passageName === "Schoolroom" || passageName === "Dairy" || passageName === "Farmyard" || passageName === "Servants' Quarters" || passageName === "Master Suite" || passageName === "Cellblock") {
+			if (facilityPassages.has(passageName)) {
 				V.returnTo = passageName;
 				showTransfers = true;
 			}
 		}
 
-		for (const _si of indices) {
-			let ss = renderSlave(_si, interactionLink, showTransfers, postNote);
+		for (const _sid of IDs) {
+			let ss = renderSlave(_sid, interactionLink, showTransfers, postNote);
 			let slaveDiv = document.createElement("div");
-			slaveDiv.id = `slave-${slaves[_si].ID}`;
+			slaveDiv.id = `slave-${_sid}`;
 			slaveDiv.classList.add("slaveSummary");
 			if (V.slavePanelStyle === 2) {
 				slaveDiv.classList.add("card");
@@ -85,7 +91,7 @@ App.UI.SlaveList.render = function() {
 		}
 
 		for (const rs of rejectedSlaves) {
-			const slave = slaves[rs.index];
+			const slave = slaveStateById(rs.id);
 			const rejects = rs.rejects;
 			const slaveName = SlaveFullName(slave);
 			let slaveDiv = document.createElement("div");
@@ -110,15 +116,15 @@ App.UI.SlaveList.render = function() {
 	}
 
 	/**
-	 * @param {number[]} indices
-	 * @param {Array.<{index: number, rejects: string[]}>} rejectedSlaves
+	 * @param {number[]} IDs
+	 * @param {Array.<{id: number, rejects: string[]}>} rejectedSlaves
 	 * @param {slaveToElement} interactionLink
 	 * @param {slaveToElement} [postNote]
 	 * @returns {string}
 	 */
-	function listMarkup(indices, rejectedSlaves, interactionLink, postNote) {
+	function listMarkup(IDs, rejectedSlaves, interactionLink, postNote) {
 		const listIDStr = `slave-list-${listID}`;
-		readyResults[listID] = listDOM(indices, rejectedSlaves, interactionLink, postNote);
+		readyResults[listID] = listDOM(IDs, rejectedSlaves, interactionLink, postNote);
 
 		$(document).one(':passagedisplay', function() {
 			for (const e of document.querySelectorAll('[id^=slave-list]')) {
@@ -141,13 +147,13 @@ App.UI.SlaveList.render = function() {
 
 
 	/**
-	 * @param {number} index
+	 * @param {number} id
 	 * @param {slaveToElement} interactionLink
 	 * @param {boolean} showTransfers
 	 * @param {slaveToElement} [postNote]
 	 * @returns {DocumentFragment}
 	 */
-	function renderSlave(index, interactionLink, showTransfers, postNote) {
+	function renderSlave(id, interactionLink, showTransfers, postNote) {
 		let res = document.createDocumentFragment();
 		if (V.slavePanelStyle === 0) {
 			res.appendChild(document.createElement("br"));
@@ -156,7 +162,7 @@ App.UI.SlaveList.render = function() {
 			hr.style.margin = "0";
 			res.appendChild(hr);
 		}
-		const slave = slaves[index];
+		const slave = slaveStateById(id);
 
 		if ((V.seeImages === 1) && (V.seeSummaryImages === 1)) {
 			let imgDiv = document.createElement("div");
@@ -166,7 +172,7 @@ App.UI.SlaveList.render = function() {
 			res.appendChild(imgDiv);
 		}
 		// res.push(dividerAndImage(slave));
-		res.appendChild(interactionLink(slave, index));
+		res.appendChild(interactionLink(slave));
 
 		if ((slave.choosesOwnClothes === 1) && (slave.clothes === "choosing her own clothes")) {
 			const _oldDevotion = slave.devotion;
@@ -185,10 +191,10 @@ App.UI.SlaveList.render = function() {
 		slave.health.health = Math.trunc(slave.health.health);
 		res.appendChild(document.createTextNode(' will '));
 		const assignment = document.createElement("span");
-		if ((slave.assignment === "rest") && (slave.health.condition >= -20)) {
+		if ((slave.assignment === Job.REST) && (slave.health.condition >= -20)) {
 			assignment.className = "freeAssignment";
 			assignment.innerText = slave.assignment;
-		} else if ((slave.assignment === "stay confined") && ((slave.devotion > 20) || ((slave.trust < -20) && (slave.devotion >= -20)) || ((slave.trust < -50) && (slave.devotion >= -50)))) {
+		} else if ((slave.assignment === Job.CONFINEMENT) && ((slave.devotion > 20) || ((slave.trust < -20) && (slave.devotion >= -20)) || ((slave.trust < -50) && (slave.devotion >= -50)))) {
 			assignment.innerText = slave.assignment;
 			if (slave.sentence > 0) {
 				assignment.innerText += ` (${slave.sentence} weeks)`;
@@ -201,7 +207,7 @@ App.UI.SlaveList.render = function() {
 				assignment.innerText += ` ${slave.sentence} weeks`;
 			}
 		}
-		if (slave.assignment === "get treatment in the clinic") {
+		if (slave.assignment === Job.CLINIC) {
 			let list = [];
 			let i;
 			if (slave.health.condition <= 40) {
@@ -238,7 +244,7 @@ App.UI.SlaveList.render = function() {
 					assignment.innerText += ", ";
 				}
 			}
-		} else if (slave.assignment === "rest in the spa") {
+		} else if (slave.assignment === Job.SPA) {
 			let list = [];
 			let i;
 			if (slave.fetish === "mindbroken") {
@@ -267,7 +273,7 @@ App.UI.SlaveList.render = function() {
 					}
 				}
 			}
-		} else if (slave.assignment === "learn in the schoolroom") {
+		} else if (slave.assignment === Job.SCHOOL) {
 			let lessons = [];
 			let i;
 			if ((V.schoolroomRemodelBimbo === 1 && slave.intelligenceImplant > -15) || (V.schoolroomRemodelBimbo === 0 && slave.intelligenceImplant < 30)) {
@@ -304,7 +310,7 @@ App.UI.SlaveList.render = function() {
 					assignment.innerText += ", ";
 				}
 			}
-		} else if (slave.assignment === "be a subordinate slave") {
+		} else if (slave.assignment === Job.SUBORDINATE) {
 			if (slave.subTarget === -1) {
 				assignment.innerText += ", serving as your Stud";
 			} else if (slave.subTarget !== 0) {
@@ -329,8 +335,8 @@ App.UI.SlaveList.render = function() {
 
 		res.appendChild(App.UI.SlaveSummary.render(slave));
 
-		if (postNote !== undefined) {
-			const pn = postNote(slave, index);
+		if (postNote) {
+			const pn = postNote(slave);
 			if (pn) {
 				let r = document.createElement("p");
 				r.classList.add("si");
@@ -343,10 +349,10 @@ App.UI.SlaveList.render = function() {
 	}
 
 	/**
-	 * @param {number[]} indices
+	 * @param {number[]} IDs
 	 * @returns {DocumentFragment}
 	 */
-	function createQuickList(indices) {
+	function createQuickList(IDs) {
 		/**
 		 *
 		 * @param {Node} container
@@ -384,7 +390,7 @@ App.UI.SlaveList.render = function() {
 		*	<<print 'pass/count/indexed/flag::[' + passageName + '/' + _Count + '/' + _indexed + '/' + $SlaveSummaryFiler + ']'>>
 		*/
 
-		if (indices.length > 1 && passageName === "Main") {
+		if (IDs.length > 1 && passageName === "Main") {
 			const _buttons = [];
 			let _offset = -50;
 			if (/Select/i.test(passageName)) {
@@ -409,8 +415,8 @@ App.UI.SlaveList.render = function() {
 			const listIndex = makeElement(res, "div", undefined, "hidden");
 			listIndex.id = `list_index${listID}`;
 
-			for (const _ssii of indices) {
-				const _IndexSlave = slaves[_ssii];
+			for (const sID of IDs) {
+				const _IndexSlave = slaveStateById(sID);
 				const _indexSlaveName = SlaveFullName(_IndexSlave);
 				const _devotionClass = getSlaveDevotionClass(_IndexSlave);
 				const _trustClass = getSlaveTrustClass(_IndexSlave);
@@ -432,16 +438,16 @@ App.UI.SlaveList.render = function() {
 				const linkSortByDevotion = makeElement(listIndex, "a", "Sort by Devotion");
 				linkSortByDevotion.onclick = (ev) => {
 					ev.preventDefault();
-					State.variables.sortQuickList = "Devotion";
-					$("#qlSort").text(State.variables.sortQuickList);
+					V.sortQuickList = "Devotion";
+					$("#qlSort").text(V.sortQuickList);
 					$("#qlWrapper").removeClass("trust").addClass("devotion");
 					sortButtonsByDevotion();
 				};
 				const linkSortByTrust = makeElement(listIndex, "a", "Sort by Trust");
 				linkSortByTrust.onclick = (ev) => {
 					ev.preventDefault();
-					State.variables.sortQuickList = "Trust";
-					$("#qlSort").text(State.variables.sortQuickList);
+					V.sortQuickList = "Trust";
+					$("#qlSort").text(V.sortQuickList);
 					$("#qlWrapper").removeClass("devotion").addClass("trust");
 					sortButtonsByTrust();
 				};
@@ -464,17 +470,18 @@ App.UI.SlaveList.Decoration = {};
  * @param {App.Entity.SlaveState} slave
  * @returns {HTMLElement}
  */
-App.UI.SlaveList.Decoration.penthousePositions = (slave) => {
-	if (App.Data.Facilities.headGirlSuite.manager.assignment === slave.assignment) {
+App.UI.SlaveList.Decoration.penthousePositions = function(slave) {
+	const fcs = App.Entity.facilities;
+	if (fcs.headGirlSuite.manager.isEmployed(slave)) {
 		return App.UI.DOM.makeElement("span", 'HG', ['lightcoral', 'strong']);
 	}
-	if (App.Data.Facilities.penthouse.manager.assignment === slave.assignment) {
+	if (fcs.penthouse.manager.isEmployed(slave)) {
 		return App.UI.DOM.makeElement("span", 'RC', ['lightcoral', 'strong']);
 	}
-	if (App.Data.Facilities.armory.manager.assignment === slave.assignment) {
+	if (fcs.armory.manager.isEmployed(slave)) {
 		return App.UI.DOM.makeElement("span", 'BG', ['lightcoral', 'strong']);
 	}
-	if (Array.isArray(State.variables.personalAttention) && State.variables.personalAttention.findIndex(s => s.ID === slave.ID) !== -1) {
+	if (Array.isArray(V.personalAttention) && V.personalAttention.some(s => s.ID === slave.ID)) {
 		return App.UI.DOM.makeElement("span", 'PA', ['lightcoral', 'strong']);
 	}
 	return null;
@@ -510,21 +517,23 @@ App.UI.SlaveList.SlaveInteract = {};
 
 /**
  * @param {App.Entity.SlaveState} slave
- * @param {number} index
  * @returns {HTMLElement}
  */
-App.UI.SlaveList.SlaveInteract.stdInteract = (slave, index) =>
-	App.UI.DOM.passageLink(SlaveFullName(slave), 'Slave Interact', () => { App.UI.SlaveList.ScrollPosition.record(); App.Utils.setActiveSlaveByIndex(index); });
+App.UI.SlaveList.SlaveInteract.stdInteract = function(slave) {
+	return App.UI.DOM.passageLink(SlaveFullName(slave), 'Slave Interact', () => {
+		App.UI.SlaveList.ScrollPosition.record();
+		V.activeSlave = slave;
+	});
+};
 
 
 /**
  * @param {App.Entity.SlaveState} slave
- * @param {number} index
  * @returns {DocumentFragment|HTMLElement}
  */
-App.UI.SlaveList.SlaveInteract.penthouseInteract = (slave, index) => {
+App.UI.SlaveList.SlaveInteract.penthouseInteract = function(slave) {
 	let decoration = App.UI.SlaveList.Decoration.penthousePositions(slave);
-	let stdLink = App.UI.SlaveList.SlaveInteract.stdInteract(slave, index);
+	let stdLink = App.UI.SlaveList.SlaveInteract.stdInteract(slave);
 	if (decoration) {
 		let fr = document.createDocumentFragment();
 		fr.appendChild(decoration);
@@ -646,32 +655,31 @@ App.UI.SlaveList.listSJFacilitySlaves = function(facility, facilityPassage, show
 		(showTransfersTab ? App.UI.tabbar.tabButton('transfer', tabCaptions.transfer) : '') +
 		'</div>';
 
-	if (facility.hostedSlaves > 0) {
-		let facilitySlaves = job.employeesIndices();
-		SlaveSort.indices(facilitySlaves);
+	const facilitySlaves = [...job.employeesIDs()];
+	if (facilitySlaves.length > 0) {
+		SlaveSort.IDs(facilitySlaves);
 		r += App.UI.tabbar.makeTab("remove", App.UI.SlaveList.render.listMarkup(facilitySlaves, [],
 			App.UI.SlaveList.SlaveInteract.stdInteract,
 			(slave) => App.UI.DOM.link(`Retrieve ${getPronouns(slave).object} from ${facility.name}`, () => removeJob(slave, job.desc.assignment), [], facilityPassage)
-			));
+		));
 	} else {
 		r += App.UI.tabbar.makeTab("remove", `<em>${capFirstChar(facility.name)} is empty for the moment</em>`);
 	}
 
 	/**
-	 * @param {number[]} slaveIdxs
+	 * @param {number[]} slaveIDs
 	 * @returns {string}
 	 */
-	function assignableTabContent(slaveIdxs) {
-		SlaveSort.indices(slaveIdxs);
-		const slaves = V.slaves;
+	function assignableTabContent(slaveIDs) {
+		SlaveSort.IDs(slaveIDs);
 		let rejectedSlaves = [];
 		let passedSlaves = [];
-		slaveIdxs.forEach((idx) => {
-			const rejects = facility.canHostSlave(slaves[idx]);
+		slaveIDs.forEach((id) => {
+			const rejects = facility.canHostSlave(slaveStateById(id));
 			if (rejects.length > 0) {
-				rejectedSlaves.push({index: idx, rejects: rejects});
+				rejectedSlaves.push({id: id, rejects: rejects});
 			} else {
-				passedSlaves.push(idx);
+				passedSlaves.push(id);
 			}
 		}, []);
 		return App.UI.SlaveList.render.listMarkup(passedSlaves, rejectedSlaves,
@@ -679,10 +687,10 @@ App.UI.SlaveList.listSJFacilitySlaves = function(facility, facilityPassage, show
 			(slave) => App.UI.DOM.link(`Send ${getPronouns(slave).object} to ${facility.name}`, () => { assignmentTransition(slave, job.desc.assignment, facilityPassage); }));
 	}
 	if (facility.hasFreeSpace) {
-		const assignableSlaveIdxs = job.desc.partTime ?
-			Array.apply(null, {length: V.slaves.length}).map(Number.call, Number) : // all slaves can work here
-			App.Entity.facilities.penthouse.employeesIndices(); // only slaves from the penthouse can be transferred here
-		r += App.UI.tabbar.makeTab("assign", assignableTabContent(assignableSlaveIdxs));
+		const assignableSlaveIDs = job.desc.partTime ?
+			V.slaves.map(slave => slave.ID) : // all slaves can work here
+			[...App.Entity.facilities.penthouse.employeesIDs()]; // only slaves from the penthouse can be transferred here
+		r += App.UI.tabbar.makeTab("assign", assignableTabContent(assignableSlaveIDs));
 	} else {
 		r += App.UI.tabbar.makeTab("assign", `<strong>${capFirstChar(facility.name)} is full and cannot hold any more slaves</strong>`);
 	}
@@ -690,13 +698,13 @@ App.UI.SlaveList.listSJFacilitySlaves = function(facility, facilityPassage, show
 	if (showTransfersTab) {
 		if (facility.hasFreeSpace) {
 			// slaves from other facilities can be transferred here
-			const transferableIndices = V.slaves.reduce((acc, slave, ind) => {
+			const transferableIDs = V.slaves.reduce((acc, slave) => {
 				if (!assignmentVisible(slave) && !facility.isHosted(slave)) {
-					acc.push(ind);
+					acc.push(slave.ID);
 				}
 				return acc;
 			}, []);
-			r += App.UI.tabbar.makeTab("transfer", assignableTabContent(transferableIndices));
+			r += App.UI.tabbar.makeTab("transfer", assignableTabContent(transferableIDs));
 		} else {
 			r += App.UI.tabbar.makeTab("transfer", `<strong>${capFirstChar(facility.name)} is full and cannot hold any more slaves</strong>`);
 		}
@@ -732,10 +740,17 @@ App.UI.SlaveList.listNGPSlaves = function() {
 		App.UI.tabbar.tabButton('remove', 'Remove from import') +
 		'</div>';
 
-	const NGPassignment = "be imported";
+	const NGPassignment = Job.IMPORTED;
 	/** @type {App.Entity.SlaveState[]} */
 	const slaves = V.slaves;
 
+	/* handle the legacy assignment string */
+	for (const slave of slaves) {
+		if (slave.assignment === "be imported") {
+			slave.assignment = Job.IMPORTED;
+		}
+	}
+
 	if (V.slavesToImport > 0) {
 		const importedSlavesIndices = slaves.reduce((acc, s, i) => {
 			if (s.assignment === NGPassignment) {
@@ -780,7 +795,7 @@ App.UI.SlaveList.displayManager = function(facility, selectionPassage) {
 	selectionPassage = selectionPassage || `${managerCapName} Select`;
 	const manager = facility.manager.currentEmployee;
 	if (manager) {
-		return this.render.listMarkup([App.Utils.slaveIndexForId(manager.ID)], [],
+		return this.render.listMarkup([manager.ID], [],
 			App.UI.SlaveList.SlaveInteract.stdInteract,
 			() => App.UI.DOM.passageLink(`Change or remove ${managerCapName}`, selectionPassage));
 	} else {
@@ -818,7 +833,7 @@ App.UI.SlaveList.penthousePage = function() {
 			const link = App.UI.DOM.makeElement("span", App.UI.DOM.passageLink("Manage Head Girl", "HG Select"), "major-link");
 			link.id = "manageHG";
 			slaveWrapper.append(link, " ", App.UI.DOM.makeElement("span", "[H]", "hotkey"));
-			slaveWrapper.append(App.UI.SlaveList.render.listDOM([App.Utils.slaveIndexForId(HG.ID)], [],
+			slaveWrapper.append(App.UI.SlaveList.render.listDOM([HG.ID], [],
 				App.UI.SlaveList.SlaveInteract.penthouseInteract));
 		} else {
 			if (V.slaves.length > 1) {
@@ -861,7 +876,7 @@ App.UI.SlaveList.penthousePage = function() {
 			const link = App.UI.DOM.makeElement("span", App.UI.DOM.passageLink("Manage Recruiter", "Recruiter Select"), "major-link");
 			link.id = "manageRecruiter";
 			slaveWrapper.append(link, " ", App.UI.DOM.makeElement("span", "[U]", "hotkey"));
-			slaveWrapper.append(App.UI.SlaveList.render.listDOM([App.Utils.slaveIndexForId(RC.ID)], [],
+			slaveWrapper.append(App.UI.SlaveList.render.listDOM([RC.ID], [],
 				App.UI.SlaveList.SlaveInteract.penthouseInteract));
 		} else {
 			slaveWrapper.append("You have ", App.UI.DOM.makeElement("span", "not", "warning"), " selected a Recruiter. ",
@@ -884,7 +899,7 @@ App.UI.SlaveList.penthousePage = function() {
 				const link = App.UI.DOM.makeElement("span", App.UI.DOM.passageLink("Manage Bodyguard", "BG Select"), "major-link");
 				link.id = "manageBG";
 				slaveWrapper.append(link, " ", App.UI.DOM.makeElement("span", "[B]", "hotkey"));
-				slaveWrapper.append(App.UI.SlaveList.render.listDOM([App.Utils.slaveIndexForId(BG.ID)], [],
+				slaveWrapper.append(App.UI.SlaveList.render.listDOM([BG.ID], [],
 					App.UI.SlaveList.SlaveInteract.penthouseInteract));
 				slaveWrapper.append(App.MainView.useGuard());
 			} else {
@@ -907,28 +922,16 @@ App.UI.SlaveList.penthousePage = function() {
 	 * @returns {{n: number, dom: DocumentFragment}}
 	 */
 	function _slavesForJob(job) {
-		const employeesIndices = job === 'all' ? ph.employeesIndices() : ph.job(job).employeesIndices();
-		if (employeesIndices.length === 0) {
+		const employeesIDs = job === 'all' ? [...ph.employeesIDs()] : [...ph.job(job).employeesIDs()];
+		if (employeesIDs.length === 0) {
 			return {n: 0, dom: document.createDocumentFragment()};
 		}
 
-		SlaveSort.indices(employeesIndices);
-
-		if (V.fucktoyInteractionsPosition === 1 && job === "fucktoy") {
-			const fragment = document.createDocumentFragment();
-			for (const i of employeesIndices) {
-				fragment.append(App.UI.SlaveList.render.listDOM([i], [], App.UI.SlaveList.SlaveInteract.penthouseInteract));
-				fragment.append(App.MainView.useFucktoy(V.slaves[i]));
-			}
-			return {
-				n: employeesIndices.length,
-				dom: fragment
-			};
-		}
-
+		SlaveSort.IDs(employeesIDs);
 		return {
-			n: employeesIndices.length,
-			dom: App.UI.SlaveList.render.listDOM(employeesIndices, [], App.UI.SlaveList.SlaveInteract.penthouseInteract)
+			n: employeesIDs.length,
+			dom: App.UI.SlaveList.render.listDOM(employeesIDs, [], App.UI.SlaveList.SlaveInteract.penthouseInteract,
+				V.fucktoyInteractionsPosition === 1 && job === "fucktoy" ? App.MainView.useFucktoy : null)
 		};
 	}
 
@@ -977,7 +980,7 @@ App.UI.SlaveList.penthousePage = function() {
 				case "houseServant":
 					span.append(App.Encyclopedia.Entries.servitude());
 					break;
-				case "whore":
+				case Job.WHORE:
 					span.append(App.Encyclopedia.Entries.whoring());
 					break;
 				case "publicServant":
@@ -1004,10 +1007,10 @@ App.UI.SlaveList.penthousePage = function() {
 	}
 
 	function allTab() {
-		const penthouseSlavesIndices = ph.employeesIndices();
-		SlaveSort.indices(penthouseSlavesIndices);
-		return makeTabDesc('all', `All${V.useSlaveSummaryTabs > 0 ? ` (${penthouseSlavesIndices.length})` : ""}`,
-			App.UI.SlaveList.render.listDOM(penthouseSlavesIndices, [], App.UI.SlaveList.SlaveInteract.penthouseInteract));
+		const penthouseSlavesIDs = [...ph.employeesIDs()];
+		SlaveSort.IDs(penthouseSlavesIDs);
+		return makeTabDesc('all', `All${V.useSlaveSummaryTabs > 0 ? ` (${penthouseSlavesIDs.length})` : ""}`,
+			App.UI.SlaveList.render.listDOM(penthouseSlavesIDs, [], App.UI.SlaveList.SlaveInteract.penthouseInteract));
 	}
 
 	let fragment = document.createDocumentFragment();
@@ -1155,7 +1158,7 @@ App.UI.SlaveList.slaveSelectionList = function() {
 		for (const fn of fNames) {
 			/** @type {App.Entity.Facilities.Facility} */
 			const f = App.Entity.facilities[fn];
-			if (f.established && f.hostedSlaves > 0) {
+			if (f.established && f.hasEmployees) {
 				filters[fn] = f.name;
 			}
 		}
@@ -1184,35 +1187,34 @@ App.UI.SlaveList.slaveSelectionList = function() {
 	 * @returns {DocumentFragment}
 	 */
 	function _listSlaves(assignmentStr, options) {
-		/** @type {App.Entity.SlaveState[]} */
-		const slaves = State.variables.slaves;
-		let unfilteredIndices = [];
+		const slaves = V.slaves;
+		let unfilteredIDs = [];
 		switch (assignmentStr) {
 			case 'all':
-				unfilteredIndices = Array.from({length: slaves.length}, (v, i) => i);
+				unfilteredIDs = slaves.map(s => s.ID);
 				break;
 			case 'experienced':
-				unfilteredIndices = slaves.reduce((acc, s, idx) => {
+				unfilteredIDs = slaves.reduce((acc, s, idx) => {
 					if (options.expCheck(s)) {
-						acc.push(idx);
+						acc.push(s.ID);
 					}
 					return acc;
 				}, []);
 				break;
 			default:
-				unfilteredIndices = App.Entity.facilities[assignmentStr].employeesIndices();
+				unfilteredIDs = [...App.Entity.facilities[assignmentStr].employeesIDs()]; // set to array
 				break;
 		}
-		SlaveSort.indices(unfilteredIndices);
-		let passingIndices = [];
+		SlaveSort.IDs(unfilteredIDs);
+		let passingIDs = [];
 		let rejects = [];
 
-		unfilteredIndices.forEach(idx => {
-			const fr = options.filter(slaves[idx]);
+		unfilteredIDs.forEach(id => {
+			const fr = options.filter(slaveStateById(id));
 			if (fr === true || (Array.isArray(fr) && fr.length === 0)) {
-				passingIndices.push(idx);
+				passingIDs.push(id);
 			} else {
-				if (Array.isArray(fr)) { rejects.push({index: idx, rejects: fr}); }
+				if (Array.isArray(fr)) { rejects.push({id: id, rejects: fr}); }
 			}
 		});
 
@@ -1220,17 +1222,17 @@ App.UI.SlaveList.slaveSelectionList = function() {
 		// done this way to test for tests presence only once
 		const listPostNote = options.expCheck ?
 			(options.postNote ?
-				(s, i) => options.expCheck(s) ? App.UI.DOM.combineNodes(
+				s => options.expCheck(s) ? App.UI.DOM.combineNodes(
 					App.UI.DOM.makeElement("span", "Has applicable career experience.", "lime"),
 					document.createElement("br"),
-					options.postNote(s, i)
-				) : options.postNote(s, i) :
-				(s) => options.expCheck(s) ? App.UI.DOM.makeElement("span", "Has applicable career experience.", "lime") : null) :
+					options.postNote(s)
+				) : options.postNote(s) :
+				s => options.expCheck(s) ? App.UI.DOM.makeElement("span", "Has applicable career experience.", "lime") : null) :
 			options.postNote ?
-				(s, i) => options.postNote(s, i) :
+				s => options.postNote(s) :
 				() => null;
 
-		return App.UI.SlaveList.render.listDOM(passingIndices, rejects, options.interactionLink, listPostNote);
+		return App.UI.SlaveList.render.listDOM(passingIDs, rejects, options.interactionLink, listPostNote);
 	}
 }();
 
diff --git a/src/js/slaveSummaryHelpers.js b/src/js/slaveSummaryHelpers.js
index e0c1fc79590a7d520cf59aff383473fc0054520e..6e37470c95b653850580b80f63aa3c9d4c953b4b 100644
--- a/src/js/slaveSummaryHelpers.js
+++ b/src/js/slaveSummaryHelpers.js
@@ -382,7 +382,7 @@ App.UI.SlaveSummaryImpl = function() {
 			if (passage() === "Clinic" && V.clinicUpgradeScanner) {
 				if (slave.chem > 15) {
 					makeSpan(c, `C${Math.ceil(slave.chem / 10)}`, ["cyan", "strong"]);
-				} else if (slave.chem <= 15 && slave.assignment === "get treatment in the clinic") {
+				} else if (slave.chem <= 15 && slave.assignment === Job.CLINIC) {
 					makeSpan(c, `CSafe`, ["green", "strong"]);
 				}
 			}
@@ -420,7 +420,7 @@ App.UI.SlaveSummaryImpl = function() {
 			if (passage() === "Clinic" && V.clinicUpgradeScanner) {
 				if (slave.chem > 15) {
 					makeSpan(c, `Carcinogen buildup: ${Math.ceil(slave.chem / 10)}.`, "cyan");
-				} else if (slave.chem <= 15 && slave.assignment === "get treatment in the clinic") {
+				} else if (slave.chem <= 15 && slave.assignment === Job.CLINIC) {
 					makeSpan(c, `Safe chem levels.`, "green");
 				}
 			}
diff --git a/src/js/statsChecker/statsChecker.js b/src/js/statsChecker/statsChecker.js
index c30d8c5bf8ea0cee0929d01a6990a5b7e44e9318..a2b2e372267c7956492cb36749fafc8d22295f0c 100644
--- a/src/js/statsChecker/statsChecker.js
+++ b/src/js/statsChecker/statsChecker.js
@@ -16,13 +16,13 @@ globalThis.isSexuallyPure = function(slave) {
 globalThis.isSlaveAvailable = function(slave) {
 	if (!slave) {
 		return null;
-	} else if (slave.assignment === "be your agent") {
+	} else if (slave.assignment === Job.AGENT) {
 		return false;
-	} else if (slave.assignment === "live with your agent") {
+	} else if (slave.assignment === Job.AGENTPARTNER) {
 		return false;
-	} else if (slave.assignment === "be confined in the arcade") {
+	} else if (slave.assignment === Job.ARCADE) {
 		return false;
-	} else if (slave.assignment === "work in the dairy" && State.variables.dairyRestraintsSetting >= 2) {
+	} else if (slave.assignment === Job.DAIRY && V.dairyRestraintsSetting >= 2) {
 		return false;
 	}
 	return true;
diff --git a/src/js/storyJS.js b/src/js/storyJS.js
index c524f7e501ded380ba404dd1bc795375e5922da7..da53e4c5ccb8a207fecb77669ad88e146a4347ff 100644
--- a/src/js/storyJS.js
+++ b/src/js/storyJS.js
@@ -338,7 +338,7 @@ globalThis.repGainSacrifice = function(slave, arcology) {
 		return 0;
 	}
 	return Math.ceil(
-		(Math.min(100, Math.pow(1.0926, State.variables.week - slave.weekAcquired)) + slave.prestige * 30) * arcology.FSAztecRevivalist / 100 / ((State.variables.slavesSacrificedThisWeek || 0) + 1));
+		(Math.min(100, Math.pow(1.0926, V.week - slave.weekAcquired)) + slave.prestige * 30) * arcology.FSAztecRevivalist / 100 / ((V.slavesSacrificedThisWeek || 0) + 1));
 };
 
 /**
@@ -403,7 +403,7 @@ globalThis.nippleColor = function(slave) {
 globalThis.overpowerCheck = function(slave, PC) {
 	let strength;
 
-	if (State.variables.arcologies[0].FSPhysicalIdealist !== "unset") {
+	if (V.arcologies[0].FSPhysicalIdealist !== "unset") {
 		if (PC.title === 1) {
 			strength = 130;
 		} else {
@@ -417,7 +417,7 @@ globalThis.overpowerCheck = function(slave, PC) {
 	strength += (185-slave.height);
 	strength -= (PC.belly/1000);
 	strength += (PC.skill.warfare/3);
-	strength -= (State.variables.PC.health.shortDamage);
+	strength -= (V.PC.health.shortDamage);
 
 	return strength;
 };
@@ -585,11 +585,11 @@ globalThis.printTrinkets = function() {
 		}
 	}
 
-	if (State.variables.trinkets.length === 0) {
+	if (V.trinkets.length === 0) {
 		return "";
 	}
 
-	const trinkets = weightedArray2HashMap(State.variables.trinkets);
+	const trinkets = weightedArray2HashMap(V.trinkets);
 	let trinketString = [];
 	let plurals = false;
 
diff --git a/src/js/utilsDOM.js b/src/js/utilsDOM.js
index 973904c28d1d426a4c3a8d701e67ce30ec4a80ff..030d439d05b4ce89a7f167a956f3278c737e9283 100644
--- a/src/js/utilsDOM.js
+++ b/src/js/utilsDOM.js
@@ -119,12 +119,14 @@ App.UI.DOM.disabledLink = function(link, reasons) {
 	return res;
 };
 
+
 /**
  * @param {string} tag - valid HTML tag
  * @param {string|Node} [content]
  * @param {string|Array<string>} [classNames]
  * @returns {HTMLElement}
  */
+// @ts-ignore
 App.UI.DOM.makeElement = function(tag, content, classNames) {
 	const element = document.createElement(tag);
 	if (classNames !== undefined) {
@@ -147,7 +149,9 @@ App.UI.DOM.makeElement = function(tag, content, classNames) {
  * @param {string|Array<string>} [classNames]
  * @returns {HTMLElement}
  */
+// @ts-ignore
 App.UI.DOM.appendNewElement = function(tag, parent, content, classNames) {
+	// @ts-ignore
 	const element = App.UI.DOM.makeElement(tag, content, classNames);
 	parent.append(element);
 	return element;
diff --git a/src/js/utilsFC.js b/src/js/utilsFC.js
index 77881bb343e264c1fc2d824b1398cfb178abff93..017e3f57dcf64afd86f9f6efd4f60c07b624e6f6 100644
--- a/src/js/utilsFC.js
+++ b/src/js/utilsFC.js
@@ -2677,15 +2677,6 @@ App.Utils.setActiveSlaveByIndex = function(index) {
 	}
 };
 
-/**
- * Returns index in the slave array for the given ID
- * @param {number} id slave ID
- * @returns {number}
- */
-App.Utils.slaveIndexForId = function(id) {
-	return V.slaveIndices[id];
-};
-
 /**
  * Sets temporary variables named by the scheme, described below, to pronouns for the given slave
  * @param {App.Entity.SlaveState} slave
@@ -2836,8 +2827,8 @@ globalThis.getBestSlaves = function({part, count = 3, largest = true, filter = (
  * @param {{}} info see getBestSlaves()
  * @returns {number[]}
  */
-globalThis.getBestSlavesIndices = function(info) {
-	return getBestSlaves(info).map(slave => V.slaveIndices[slave.ID]);
+globalThis.getBestSlavesIDs = function(info) {
+	return getBestSlaves(info).map(slave => slave.ID);
 };
 
 /*
@@ -2905,9 +2896,9 @@ globalThis.penthouseCensus = function() {
 	function occupiesRoom(slave) {
 		if (slave.rules.living !== "luxurious") {
 			return false; // assigned to dormitory
-		} else if (slave.assignment === "be your Head Girl" && V.HGSuite > 0) {
+		} else if (slave.assignment === Job.HEADGIRL && V.HGSuite > 0) {
 			return false; // lives in HG suite
-		} else if (slave.assignment === "guard you" && V.dojo > 0) {
+		} else if (slave.assignment === Job.BODYGUARD && V.dojo > 0) {
 			return false; // lives in dojo
 		} else if (slave.relationship >= 4) {
 			const partner = getSlave(slave.relationshipTarget);
@@ -2922,3 +2913,37 @@ globalThis.penthouseCensus = function() {
 	V.roomsPopulation = penthouseSlaves.filter(occupiesRoom).length;
 	V.dormitoryPopulation = penthouseSlaves.filter(s => s.rules.living !== "luxurious").length;
 };
+
+/**
+ * @param {App.Entity.Facilities.Job|App.Entity.Facilities.Facility} jobOrFacility job or facility object
+ * @returns {App.Entity.SlaveState[]} array of slaves employed at the job or facility, sorted in accordance to user choice
+ */
+App.Utils.sortedEmployees = function(jobOrFacility) {
+	const emploees = jobOrFacility.employees();
+	SlaveSort.slaves(emploees);
+	return emploees;
+};
+
+/**
+ * @param {Array<string|App.Entity.Facilities.Facility>} [facilities]
+ * @param {Object.<string, string>} [mapping] Optional mapping for the property names in the result object. Keys
+ * are the standard facility names, values are the desired names.
+ * @returns {Object.<string, number>}
+ */
+App.Utils.countFacilityWorkers = function(facilities = null, mapping = {}) {
+	facilities = facilities || Object.values(App.Entity.facilities);
+	/** @type {App.Entity.Facilities.Facility[]} */
+	const fObjects = facilities.map(f => typeof f === "string" ? App.Entity.facilities[f] : f);
+	return fObjects.reduce((acc, cur) => {
+		acc[mapping[cur.desc.baseName] || cur.desc.baseName] = cur.employeesIDs().size; return acc;
+	}, {});
+};
+
+/**
+ * @param {string[]} [assignments] array of assignment strings. The default is to count for all assignments
+ * @returns {Object.<string, number>}
+ */
+App.Utils.countAssignmentWorkers = function(assignments) {
+	assignments = assignments || Object.values(Job);
+	return assignments.reduce((acc, cur) => { acc[cur] = V.JobIDMap[cur].size; return acc; }, {});
+};
diff --git a/src/js/utilsSC.js b/src/js/utilsSC.js
index 3c21c2f6295d1b8497131d47a186ac81fb1f8953..af511e4ad9b774c250bdd8ce8896c46250da1c2f 100644
--- a/src/js/utilsSC.js
+++ b/src/js/utilsSC.js
@@ -232,7 +232,7 @@ App.UI.tabbar = function() {
 	}
 
 	function handlePreSelectedTab(defaultTab = "assign", immidiate = false) {
-		let selectedTab = State.variables.tabChoice[tabChoiceVarName()];
+		let selectedTab = V.tabChoice[tabChoiceVarName()];
 		if (!selectedTab) {
 			selectedTab = defaultTab;
 		}
@@ -313,3 +313,31 @@ App.UI.reload = function() {
 	Engine.play(passage());
 	window.scrollTo(0, position);
 };
+
+/**
+ * Renders passage into a document fragment
+ * NOTE: This is a greatly simplified version of the SC Passage.render() private function
+ * This function does not trigger :passagestart and :passagedisplay events
+ * @param {string} passageTitle
+ * @returns {DocumentFragment} document fragment with passage contents
+ */
+App.UI.DOM.renderPassage = function(passageTitle) {
+	const res = document.createDocumentFragment();
+	if (ProfileInclude.IsEnabled) {
+		ProfileInclude.IncludeBegins(passageTitle);
+	}
+	$(res).wiki(jsInclude(passageTitle));
+	if (ProfileInclude.IsEnabled) {
+		ProfileInclude.IncludeEnds();
+	}
+	return res;
+};
+
+/**
+ * Render passage and append the rendered content to the container
+ * @param {Node} container
+ * @param {string} passageTitle
+ */
+App.UI.DOM.includePassage = function(container, passageTitle) {
+	return $(container).append(this.renderPassage(passageTitle));
+};
diff --git a/src/js/wombJS.js b/src/js/wombJS.js
index 4dda1d1d184d00209ceb7494e916333617a08367..e560f361fc5fd2203a9f1c90ca2f05c82b345c3d 100644
--- a/src/js/wombJS.js
+++ b/src/js/wombJS.js
@@ -719,8 +719,8 @@ globalThis.MissingParentIDCorrection = function(actor) {
 	WombInit(actor);
 	actor.womb
 		.filter(ft => (ft.genetics.father === 0 || (ft.genetics.father < -1 && ft.genetics.father >= -20 && ft.genetics.father !== -3)))
-		.forEach(ft => ft.genetics.father = State.variables.missingParentID);
-	State.variables.missingParentID--;
+		.forEach(ft => ft.genetics.father = V.missingParentID);
+	V.missingParentID--;
 };
 
 globalThis.WombCleanYYFetuses = function(actor) {
diff --git a/src/npc/agent/agentFramework.js b/src/npc/agent/agentFramework.js
index 48bbd392f1dc0b9aec60d5991c9c61ef3e3d24a3..eac96b3bd9824fa6345b6c729e7ff195ad65aa05 100644
--- a/src/npc/agent/agentFramework.js
+++ b/src/npc/agent/agentFramework.js
@@ -4,7 +4,7 @@ App.Data.Facilities.arcologyAgent = {
 	jobs: {
 		agentsSlave: {
 			position: "agent's toy",
-			assignment: "live with your agent",
+			assignment: Job.AGENTPARTNER,
 			publicSexUse: true,
 			fuckdollAccepted: false
 		}
@@ -12,7 +12,7 @@ App.Data.Facilities.arcologyAgent = {
 	defaultJob: "agentsSlave",
 	manager: {
 		position: "agent",
-		assignment: "be your agent",
+		assignment: Job.AGENT,
 		careers: "an arcology owner",
 		skill: "headGirl",
 		publicSexUse: true,
diff --git a/src/npc/databases/dSlavesDatabase.js b/src/npc/databases/dSlavesDatabase.js
index de5303f3ad30664879b03e88c10c7e1188586e7d..732af84367a3ffb5ca42920a8c752062e5430ff7 100644
--- a/src/npc/databases/dSlavesDatabase.js
+++ b/src/npc/databases/dSlavesDatabase.js
@@ -653,7 +653,7 @@ App.Data.HeroSlaves.D = [
 		ID: 900019,
 		slaveName: "Terra",
 		birthName: "Terra",
-		assignment: "be a servant",
+		assignment: Job.HOUSE,
 		health: {condition: 20},
 		devotion: -50,
 		weight: -20,
@@ -2952,7 +2952,7 @@ App.Data.HeroSlaves.D = [
 		ID: 900080,
 		slaveName: "Jenna",
 		birthName: "Jenna",
-		assignment: "please you",
+		assignment: Job.FUCKTOY,
 		actualAge: 19,
 		physicalAge: 19,
 		visualAge: 19,
diff --git a/src/npc/databases/ddSlavesDatabase.js b/src/npc/databases/ddSlavesDatabase.js
index e19514820ad08c9c98b4ed2d2b3377dbc7d67356..2505e1f2846df59b69ce6ca352e07ac98ff3a4d9 100644
--- a/src/npc/databases/ddSlavesDatabase.js
+++ b/src/npc/databases/ddSlavesDatabase.js
@@ -43,7 +43,7 @@ App.Data.HeroSlaves.DD = [
 		slaveName: "Alyssa",
 		birthName: "Alyssa",
 		genes: "XY",
-		assignment: "be a servant",
+		assignment: Job.HOUSE,
 		actualAge: 21,
 		physicalAge: 21,
 		visualAge: 21,
diff --git a/src/npc/surgery/surgery.js b/src/npc/surgery/surgery.js
index 3edc3d395cd2a3dbb622d1c610c7efc7f2d61d89..6b47b41d0aa74236930f52904b199c6454101221 100644
--- a/src/npc/surgery/surgery.js
+++ b/src/npc/surgery/surgery.js
@@ -93,7 +93,7 @@ App.Medicine.Surgery.makeLink = function(passage, surgery, slave) {
 	}
 
 	function healthCosts() {
-		const hc = (State.variables.PC.skill.medicine >= 100) ? Math.round(surgery.healthCosts / 2) : surgery.healthCosts;
+		const hc = (V.PC.skill.medicine >= 100) ? Math.round(surgery.healthCosts / 2) : surgery.healthCosts;
 		if (hc > 30) {
 			return 'substantial';
 		} else if (hc > 20) {
@@ -131,7 +131,7 @@ App.Medicine.Surgery.ListHelpers = class {
 		/** @private */
 		this._pronouns = pronouns;
 		/** @private */
-		this._V = State.variables;
+		this._V = V;
 		this._showCCs = showCCs;
 	}
 
diff --git a/src/player/fSelf.tw b/src/player/fSelf.tw
index 1cf6d7b0c8fa01e227c894639f5ddb11a1838bf7..86fe2c1482823e3b1381d8b2d7cb7a13870e99a6 100644
--- a/src/player/fSelf.tw
+++ b/src/player/fSelf.tw
@@ -3,11 +3,9 @@
 <<set $nextButton = "Back", $nextLink = "Main">>
 
 <<set _CumSources = []>>
-<<SlaveIDSort $DairyiIDs>>
-<<for _fs = 0; _fs < $DairyiIDs.length; _fs++>>
-	<<set _cumTarget = $slaveIndices[$DairyiIDs[_fs]]>>
-	<<if $slaves[_cumTarget].balls > 0 && $slaves[_cumTarget].ballType == "human" && $slaves[_cumTarget].vasectomy != 1>>
-		<<set _CumSources.push($DairyiIDs[_fs])>>
+<<for _slave range App.Entity.facilities.dairy.employees()>>
+	<<if _slave.balls > 0 && _slave.ballType == "human" && _slave.vasectomy != 1>>
+		<<set _CumSources.push(_slave.ID)>>
 	<</if>>
 <</for>>
 <<if $arcologies[0].FSPastoralistLaw == 1>>
diff --git a/src/player/js/enslavePlayer.js b/src/player/js/enslavePlayer.js
index 692443f9dc83344472e17c60bf261a8696b46998..b995e6412f2e575f1ff9584ac3b3b8cd7020f024 100644
--- a/src/player/js/enslavePlayer.js
+++ b/src/player/js/enslavePlayer.js
@@ -63,7 +63,7 @@ globalThis.convertPlayerToSlave = function(slave, badEnd = "boring") {
 	slave.sisters = 0;
 	slave.canRecruit = 0;
 	slave.choosesOwnAssignment = 0;
-	slave.assignment = "rest";
+	slave.assignment = Job.REST;
 	slave.sentence = 0;
 	slave.training = 0;
 	slave.toyHole = "all her holes";
diff --git a/src/player/js/playerJS.js b/src/player/js/playerJS.js
index 64350c2ed52913b44ceec7495f895b712315749a..dbc4ccb9d42c4c6fae34b48de3a145ae6267103c 100644
--- a/src/player/js/playerJS.js
+++ b/src/player/js/playerJS.js
@@ -7,7 +7,7 @@ globalThis.basePlayer = function() {
  * @returns {string}
  */
 globalThis.properTitle = function() {
-	const PC = State.variables.PC;
+	const PC = V.PC;
 	if (PC.customTitle) {
 		return PC.customTitle;
 	} else if (PC.title !== 0) {
@@ -22,7 +22,7 @@ globalThis.properTitle = function() {
  * @returns {string}
  */
 globalThis.properMaster = function() {
-	const PC = State.variables.PC;
+	const PC = V.PC;
 	if (PC.customTitle) {
 		return PC.customTitle;
 	} else if (PC.title !== 0) {
@@ -437,7 +437,8 @@ globalThis.PCTitle = function() {
 		}
 	}
 
-	if (V.BrothiIDs.length >= 15) {
+	const facilities = App.Entity.facilities;
+	if (facilities.brothel.employeesIDs().size >= 15) {
 		if (V.PC.title === 1) {
 			titles.push("Procurator of the Brothel");
 		} else {
@@ -445,10 +446,10 @@ globalThis.PCTitle = function() {
 		}
 	}
 
-	if (V.ClubiIDs.length >= 15) {
+	if (facilities.club.employeesIDs().size >= 15) {
 		titles.push("First on the Club");
 	}
-	if (V.DairyiIDs.length >= 15) {
+	if (facilities.dairy.employeesIDs().size >= 15) {
 		titles.push("Keeper of the Cattle");
 	}
 	if (V.cumSlaves >= 15) {
@@ -458,24 +459,24 @@ globalThis.PCTitle = function() {
 			titles.push("Extractrix of the Ejaculate");
 		}
 	}
-	if (V.ServQiIDs.length >= 15) {
+	if (facilities.servantsQuarters.employeesIDs().size >= 15) {
 		if (V.PC.title === 1) {
 			titles.push("Director of the Servants");
 		} else {
 			titles.push("Directrix of the Servants");
 		}
 	}
-	if (V.SchlRiIDs.length >= 10) {
+	if (facilities.schoolroom.employeesIDs().size >= 10) {
 		if (V.PC.title === 1) {
 			titles.push("Educator of the Slaves");
 		} else {
 			titles.push("Educatrix of the Slaves");
 		}
 	}
-	if (V.SpaiIDs.length >= 10) {
+	if (facilities.spa.employeesIDs().size >= 10) {
 		titles.push("Order of the Bath");
 	}
-	if (V.ArcadeiIDs.length >= 15) {
+	if (facilities.arcade.employeesIDs().size >= 15) {
 		titles.push("Comptroller of the Arcade");
 	}
 	if (V.nurseryBabies >= 10) {
diff --git a/src/pregmod/FCTV/seFCTVshows.tw b/src/pregmod/FCTV/seFCTVshows.tw
index a62554ae127733772f746e24447d2be8f2340f2e..d190eab4e434dc1a9d3bacb061a8b8fadc4f90b9 100644
--- a/src/pregmod/FCTV/seFCTVshows.tw
+++ b/src/pregmod/FCTV/seFCTVshows.tw
@@ -137,7 +137,7 @@
 
 <<case 1>>
 	<<run FCTV.incrementChannel(2)>>
-	<<set _MSL = $MastSiIDs.length>>
+	<<set _MSL = App.Entity.facilities.dairy.employeesIDs().size>>
 	which is currently showing <<if FCTV.channelCount(12, 'lt')>>the newest episode of a<<else>>a repeat of the<</if>> popular competitive reality show<<if FCTV.channelCount(0, 'gt')>>: Next Top Breeder.<<else>> where several female citizens are competing for something.<</if>>
 	The intro sequence shows a succession of beautiful ladies either participating in a mixture of contrived competitions, or talking and going about their lives in a sorority-like setting.
 	The montage is overlaid with a narrator's voice: "12 of Canadia Arcology's most attractive women are all competing for the privilege of having the arcology owner's children.
diff --git a/src/pregmod/newChildIntro.tw b/src/pregmod/newChildIntro.tw
index c4febcd7897120daca8cbcb82df8bcd63fe3a3f3..1f4434d1ac56395e01abffd322c70fa6d737f647 100644
--- a/src/pregmod/newChildIntro.tw
+++ b/src/pregmod/newChildIntro.tw
@@ -1075,7 +1075,7 @@ You slowly strip down, gauging $his reactions to your show, until you are fully
 	<</link>>
 	<<if ($activeSlave.lactation > 0 || (($dairySlimMaintainUpgrade == 0 || $dairySlimMaintain == 0) && ($activeSlave.boobs > 300 || $activeSlave.dick == 0 || $dairyImplantsSetting == 1) && $dairyImplantsSetting != 2)) || ($activeSlave.balls > 0)>>
 		<<if $dairyPrepUpgrade == 1>>
-			<<if $dairy > $DairyiIDs.length+$bioreactorsXY+$bioreactorsXX+$bioreactorsHerm+$bioreactorsBarren>>
+			<<if App.Entity.facilities.dairy.hasFreeSpace>>
 				<br><<link "Send $him straight to the Industrial Dairy">>
 				<<set $activeSlave.choosesOwnAssignment = 0>>
 				<<set $activeSlave.anus = Math.clamp($activeSlave.anus, 3, 4)>>
@@ -1088,7 +1088,7 @@ You slowly strip down, gauging $his reactions to your show, until you are fully
 				<</link>>
 			<</if>>
 		<</if>>
-		<<if $dairy > $DairyiIDs.length+$bioreactorsXY+$bioreactorsXX+$bioreactorsHerm+$bioreactorsBarren>>
+		<<if App.Entity.facilities.dairy.hasFreeSpace>>
 			<br><<link "Break $him in for the Industrial Dairy">>
 			<<set $activeSlave.choosesOwnAssignment = 0>>
 			<<set $activeSlave.anus = Math.clamp($activeSlave.anus, 3, 4)>>
@@ -1123,13 +1123,13 @@ You slowly strip down, gauging $his reactions to your show, until you are fully
 		As $he <<if canSee($activeSlave)>>watches<<elseif canHear($activeSlave)>>listens<<else>>stands there<</if>>, aroused, first one citizen and then the other finishes and steps away. The first arcade inmate's <<if $seeDicks != 100>>pussy<<else>>butt<</if>> is left looking sore until $arcadeName's systems cover _himU for a quick cleaning, and the second inmate's asshole <<if $seeDicks != 0>>has obviously seen severe use, since the poor _girlU doesn't have a pussy to spread the load<<else>>is loose enough that the machines have to clean up the cum it drools onto the floor<</if>>. $activeSlave.slaveName lets out a cheer and turns to you, @@.hotpink;eagerly awaiting the day $he gets to go to $arcadeName and play with the holes.@@ It seems $he missed the point.
 	<</replace>>
 	<</link>>
-	<<if ($arcade > $ArcadeiIDs.length) || ($arcadeUpgradeFuckdolls == 2)>>
+	<<if (App.Entity.facilities.arcade.hasFreeSpace) || ($arcadeUpgradeFuckdolls == 2)>>
 		<br><<link "Send $him straight to the Arcade">>
 		<<= assignJob($activeSlave, "be confined in the arcade")>>
 		<<set $activeSlave.choosesOwnAssignment = 0>>
 		<<replace "#result">>
 			You order <<if $HeadGirl == 0>>another slave<<else>>$HeadGirl.slaveName<</if>> to get $activeSlave.slaveName set up in $arcadeName. The new slave does not know what $arcadeName is, not really, and $he doesn't know what being set up there means, either. $He'll be confined inside a small space, not too different from the tube $he was grown in. It's only when the restraints lock into place that $he'll understand $his doom. $His mouth will be forced open and presented at one wall of $arcadeName, and $his ass will protrude from its other side, $his holes available for public relief at both ends. $He'll probably refuse to believe the truth, until the first cockhead enters $his mouth<<if $activeSlave.vagina > -1>>, parts $his pussylips,<</if>> or presses against $his poor anus.
-			<<if ($arcade <= $ArcadeiIDs.length)>>Mere <<if $showInches == 2>>yards<<else>>meters<</if>> away, preparations to convert the least appealing Arcade slave into a Fuckdoll begin. As $activeSlave.slaveName is broken in by $his first customers, $he's blissfully unaware that $he's $arcade new slaves away from the same fate.<</if>>
+			<<if ($arcade <= App.Entity.facilities.arcade.employeesIDs().size)>>Mere <<if $showInches == 2>>yards<<else>>meters<</if>> away, preparations to convert the least appealing Arcade slave into a Fuckdoll begin. As $activeSlave.slaveName is broken in by $his first customers, $he's blissfully unaware that $he's $arcade new slaves away from the same fate.<</if>>
 		<</replace>>
 		<</link>>
 	<</if>>
diff --git a/src/pregmod/saAgent.tw b/src/pregmod/saAgent.tw
deleted file mode 100644
index 419c1b45af150e05101dba693f12b2e0044bdde8..0000000000000000000000000000000000000000
--- a/src/pregmod/saAgent.tw
+++ /dev/null
@@ -1,529 +0,0 @@
-:: SA agent [nobr]
-
-<<set _gigantomastiaMod = $slaves[$i].geneticQuirks.gigantomastia == 2 ? ($slaves[$i].geneticQuirks.macromastia == 2 ? 3 : 2) : 1>>
-
-<<if $slaves[$i].boobsImplantType == "string">>
-	<<set $slaves[$i].boobsImplant += 50, $slaves[$i].boobs += 50>>
-	<<if ($slaves[$i].boobs > 50000)>>
-		<<set $slaves[$i].boobs -= 100, $slaves[$i].boobsImplant -= 100>>
-		<<if $slaves[$i].geneMods.NCS == 1>>
-			<<set $slaves[$i].boobs -= 100, $slaves[$i].boobsImplant -= 100>>
-		<</if>>
-	<</if>>
-<</if>>
-<<if $slaves[$i].geneMods.NCS == 1>> /* NCS is blocking boob expansion. */
-	<<if ($slaves[$i].boobsImplant > 1000)>>
-		<<if ($slaves[$i].boobs-$slaves[$i].boobsImplant < 1000) && (random(1,100) > 60)>>
-			<<set $slaves[$i].boobs += 50>>
-		<</if>>
-	<<elseif ($slaves[$i].boobsImplant > 600)>>
-		<<if ($slaves[$i].boobs-$slaves[$i].boobsImplant < 500) && (random(1,100) > 60)>>
-			<<set $slaves[$i].boobs += 50>>
-		<</if>>
-	<<elseif ($slaves[$i].boobsImplant > 0)>>
-		<<if ($slaves[$i].boobs-$slaves[$i].boobsImplant < 300) && (random(1,100) > 60)>>
-			<<set $slaves[$i].boobs += 50>>
-		<</if>>
-	<</if>>
-<</if>>
-<<if $slaves[$i].geneticQuirks.macromastia == 2 && $slaves[$i].geneticQuirks.gigantomastia == 2>>
-	<<if $slaves[$i].boobs < 100000 && $slaves[$i].weight >= -95>>
-		<<set $slaves[$i].boobs += 30>>
-	<</if>>
-<<elseif $slaves[$i].geneticQuirks.gigantomastia == 2>>
-	<<if $slaves[$i].boobs < 25000 && $slaves[$i].weight >= -95>>
-		<<set $slaves[$i].boobs += 20>>
-	<</if>>
-<<elseif $slaves[$i].geneticQuirks.macromastia == 2>>
-	<<if $slaves[$i].boobs < 5000 && $slaves[$i].weight >= -95>>
-		<<set $slaves[$i].boobs += 10>>
-	<</if>>
-<</if>>
-<<if $slaves[$i].buttImplantType == "string">>
-	<<set $slaves[$i].buttImplant += .25, $slaves[$i].butt += .25>>
-	<<if ($slaves[$i].butt > 10)>>
-		<<set $slaves[$i].butt -= 1, $slaves[$i].buttImplant -= 1>>
-		<<if $slaves[$i].geneMods.NCS == 1>>
-			<<set $slaves[$i].butt -= 1, $slaves[$i].buttImplant -= 1>>
-		<</if>>
-	<</if>>
-<</if>>
-<<if $slaves[$i].geneticQuirks.rearLipedema == 2 && $slaves[$i].butt < 20>>
-	<<set $slaves[$i].butt += .1>>
-<</if>>
-
-<<if $slaves[$i].genes == "XX">>
-	<<if $slaves[$i].ovaries == 1 || $slaves[$i].mpreg == 1>>
-		<<if $slaves[$i].balls > 0 && $slaves[$i].ballType != "sterile">>
-			<<if $slaves[$i].hormoneBalance > 20>>
-				<<set $slaves[$i].hormoneBalance -= 1>>
-			<<elseif $slaves[$i].hormoneBalance < 20>>
-				<<set $slaves[$i].hormoneBalance += 1>>
-			<</if>>
-		<<else>>
-			<<if $slaves[$i].hormoneBalance > 60>>
-				<<set $slaves[$i].hormoneBalance -= 1>>
-			<<elseif $slaves[$i].hormoneBalance < 60>>
-				<<set $slaves[$i].hormoneBalance += 1>>
-			<</if>>
-		<</if>>
-	<<else>>
-		<<if $slaves[$i].balls > 0 && $slaves[$i].ballType != "sterile">>
-			<<if $slaves[$i].hormoneBalance > -20>>
-				<<set $slaves[$i].hormoneBalance -= 1>>
-			<<elseif $slaves[$i].hormoneBalance < -20>>
-				<<set $slaves[$i].hormoneBalance += 1>>
-			<</if>>
-		<<else>>
-			<<if $slaves[$i].hormoneBalance > 20>>
-				<<set $slaves[$i].hormoneBalance -= 1>>
-			<<elseif $slaves[$i].hormoneBalance < 20>>
-				<<set $slaves[$i].hormoneBalance += 1>>
-			<</if>>
-		<</if>>
-	<</if>>
-<<elseif $slaves[$i].genes == "XY">>
-	<<if $slaves[$i].ovaries == 1 || $slaves[$i].mpreg == 1>>
-		<<if $slaves[$i].balls > 0 && $slaves[$i].ballType != "sterile">>
-			<<if $slaves[$i].hormoneBalance > 20>>
-				<<set $slaves[$i].hormoneBalance -= 1>>
-			<<elseif $slaves[$i].hormoneBalance < 20>>
-				<<set $slaves[$i].hormoneBalance += 1>>
-			<</if>>
-		<<else>>
-			<<if $slaves[$i].hormoneBalance > 40>>
-				<<set $slaves[$i].hormoneBalance -= 1>>
-			<<elseif $slaves[$i].hormoneBalance < 40>>
-				<<set $slaves[$i].hormoneBalance += 1>>
-			<</if>>
-		<</if>>
-	<<else>>
-		<<if $slaves[$i].balls > 0 && $slaves[$i].ballType != "sterile">>
-			<<if $slaves[$i].hormoneBalance > -40>>
-				<<set $slaves[$i].hormoneBalance -= 1>>
-			<<elseif $slaves[$i].hormoneBalance < -40>>
-				<<set $slaves[$i].hormoneBalance += 1>>
-			<</if>>
-		<<else>>
-			<<if $slaves[$i].hormoneBalance > 20>>
-				<<set $slaves[$i].hormoneBalance -= 1>>
-			<<elseif $slaves[$i].hormoneBalance < 20>>
-				<<set $slaves[$i].hormoneBalance += 1>>
-			<</if>>
-		<</if>>
-	<</if>>
-<</if>>
-
-/* puberty - not announced for allowing surprise pregnancy */
-<<if $slaves[$i].ovaries == 1 || $slaves[$i].mpreg == 1>>
-	<<if $slaves[$i].pubertyXX == 0>>
-		<<if $slaves[$i].physicalAge >= $slaves[$i].pubertyAgeXX>>
-			<<set $slaves[$i].pubertyXX = 1>>
-			<<if $slaves[$i].geneticQuirks.gigantomastia == 3 && random(1,100) < $slaves[$i].hormoneBalance>>
-				<<set $slaves[$i].geneticQuirks.gigantomastia = 2>>
-			<</if>>
-			<<if $slaves[$i].geneticQuirks.macromastia == 3 && random(1,100) < $slaves[$i].hormoneBalance>>
-				<<set $slaves[$i].geneticQuirks.macromastia = 2>>
-			<</if>>
-		<</if>>
-	<</if>>
-<</if>>
-<<if $slaves[$i].balls > 0 && $slaves[$i].ballType != "sterile">>
-	<<if $slaves[$i].pubertyXY == 0>>
-		<<if $slaves[$i].physicalAge >= $slaves[$i].pubertyAgeXY>>
-			<<set $slaves[$i].pubertyXY = 1>>
-		<</if>>
-	<</if>>
-<</if>>
-
-<<if $slaves[$i].inflation > 0>>
-	<<set $slaves[$i].inflation = 0, $slaves[$i].inflationType = "none", $slaves[$i].inflationMethod = 0, $slaves[$i].milkSource = 0>>
-<</if>>
-
-<<if ($slaves[$i].preg > 0)>> /*EFFECTS OF PREGNANCY*/
-	<<if $slaves[$i].preg == $slaves[$i].pregData.normalBirth/8>> /* !!! Very bad condition logic - with pregnancy control drugs can be not triggered. Or may be trigged by broodmother several times. Need to be reworked. !!! */
-		<<if $slaves[$i].pregSource == -1>>
-			<<set $PC.counter.slavesKnockedUp++>>
-		<<elseif $slaves[$i].pregSource > 0>>
-			<<set _babyDaddy = findFather($slaves[$i].pregSource)>>
-			<<if def _babyDaddy>>
-				<<set _adjust = _babyDaddy.counter.slavesKnockedUp++>>
-				<<set adjustFatherProperty(_babyDaddy, "slavesKnockedUp", _adjust)>>
-			<</if>>
-		<</if>>
-	<</if>>
-	<<if ($slaves[$i].preg >= $slaves[$i].pregData.normalBirth/4)>>
-		<<if $slaves[$i].geneticQuirks.gigantomastia == 3 && random(1,200) < $slaves[$i].hormoneBalance>>
-			<<set $slaves[$i].geneticQuirks.gigantomastia = 2>>
-		<</if>>
-		<<if $slaves[$i].geneticQuirks.macromastia == 3 && random(1,200) < $slaves[$i].hormoneBalance>>
-			<<set $slaves[$i].geneticQuirks.macromastia = 2>>
-		<</if>>
-		<<if $slaves[$i].geneMods.NCS == 1>>
-			/* Sort-of No-op, NCS prevents boob growth */
-			<<set _boobTarget = 0>>
-		<<elseif $slaves[$i].physicalAge >= 18>>
-			<<if $slaves[$i].pregType >= 50>>
-				<<set _boobTarget = 10000>>
-			<<elseif $slaves[$i].pregType >= 30>>
-				<<set _boobTarget = 5000>>
-			<<elseif $slaves[$i].pregType >= 10>>
-				<<set _boobTarget = 2000>>
-			<<else>>
-				<<set _boobTarget = 1000>>
-			<</if>>
-		<<elseif $slaves[$i].physicalAge >= 13>>
-			<<if $slaves[$i].pregType >= 50>>
-				<<set _boobTarget = 5000>>
-			<<elseif $slaves[$i].pregType >= 30>>
-				<<set _boobTarget = 3200>>
-			<<elseif $slaves[$i].pregType >= 10>>
-				<<set _boobTarget = 1800>>
-			<<else>>
-				<<set _boobTarget = 800>>
-			<</if>>
-		<<elseif $slaves[$i].physicalAge >= 8>>
-			<<if $slaves[$i].pregType >= 50>>
-				<<set _boobTarget = 1800>>
-			<<elseif $slaves[$i].pregType >= 30>>
-				<<set _boobTarget = 1400>>
-			<<elseif $slaves[$i].pregType >= 10>>
-				<<set _boobTarget = 1000>>
-			<<else>>
-				<<set _boobTarget = 600>>
-			<</if>>
-		<<else>>
-			<<if $slaves[$i].pregType >= 50>>
-				<<set _boobTarget = 1000>>
-			<<elseif $slaves[$i].pregType >= 30>>
-				<<set _boobTarget = 800>>
-			<<elseif $slaves[$i].pregType >= 10>>
-				<<set _boobTarget = 600>>
-			<<else>>
-				<<set _boobTarget = 400>>
-			<</if>>
-		<</if>>
-		<<set _boobTarget *= _gigantomastiaMod>>
-		<<if ($slaves[$i].pregType >= 30)>>
-			<<if ($slaves[$i].weight <= 65)>>
-				<<set $slaves[$i].weight += 1>>
-			<</if>>
-			<<if (($slaves[$i].geneMods.NCS == 0) && (random(1,100) > 60))>>
-				<<if (($slaves[$i].boobs - $slaves[$i].boobsImplant) < _boobTarget)>>
-					<<set $slaves[$i].boobs += 200>>
-					<<if $slaves[$i].boobShape != "saggy" && $slaves[$i].preg > $slaves[$i].pregData.normalBirth/1.25 && ($slaves[$i].breastMesh != 1)>>
-						<<set $slaves[$i].boobShape = "saggy">>
-					<</if>>
-				<</if>>
-				<<if ($slaves[$i].hips < 2)>>
-					<<set $slaves[$i].hips += 1>>
-				<</if>>
-				<<if ($slaves[$i].butt < 14)>>
-					<<set $slaves[$i].butt += 1>>
-				<</if>>
-			<</if>>
-		<<elseif (($slaves[$i].geneMods.NCS == 0) && ($slaves[$i].pregType >= 10))>>
-			<<if random(1,100) > 80 && (($slaves[$i].boobs - $slaves[$i].boobsImplant) < _boobTarget)>>
-				<<set $slaves[$i].boobs += 100>>
-				<<if $slaves[$i].boobShape != "saggy" && ($slaves[$i].breastMesh != 1)>>
-					<<if $slaves[$i].preg > random($slaves[$i].pregData.normalBirth/1.25, $slaves[$i].pregData.normalBirth*2)>>
-						<<set $slaves[$i].boobShape = "saggy">>
-					<</if>>
-				<</if>>
-			<</if>>
-		<<elseif (($slaves[$i].geneMods.NCS == 0) && (($slaves[$i].boobs - $slaves[$i].boobsImplant) < _boobTarget))>>
-			<<if random(1,100) > 80>>
-				<<set $slaves[$i].boobs += 50>>
-				<<if $slaves[$i].boobShape != "saggy" && $slaves[$i].preg > random($slaves[$i].pregData.normalBirth/1.25, $slaves[$i].pregData.normalBirth*2.5) && ($slaves[$i].breastMesh != 1)>>
-					<<set $slaves[$i].boobShape = "saggy">>
-				<</if>>
-			<</if>>
-		<</if>>
-		<<if $slaves[$i].geneMods.NCS == 1>>
-			/* No-op, we don't grow hips on NCS */
-		<<elseif $slaves[$i].preg > $slaves[$i].pregData.normalBirth/1.25 && $slaves[$i].physicalAge >= 18 && $slaves[$i].hips == 1 && $slaves[$i].hipsImplant == 0 && random(1,100) > 90>>
-			<<set $slaves[$i].hips += 1>>
-		<<elseif $slaves[$i].preg > $slaves[$i].pregData.normalBirth/1.42 && $slaves[$i].physicalAge >= 18 && $slaves[$i].hips == 0 && $slaves[$i].hipsImplant == 0 && random(1,100) > 70>>
-			<<set $slaves[$i].hips += 1>>
-		<</if>>
-		<<if $slaves[$i].bellyPreg >= 1500>>
-			<<if setup.fakeBellies.includes($slaves[$i].bellyAccessory)>>
-				<<set $slaves[$i].bellyAccessory = "none">>
-			<</if>>
-			<<if ($slaves[$i].preg > $slaves[$i].pregData.normalBirth/2) && ($slaves[$i].lactation == 0) && $slaves[$i].health.condition >= -20 && $slaves[$i].weight > -30>>
-				<<if $slaves[$i].preg > random($slaves[$i].pregData.normalBirth/2.22, $slaves[$i].pregData.normalBirth/1.33)>>
-					<<set $slaves[$i].lactation = 1>>
-				<</if>>
-			<</if>>
-			<<if $slaves[$i].lactation == 1>>
-				<<set $slaves[$i].lactationDuration = 2>>
-			<</if>>
-		<</if>>
-	<</if>> /* closes .preg >= 10 */
-<</if>> /* END PREG EFFECTS */
-
-<<if $slaves[$i].belly >= 1000000>>
-	<<if $slaves[$i].bellySag < 50>>
-		<<set $slaves[$i].bellySag += 1>>
-		<<if $slaves[$i].preg > 0>>
-			<<set $slaves[$i].bellySagPreg += 1>>
-		<</if>>
-	<<elseif $slaves[$i].preg > 0 && $slaves[$i].bellySagPreg < 20>>
-		<<set $slaves[$i].bellySagPreg += 1>>
-	<</if>>
-	<<if $slaves[$i].pregControl == "speed up">>
-		<<set $slaves[$i].bellySag += 5, $slaves[$i].bellySagPreg += 5>>
-	<</if>>
-	<<if $slaves[$i].geneMods.rapidCellGrowth == 1>>
-		<<set $slaves[$i].bellySag += 3>>
-		<<if $slaves[$i].preg > 0>>
-			<<set $slaves[$i].bellySagPreg += 3>>
-		<</if>>
-	<</if>>
-<<elseif $slaves[$i].belly >= 750000>>
-	<<if $slaves[$i].bellySag < 30>>
-		<<set $slaves[$i].bellySag += 0.7>>
-		<<if $slaves[$i].preg > 0>>
-			<<set $slaves[$i].bellySagPreg += 0.7>>
-		<</if>>
-	<<elseif $slaves[$i].preg > 0 && $slaves[$i].bellySagPreg < 30>>
-		<<set $slaves[$i].bellySagPreg += 0.7>>
-	<</if>>
-	<<if $slaves[$i].pregControl == "speed up">>
-		<<set $slaves[$i].bellySag += 2, $slaves[$i].bellySagPreg += 2>>
-	<</if>>
-	<<if $slaves[$i].geneMods.rapidCellGrowth == 1>>
-		<<set $slaves[$i].bellySag += 1>>
-		<<if $slaves[$i].preg > 0>>
-			<<set $slaves[$i].bellySagPreg += 1>>
-		<</if>>
-	<</if>>
-<<elseif $slaves[$i].belly >= 600000>>
-	<<if $slaves[$i].bellySag < 20>>
-		<<set $slaves[$i].bellySag += 0.5>>
-		<<if $slaves[$i].preg > 0>>
-			<<set $slaves[$i].bellySagPreg += 0.5>>
-		<</if>>
-	<<elseif $slaves[$i].preg > 0 && $slaves[$i].bellySagPreg < 20>>
-		<<set $slaves[$i].bellySagPreg += 0.5>>
-	<</if>>
-	<<if $slaves[$i].pregControl == "speed up">>
-		<<set $slaves[$i].bellySag += 1, $slaves[$i].bellySagPreg += 1>>
-	<</if>>
-	<<if $slaves[$i].geneMods.rapidCellGrowth == 1>>
-		<<set $slaves[$i].bellySag += 1>>
-		<<if $slaves[$i].preg > 0>>
-			<<set $slaves[$i].bellySagPreg += 1>>
-		<</if>>
-	<</if>>
-<<elseif $slaves[$i].belly >= 450000>>
-	<<if $slaves[$i].bellySag < 15>>
-		<<set $slaves[$i].bellySag += 0.4>>
-		<<if $slaves[$i].preg > 0>>
-			<<set $slaves[$i].bellySagPreg += 0.4>>
-		<</if>>
-	<<elseif $slaves[$i].preg > 0 && $slaves[$i].bellySagPreg < 15>>
-		<<set $slaves[$i].bellySagPreg += 0.4>>
-	<</if>>
-	<<if $slaves[$i].pregControl == "speed up">>
-		<<set $slaves[$i].bellySag += 0.6, $slaves[$i].bellySagPreg += 0.6>>
-	<</if>>
-	<<if $slaves[$i].geneMods.rapidCellGrowth == 1>>
-		<<set $slaves[$i].bellySag += 0.5>>
-		<<if $slaves[$i].preg > 0>>
-			<<set $slaves[$i].bellySagPreg += 0.5>>
-		<</if>>
-	<</if>>
-<<elseif $slaves[$i].belly >= 300000>>
-	<<if $slaves[$i].bellySag < 10>>
-		<<set $slaves[$i].bellySag += 0.3>>
-		<<if $slaves[$i].preg > 0>>
-			<<set $slaves[$i].bellySagPreg += 0.3>>
-		<</if>>
-	<<elseif $slaves[$i].preg > 0 && $slaves[$i].bellySagPreg < 10>>
-		<<set $slaves[$i].bellySagPreg += 0.3>>
-	<</if>>
-	<<if $slaves[$i].pregControl == "speed up">>
-		<<set $slaves[$i].bellySag += 0.5, $slaves[$i].bellySagPreg += 0.5>>
-	<</if>>
-	<<if $slaves[$i].geneMods.rapidCellGrowth == 1>>
-		<<set $slaves[$i].bellySag += 0.5>>
-		<<if $slaves[$i].preg > 0>>
-			<<set $slaves[$i].bellySagPreg += 0.5>>
-		<</if>>
-	<</if>>
-<<elseif $slaves[$i].belly >= 100000>>
-	<<if $slaves[$i].bellySag < 10>>
-		<<set $slaves[$i].bellySag += 0.2>>
-		<<if $slaves[$i].preg > 0>>
-			<<set $slaves[$i].bellySagPreg += 0.2>>
-		<</if>>
-	<<elseif $slaves[$i].preg > 0 && $slaves[$i].bellySagPreg < 10>>
-		<<set $slaves[$i].bellySagPreg += 0.2>>
-	<</if>>
-	<<if $slaves[$i].pregControl == "speed up">>
-		<<set $slaves[$i].bellySag += 0.3, $slaves[$i].bellySagPreg += 0.3>>
-	<</if>>
-	<<if $slaves[$i].geneMods.rapidCellGrowth == 1>>
-		<<set $slaves[$i].bellySag += 0.3>>
-		<<if $slaves[$i].preg > 0>>
-			<<set $slaves[$i].bellySagPreg += 0.3>>
-		<</if>>
-	<</if>>
-<<elseif ($slaves[$i].bellyPreg >= 10000) || ($slaves[$i].bellyImplant >= 10000)>>
-	<<if $slaves[$i].bellySag < 5>>
-		<<set $slaves[$i].bellySag += 0.1>>
-		<<if $slaves[$i].preg > 0>>
-			<<set $slaves[$i].bellySagPreg += 0.1>>
-		<</if>>
-	<<elseif $slaves[$i].preg > 0 && $slaves[$i].bellySagPreg < 5>>
-		<<set $slaves[$i].bellySagPreg += 0.1>>
-	<</if>>
-	<<if $slaves[$i].pregControl == "speed up">>
-		<<set $slaves[$i].bellySag += 0.2, $slaves[$i].bellySagPreg += 0.2>>
-	<</if>>
-	<<if $slaves[$i].geneMods.rapidCellGrowth == 1>>
-		<<set $slaves[$i].bellySag += 0.2>>
-		<<if $slaves[$i].preg > 0>>
-			<<set $slaves[$i].bellySagPreg += 0.2>>
-		<</if>>
-	<</if>>
-<</if>>
-<<if $slaves[$i].bellySagPreg > $slaves[$i].bellySag>>
-	<<set $slaves[$i].bellySagPreg = $slaves[$i].bellySag>>
-<</if>>
-
-<<if $slaves[$i].bellySag > 0 && $slaves[$i].belly < 1500 && $slaves[$i].geneMods.rapidCellGrowth != 1>>
-	<<if $slaves[$i].muscles > 95>>
-		<<if (random(1,100) > 1)>>
-			<<if $slaves[$i].bellySagPreg > 0>>
-				<<set $slaves[$i].bellySag -= 0.5, $slaves[$i].bellySagPreg -= 0.5>>
-				<<if $slaves[$i].bellySag < 0>>
-					<<set $slaves[$i].bellySag = 0, $slaves[$i].bellySagPreg = 0>>
-				<</if>>
-			<<else>>
-				<<set $slaves[$i].bellySag -= 0.5>>
-				<<if $slaves[$i].bellySag < 0>>
-					<<set $slaves[$i].bellySag = 0>>
-				<</if>>
-			<</if>>
-		<</if>>
-	<<elseif $slaves[$i].muscles >= 30>>
-		<<if (random(1,100) > 20)>>
-			<<if $slaves[$i].bellySagPreg > 0>>
-				<<set $slaves[$i].bellySag -= 0.4, $slaves[$i].bellySagPreg -= 0.4>>
-				<<if $slaves[$i].bellySag < 0>>
-					<<set $slaves[$i].bellySag = 0, $slaves[$i].bellySagPreg = 0>>
-				<</if>>
-			<<else>>
-				<<set $slaves[$i].bellySag -= 0.4>>
-				<<if $slaves[$i].bellySag < 0>>
-					<<set $slaves[$i].bellySag = 0>>
-				<</if>>
-			<</if>>
-		<</if>>
-	<<elseif $slaves[$i].muscles >= 5>>
-		<<if (random(1,100) > 40)>>
-			<<if $slaves[$i].bellySagPreg > 0>>
-				<<set $slaves[$i].bellySag -= 0.3, $slaves[$i].bellySagPreg -= 0.3>>
-				<<if $slaves[$i].bellySag < 0>>
-					<<set $slaves[$i].bellySag = 0, $slaves[$i].bellySagPreg = 0>>
-				<</if>>
-			<<else>>
-				<<set $slaves[$i].bellySag -= 0.3>>
-				<<if $slaves[$i].bellySag < 0>>
-					<<set $slaves[$i].bellySag = 0>>
-				<</if>>
-			<</if>>
-		<</if>>
-	<<else>>
-		<<if (random(1,100) > 60)>>
-			<<if $slaves[$i].bellySagPreg > 0>>
-				<<set $slaves[$i].bellySag -= 0.2, $slaves[$i].bellySagPreg -= 0.2>>
-				<<if $slaves[$i].bellySag < 0>>
-					<<set $slaves[$i].bellySag = 0, $slaves[$i].bellySagPreg = 0>>
-				<</if>>
-			<<else>>
-				<<set $slaves[$i].bellySag -= 0.2>>
-				<<if $slaves[$i].bellySag < 0>>
-					<<set $slaves[$i].bellySag = 0>>
-				<</if>>
-			<</if>>
-		<</if>>
-	<</if>>
-<</if>>
-
-<<if ($slaves[$i].preg > $slaves[$i].pregData.minLiveBirth) && ($slaves[$i].broodmother == 0) && (random(1,100) < 90)>>
-	<<set $slaves[$i].counter.birthsTotal += WombBirthReady($slaves[$i], $slaves[$i].pregData.minLiveBirth), WombBirth($slaves[$i], $slaves[$i].pregData.minLiveBirth), WombFlush($slaves[$i])>>
-	<<if $slaves[$i].geneticQuirks.fertility+$slaves[$i].geneticQuirks.hyperFertility >= 4>>
-		<<set $slaves[$i].pregWeek = -2>>
-	<<elseif $slaves[$i].geneticQuirks.hyperFertility > 1>>
-		<<set $slaves[$i].pregWeek = -3>>
-	<<else>>
-		<<set $slaves[$i].pregWeek = -4>>
-	<</if>>
-	<<if $slaves[$i].birthsTat > -1>>
-		<<set $slaves[$i].birthsTat++>>
-	<</if>>
-<<elseif ($slaves[$i].preg > $slaves[$i].pregData.normalBirth) && ($slaves[$i].broodmother == 0)>>
-	<<set $slaves[$i].counter.birthsTotal += WombBirthReady($slaves[$i], $slaves[$i].pregData.minLiveBirth), WombBirth($slaves[$i], $slaves[$i].pregData.minLiveBirth), WombFlush($slaves[$i])>>
-	<<if $slaves[$i].geneticQuirks.fertility+$slaves[$i].geneticQuirks.hyperFertility >= 4>>
-		<<set $slaves[$i].pregWeek = -2>>
-	<<elseif $slaves[$i].geneticQuirks.hyperFertility > 1>>
-		<<set $slaves[$i].pregWeek = -3>>
-	<<else>>
-		<<set $slaves[$i].pregWeek = -4>>
-	<</if>>
-	<<if $slaves[$i].birthsTat > -1>>
-		<<set $slaves[$i].birthsTat++>>
-	<</if>>
-<<elseif ($slaves[$i].preg > 37) && ($slaves[$i].broodmother > 0)>>
-	<<if $slaves[$i].broodmother > 0>>
-		<<set $slaves[$i].counter.birthsTotal += WombBirthReady($slaves[$i], 37), WombBirth($slaves[$i], 37), $slaves[$i].preg = WombMaxPreg($slaves[$i])>>
-	<</if>>
-	<<if $slaves[$i].birthsTat > -1>>
-		<<set $slaves[$i].birthsTat++>>
-	<</if>>
-<</if>>
-
-<<run SetBellySize($slaves[$i])>> /*Actually it's now better to set belly size without checking of any conditions. Just to be sure. Should correct forgotten variables too. */
-
-<<if ($slaves[$i].lactation == 1)>>
-	<<if $slaves[$i].fetish != "boobs">>
-		<<if $slaves[$i].lactationDuration == 0>>
-			<<set $slaves[$i].boobs -= $slaves[$i].boobsMilk>>
-			<<set $slaves[$i].boobsMilk = 0, $slaves[$i].lactation = 0>>
-		<<elseif $slaves[$i].lactationDuration == 1>>
-			<<set $slaves[$i].boobsMilk += 10*$slaves[$i].lactationAdaptation>>
-			<<set $slaves[$i].boobs += $slaves[$i].boobsMilk>>
-		<<else>>
-			<<set $slaves[$i].lactationDuration-->>
-		<</if>>
-	<<else>>
-		<<set $slaves[$i].lactationDuration = 2>>
-	<</if>>
-<<elseif $slaves[$i].lactation == 2>>
-	<<set $slaves[$i].lactationDuration = 2>>
-<<elseif $slaves[$i].fetish == "boobs" && $slaves[$i].boobs-$slaves[$i].boobsImplant >= 2000>>
-	<<set $slaves[$i].induceLactation += 2>>
-	<<if $slaves[$i].lactationDuration >= 20>>
-		<<set $slaves[$i].induceLactation = 0, $slaves[$i].lactationDuration = 2, $slaves[$i].lactation = 1>>
-	<</if>>
-<</if>>
-
-<<if $slaves[$i].induceLactation > 0>>
-	<<set $slaves[$i].induceLactation-->>
-<</if>>
-
-<<if $slaves[$i].geneticQuirks.gigantomastia == 3 && random(70-$slaves[$i].physicalAge,300) < $slaves[$i].hormoneBalance>>
-	<<set $slaves[$i].geneticQuirks.gigantomastia = 2>>
-<</if>>
-<<if $slaves[$i].geneticQuirks.macromastia == 3 && random(70-$slaves[$i].physicalAge,300) < $slaves[$i].hormoneBalance>>
-	<<set $slaves[$i].geneticQuirks.macromastia = 2>>
-<</if>>
-
-<<if ($slaves[$i].hStyle != "shaved" && $slaves[$i].bald != 1 && $slaves[$i].haircuts == 0) && ($slaves[$i].hLength < 150)>>
-	<<set $slaves[$i].hLength += 1>>
-<</if>>
-
-<<set $slaves[$i].illness = 0>>
diff --git a/src/pregmod/widgets/pregmodBirthWidgets.tw b/src/pregmod/widgets/pregmodBirthWidgets.tw
index 733708b96d901a75dc0467a8ae28429d17b1f24f..16eb04389ce628158d9e517745225e43f9b4dbe6 100644
--- a/src/pregmod/widgets/pregmodBirthWidgets.tw
+++ b/src/pregmod/widgets/pregmodBirthWidgets.tw
@@ -1031,7 +1031,7 @@
 
 <<case "be your Head Girl">>
 	<<if (random(1,20) > $suddenBirth)>>
-		<<set _HGL = $HGSuiteiIDs.length>>
+		<<set _HGL = App.Entity.facilities.headGirlSuite.employeesIDs().size>>
 		$He returns to <<if $HGSuite == 1>>$his room's bed<<else>>$his bed<</if>> and strips before slipping into it. $He makes $himself comfortable<<if _HGL != 0>>, as $his slave rushes to $his side,<</if>> and begins working on birthing <<if $slaves[$i].counter.birthsTotal == 0>>$his first<<else>>this week's<</if>> baby. $His child is promptly taken<<if _HGL != 0>> by $his roommate<</if>> and $he rests awhile before returning to managing your slaves.
 	<<else>>
 		While overseeing your other slaves, $slaves[$i].slaveName's water breaks. $He attempts to hold back the coming birth until $he can catch a break in $his duties but ultimately fails.
diff --git a/src/uncategorized/PETS.tw b/src/uncategorized/PETS.tw
index c463f473ade377fd792544dc1be0bf566eb91334..b36ce153d9bc665ecc637b7a59b6871376341fba 100644
--- a/src/uncategorized/PETS.tw
+++ b/src/uncategorized/PETS.tw
@@ -274,13 +274,13 @@ You decide to knit up care's raveled sleave with a break in the spa. You have yo
 <<link "Encourage the schoolteacher to abuse poor students">>
 	<<replace "#result">>
 	You lean against the doorway of the classroom. $activeSlave.slaveName glances at you, but you subtly let $him know to continue with $his business. When $he finishes the lesson and, around the same time, climaxes, you clear your throat. The students all start with surprise and turn to you with trepidation. You observe in a conversational tone of voice that $activeSlave.slaveName is making great sacrifices here, performing an unsexy, boring job, and that any slave that does not work hard to learn will find themselves at the teacher's sexual disposal. Several of the least attentive students @@.green;try to look studious,@@ though a few of the better ones can't hide a certain anticipation.
-	<<run $slaves.forEach(function(s) {
-		if (s.assignment == "learn in the schoolroom" && s.intelligenceImplant < 30) {
+	<<run App.Entity.facilities.schoolroom.employees().forEach(function(s) {
+		if (s.intelligenceImplant < 30) {
 			s.intelligenceImplant += 0.1;
 			s.counter.oral += 1;
+			V.oralTotal += 1;
 		};
 	})>>
-	<<set $oralTotal += $SchlRiIDs.length>>
 	<</replace>>
 <</link>>
 <br><<link "Take the delinquent student in hand">>
diff --git a/src/uncategorized/RESS.tw b/src/uncategorized/RESS.tw
index 0e8c67305ce4b7938467aac3f7b1e175ef9223db..194396d4952f9b5a39d4d651658321d3d957dba9 100644
--- a/src/uncategorized/RESS.tw
+++ b/src/uncategorized/RESS.tw
@@ -18128,17 +18128,8 @@ brought in to you. This time <<= App.UI.slaveDescriptionDialog($activeSlave)>> h
 <<link "Ask $him about $his fantasy">>
 	<<setNonlocalPronouns $seeDicks>>
 	<<replace "#result">>
-		<<set _pussy = false, _balls = false>>
-		<<for _ress = 0; _ress < $ArcadeiIDs.length; _ress++>>
-			<<if $slaves[$slaveIndices[$ArcadeiIDs[_ress]]].vagina > 0>>
-				<<set _pussy = true>><<break>>
-			<</if>>
-		<</for>>
-		<<for _ress = 0; _ress < $ArcadeiIDs.length; _ress++>>
-			<<if $slaves[$slaveIndices[$ArcadeiIDs[_ress]]].balls > 0>>
-				<<set _balls = true>><<break>>
-			<</if>>
-		<</for>>
+		<<set _pussy = App.Entity.facilities.arcade.employees().some(s => s.vagina > 0)>>
+		<<set _balls = App.Entity.facilities.arcade.employees().some(s => s.balls > 0)
 		You order $him to explain further. "<<Master>>," $he <<say>>s carefully, "it'<<s>> $arcadeName. There'<<s>> a <<s>>pe<<c>>ific pla<<c>>e there, and, well, I can't de<<s>>cribe it. It'<<s>> in the <<s>>ervi<<c>>e area under $arcadeName. Can I <<sh>>ow you what I mean?" Intrigued, you order $him to show you the place $he's talking about, and lead $him to $arcadeName through the access hallway. $He points to the service tunnel under one of the rows of inmates, which allows trusted slaves to clean up and perform maintenance.
 		<<if $activeSlave.belly >= 100000>>
 			Once you've managed to shove the massive slut
@@ -18186,11 +18177,11 @@ brought in to you. This time <<= App.UI.slaveDescriptionDialog($activeSlave)>> h
 				Fucking $him here would be interesting; unfortunately, there just isn't enough room for two mothers-to-be.
 			<</if>>
 			<br><<link "Teach $him about true sadism">>
-				<<set _ress = $slaveIndices[$ArcadeiIDs.random()]>>
-				<<setLocalPronouns $slaves[_ress] 2>>
+				<<set _ress = App.Entity.facilities.arcade.employees().random()>>
+				<<setLocalPronouns _ress 2>>
 				<<replace "#result2">>
 					$He seems to be focusing on the purely physical aspects of the degradation here. The true meaning of this place is so much more, and you decide to share it with $him. You call $his name, tearing $his attention away from the spectacle mere <<if $showInches == 2>>inches<<else>>centimeters<</if>> over your heads, and <<if canSee($activeSlave)>>point<<else>>direct $him<</if>> to a particular slave. You tell $activeSlave.slaveName that this particular Arcade inmate's name is
-					<<= SlaveFullName($slaves[_ress])>>. You tell $him that _he2 is $slaves[_ress].actualAge years old, that _he2 is $slaves[_ress].nationality, and that _he2 was once <<= convertCareer($slaves[_ress])>>. You list more details of _his2 life before _he2 was placed here to be fucked endlessly. $activeSlave.slaveName's eyes widen as you recite the details of the prior life of this piece of human sexual equipment and the sheer weight of the intellectual sadism smashes into $him. Then the slave above you both jerks a little. <<if $activeSlave.dick == 0>>There's no visible sign _his2 pussy's being fucked, so it must be<<else>>_His2 cock hardens involuntarily, indicating that it's<</if>> going into _his2 ass. You resume, mentioning that _he2's been buttfucked $slaves[_ress].counter.anal times.
+					<<= SlaveFullName(_ress)>>. You tell $him that _he2 is _ress.actualAge years old, that _he2 is _ress.nationality, and that _he2 was once <<= convertCareer(_ress)>>. You list more details of _his2 life before _he2 was placed here to be fucked endlessly. $activeSlave.slaveName's eyes widen as you recite the details of the prior life of this piece of human sexual equipment and the sheer weight of the intellectual sadism smashes into $him. Then the slave above you both jerks a little. <<if $activeSlave.dick == 0>>There's no visible sign _his2 pussy's being fucked, so it must be<<else>>_His2 cock hardens involuntarily, indicating that it's<</if>> going into _his2 ass. You resume, mentioning that _he2's been buttfucked _ress.counter.anal times.
 					$activeSlave.slaveName jerks suddenly, <<if canAchieveErection($activeSlave)>>shooting $his cum onto the floor<<elseif $activeSlave.vagina < 0>>dribbling a little<<elseif $activeSlave.vaginaLube > 0>>squirting onto the floor<<else>>orgasming<</if>>. $He came without being touched. $He <<if canSee($activeSlave)>>stares at<<else>>faces<</if>> the mess $he made just by being in the presence of the arcology's @@.hotpink;undisputed preeminent sadist;@@ $he shudders at the sheer gothic glory of it. $He has a new moment to think of when $he feels like @@.lightsalmon;indulging $his own sadism.@@
 				<</replace>>
 				<<set $activeSlave.devotion += 5, $activeSlave.fetishStrength = Math.clamp($activeSlave.fetishStrength+10, 0, 100)>>
diff --git a/src/uncategorized/arcade.tw b/src/uncategorized/arcade.tw
index ff29e44aa97626a585b961dd1b6468dc5c20e2e8..4baa5e2d316de585d71689e32d3ade24059ff152 100644
--- a/src/uncategorized/arcade.tw
+++ b/src/uncategorized/arcade.tw
@@ -1,6 +1,6 @@
 :: Arcade [nobr]
 
-<<set $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Arcade", $showEncyclopedia = 1, $encyclopedia = "Arcade", _AL = $ArcadeiIDs.length>>
+<<set $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Arcade", $showEncyclopedia = 1, $encyclopedia = "Arcade", _AL = App.Entity.facilities.arcade.employeesIDs().size>>
 
 <p class="scene-intro">
 	<<if $arcadeName != "the Arcade">>
diff --git a/src/uncategorized/arcadeReport.tw b/src/uncategorized/arcadeReport.tw
index 8122b65e2d1b1ac8a62fecfdcc3595d08d5e4982..6e59f20e62cb69fc1cdfdf196e77b378593b613b 100644
--- a/src/uncategorized/arcadeReport.tw
+++ b/src/uncategorized/arcadeReport.tw
@@ -3,8 +3,8 @@
 <span id="arcadestats">
 </span>
 
-<<SlaveIDSort $ArcadeiIDs>>
-<<set _DL = $ArcadeiIDs.length, _SL = $slaves.length, _cockmilked = 0, _milked = 0, _milkprofits = 0, _profits = 0, _oldCash = 0, _boobsImplanted = 0, _prostatesImplanted = 0, _vasectomiesUndone = 0, _mSlave = 0, _bSlave = 0, _pSlave = 0, _cSlave = 0>>
+<<set _slaves = App.Utils.sortedEmployees(App.Entity.facilities.arcade)>>
+<<set _DL = _slaves.length, _SL = $slaves.length, _cockmilked = 0, _milked = 0, _milkprofits = 0, _profits = 0, _oldCash = 0, _boobsImplanted = 0, _prostatesImplanted = 0, _vasectomiesUndone = 0, _mSlave = 0, _bSlave = 0, _pSlave = 0, _cSlave = 0>>
 
 <!-- Statistics gathering -->
 <<set $facility = $facility || {}, $facility.arcade = initFacilityStatistics($facility.arcade)>>
@@ -23,42 +23,42 @@
 	<br><br>&nbsp;&nbsp;&nbsp;&nbsp;$arcadeNameCaps's customers enjoy @@.green;getting off in $arcadeDecoration surroundings.@@
 <</if>>
 
-<<for _dI = 0; _dI < _DL; _dI++>>
-	<<set $i = $slaveIndices[$ArcadeiIDs[_dI]]>>
-	<<setLocalPronouns $slaves[$i]>>
+<<for _slave range _slaves>>
+	<<setLocalPronouns _slave>>
+	<<set $i = $slaveIndices[_slave.ID]>> /% for the included passages %/
 
 	/* Perform facility based rule changes */
-	<<set $slaves[$i].clothes = "no clothing">>
+	<<set _slave.clothes = "no clothing">>
 	/* Health */
-	<<if $arcadeUpgradeHealth == 2 && $slaves[$i].health.condition < 40>>
-		<<run improveCondition($slaves[$i], 2)>>
-	<<elseif $slaves[$i].health.condition > 20>>
-		<<run healthDamage($slaves[$i], 5)>>
-	<<elseif $arcadeUpgradeHealth == 1 && $slaves[$i].health.condition < -30>>
-		<<run improveCondition($slaves[$i], 2)>>
-	<<elseif $slaves[$i].health.condition > -50>>
-		<<run healthDamage($slaves[$i], 3)>>
-	<<elseif $slaves[$i].health.condition > -90>>
-		<<run healthDamage($slaves[$i], 1)>>
+	<<if $arcadeUpgradeHealth == 2 && _slave.health.condition < 40>>
+		<<run improveCondition(_slave, 2)>>
+	<<elseif _slave.health.condition > 20>>
+		<<run healthDamage(_slave, 5)>>
+	<<elseif $arcadeUpgradeHealth == 1 && _slave.health.condition < -30>>
+		<<run improveCondition(_slave, 2)>>
+	<<elseif _slave.health.condition > -50>>
+		<<run healthDamage(_slave, 3)>>
+	<<elseif _slave.health.condition > -90>>
+		<<run healthDamage(_slave, 1)>>
 	<</if>>
 	/* Curatives */
 	<<if $arcadeUpgradeHealth == 2>>
-		<<set $slaves[$i].curatives = 2>>
+		<<set _slave.curatives = 2>>
 	<<elseif $arcadeUpgradeHealth == 1>>
-		<<set $slaves[$i].curatives = 1>>
+		<<set _slave.curatives = 1>>
 	<</if>>
 	/* Stimulation or lack thereof trust/devotion effect */
 	<<if ($arcadeUpgradeInjectors > 0)>>
 		<<if $arcadeUpgradeInjectors == 2>>
-			<<set $slaves[$i].aphrodisiacs = 2>>
+			<<set _slave.aphrodisiacs = 2>>
 		<</if>>
-		<<set $slaves[$i].devotion -= 5, $slaves[$i].trust -= 10>>
+		<<set _slave.devotion -= 5, _slave.trust -= 10>>
 	<<else>>
-		<<set $slaves[$i].trust -= 5>>
+		<<set _slave.trust -= 5>>
 	<</if>>
 	/* Muscles */
-	<<if ($slaves[$i].muscles > -100)>>
-		<<set $slaves[$i].muscles-->>
+	<<if (_slave.muscles > -100)>>
+		<<set _slave.muscles-->>
 	<</if>>
 
 	<<if $showEWD != 0>>
@@ -66,85 +66,85 @@
 		/* 000-250-006 */
 		<<if $seeImages && $seeReportImages>>
 			<div class="imageRef tinyImg">
-				<<= SlaveArt($slaves[$i], 0, 0)>>
+				<<= SlaveArt(_slave, 0, 0)>>
 			</div>
 		<</if>>
 		/* 000-250-006 */
-		<span class='slave-name'><<= SlaveFullName($slaves[$i])>></span>
-		<<if $slaves[$i].choosesOwnAssignment == 2>>
+		<span class='slave-name'><<= SlaveFullName(_slave)>></span>
+		<<if _slave.choosesOwnAssignment == 2>>
 			<<include "SA chooses own job">>
 		<<else>>
 			is confined in $arcadeName.
 		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.workAGloryHole($slaves[$i])>>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.workAGloryHole(_slave)>>
 	<<else>>
 		<<silently>>
 			<<include "SA chooses own job">>
-			<<run App.SlaveAssignment.workAGloryHole($slaves[$i])>>
+			<<run App.SlaveAssignment.workAGloryHole(_slave)>>
 		<</silently>>
 	<</if>>
 	<<if ($arcadeUpgradeCollectors > 0)>>
-		<<if ($slaves[$i].vasectomy == 1)>>
-			<<set $slaves[$i].vasectomy = 0, _vasectomiesUndone++>>
-			<<run cashX(forceNeg($surgeryCost), "slaveSurgery", $slaves[$i]), surgeryDamage($slaves[$i], 10)>>
-		<<elseif ($slaves[$i].lactation < 2)>>
-			<<set $slaves[$i].lactation = 2, _boobsImplanted++>>
-			<<set _bSlave = $slaves[$i]>>
-			<<run cashX(forceNeg($surgeryCost), "slaveSurgery", $slaves[$i]), surgeryDamage($slaves[$i], 10)>>
-		<<elseif $slaves[$i].prostate == 1>>
-			<<set $slaves[$i].prostate = 2, _prostatesImplanted++>>
-			<<set _pSlave = $slaves[$i]>>
-			<<run cashX(forceNeg($surgeryCost), "slaveSurgery", $slaves[$i]), surgeryDamage($slaves[$i], 10)>>
-		<<elseif ($slaves[$i].lactation > 0) || ($slaves[$i].balls > 0)>>
+		<<if (_slave.vasectomy == 1)>>
+			<<set _slave.vasectomy = 0, _vasectomiesUndone++>>
+			<<run cashX(forceNeg($surgeryCost), "slaveSurgery", _slave), surgeryDamage(_slave, 10)>>
+		<<elseif (_slave.lactation < 2)>>
+			<<set _slave.lactation = 2, _boobsImplanted++>>
+			<<set _bSlave = _slave>>
+			<<run cashX(forceNeg($surgeryCost), "slaveSurgery", _slave), surgeryDamage(_slave, 10)>>
+		<<elseif _slave.prostate == 1>>
+			<<set _slave.prostate = 2, _prostatesImplanted++>>
+			<<set _pSlave = _slave>>
+			<<run cashX(forceNeg($surgeryCost), "slaveSurgery", _slave), surgeryDamage(_slave, 10)>>
+		<<elseif (_slave.lactation > 0) || (_slave.balls > 0)>>
 			<<set _oldCash = $cash>>
 			<<if $showEWD != 0>>
-				<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.getMilked($slaves[$i])>>
+				<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.getMilked(_slave)>>
 			<<else>>
-				<<run App.SlaveAssignment.getMilked($slaves[$i])>>
+				<<run App.SlaveAssignment.getMilked(_slave)>>
 			<</if>>
 			<<set _milkprofits += $cash-_oldCash>>
 			<<set _growth = 0>>
-			<<set _gigantomastiaMod = $slaves[$i].geneticQuirks.gigantomastia == 2 ? ($slaves[$i].geneticQuirks.macromastia == 2 ? 3 : 2) : 1>>
-			<<if ($slaves[$i].boobs < 2000)>>
+			<<set _gigantomastiaMod = _slave.geneticQuirks.gigantomastia == 2 ? (_slave.geneticQuirks.macromastia == 2 ? 3 : 2) : 1>>
+			<<if (_slave.boobs < 2000)>>
 				<<set _growth = 100>>
-			<<elseif ($slaves[$i].boobs < 5000*_gigantomastiaMod)>>
+			<<elseif (_slave.boobs < 5000*_gigantomastiaMod)>>
 				<<set _growth = 50>>
-			<<elseif ($slaves[$i].boobs < 10000*_gigantomastiaMod)>>
+			<<elseif (_slave.boobs < 10000*_gigantomastiaMod)>>
 				<<set _growth = 25>>
 			<</if>>
-			<<if ($slaves[$i].geneMods.NCS == 1)>>
+			<<if (_slave.geneMods.NCS == 1)>>
 				/*
 				** NCS will allow some growth for Arcade milking, but not as much as the Dairy.
 				*/
 				<<set _growth = Math.trunc(_growth/3.5)>>
 			<</if>>
-			<<set $slaves[$i].boobs += _growth>>
-			<<if (($slaves[$i].balls > 0) && ($slaves[$i].balls < 10) && (random(1,100) > (40 + (10 * ($slaves[$i].balls + (2 * $slaves[$i].geneMods.NCS))))))>>
-				<<set $slaves[$i].balls++>>
+			<<set _slave.boobs += _growth>>
+			<<if ((_slave.balls > 0) && (_slave.balls < 10) && (random(1,100) > (40 + (10 * (_slave.balls + (2 * _slave.geneMods.NCS))))))>>
+				<<set _slave.balls++>>
 			<</if>>
-			<<if (($slaves[$i].dick > 0) && ($slaves[$i].dick < 10) && (random(1,100) > (40 + (10 * $slaves[$i].dick + (2 * $slaves[$i].geneMods.NCS)))))>>
-				<<set $slaves[$i].dick++>>
+			<<if ((_slave.dick > 0) && (_slave.dick < 10) && (random(1,100) > (40 + (10 * _slave.dick + (2 * _slave.geneMods.NCS)))))>>
+				<<set _slave.dick++>>
 			<</if>>
-			<<if ($slaves[$i].lactation > 0)>>
+			<<if (_slave.lactation > 0)>>
 				<<set _milked++>>
-				<<set _mSlave = $slaves[$i]>>
+				<<set _mSlave = _slave>>
 			<</if>>
-			<<if ($slaves[$i].balls > 0)>>
+			<<if (_slave.balls > 0)>>
 				<<set _cockmilked++>>
-				<<set _cSlave = $slaves[$i]>>
+				<<set _cSlave = _slave>>
 			<</if>>
 		<</if>>
 	<</if>>
-	<<if ($slaves[$i].inflation > 0)>>
-		<<set $slaves[$i].inflation = 0, $slaves[$i].inflationType = "none", $slaves[$i].inflationMethod = 0, $slaves[$i].milkSource = 0>>
-		<<run SetBellySize($slaves[$i])>>
+	<<if (_slave.inflation > 0)>>
+		<<set _slave.inflation = 0, _slave.inflationType = "none", _slave.inflationMethod = 0, _slave.milkSource = 0>>
+		<<run SetBellySize(_slave)>>
 	<</if>>
 	<<if $showEWD != 0>>
 		<br>&nbsp;&nbsp;&nbsp;
 		<<include "SA rules">>
 		<<include "SA diet">>
 		<<include "SA long term effects">>
-		<<= App.SlaveAssignment.drugs($slaves[$i])>>
+		<<= App.SlaveAssignment.drugs(_slave)>>
 		<<include "SA relationships">>
 		<<include "SA rivalries">>
 		<br><<include "SA devotion">>
@@ -153,7 +153,7 @@
 		<<include "SA rules">>
 		<<include "SA diet">>
 		<<include "SA long term effects">>
-		<<run App.SlaveAssignment.drugs($slaves[$i])>>
+		<<run App.SlaveAssignment.drugs(_slave)>>
 		<<include "SA relationships">>
 		<<include "SA rivalries">>
 		<<include "SA devotion">>
@@ -223,30 +223,29 @@
 
 <<if ($arcadeUpgradeFuckdolls == 2)>>
 	<<set $activeSlave = 0, _Age = -1, _FD = -1, _MB = -1, _Con = -1>>
-	<<for _dI = 0; _dI < _DL; _dI++>>
-		<<set $i = $slaveIndices[$ArcadeiIDs[_dI]]>>
-		<<if $slaves[$i].sentence == 0>> /* let's not convert slaves we are punishing into Fuckdolls */
-			<<if ($slaves[$i].fetish == "mindbroken")>>
-				<<if ($slaves[$i].fuckdoll == 0)>>
-					<<if ($slaves[$i].physicalAge > 35)>>
+	<<for _slave range _slaves>>
+		<<if _slave.sentence == 0>> /* let's not convert slaves we are punishing into Fuckdolls */
+			<<if (_slave.fetish == "mindbroken")>>
+				<<if (_slave.fuckdoll == 0)>>
+					<<if (_slave.physicalAge > 35)>>
 						<<set _Age = $i>>
 						<<break>>
 					<<elseif _FD == -1>>
 						<<set _FD = $i>>
 					<</if>>
 				<<elseif _MB == -1>>
-					<<if $slaves[$i].vagina >= 4 || $slaves[$i].anus >= 4>>
+					<<if _slave.vagina >= 4 || _slave.anus >= 4>>
 						<<set _Con = $i>>
-					<<elseif $slaves[$i].physicalAge > 35>>
+					<<elseif _slave.physicalAge > 35>>
 						<<set _Age = $i>>
 					<<else>>
 						<<set _MB = $i>>
 					<</if>>
 				<</if>>
 			<<elseif _Con == -1>>
-				<<if $slaves[$i].vagina >= 4 || $slaves[$i].anus >= 4>>
+				<<if _slave.vagina >= 4 || _slave.anus >= 4>>
 					<<set _Con = $i>>
-				<<elseif $slaves[$i].physicalAge > 35>>
+				<<elseif _slave.physicalAge > 35>>
 					<<set _Age = $i>>
 				<</if>>
 			<</if>>
diff --git a/src/uncategorized/arcmgmt.tw b/src/uncategorized/arcmgmt.tw
index 2fb07bc4bf41db1d6d9788728b0213d27b0861fb..ae50850d999abf599b084c424a500c6c11b3e435 100644
--- a/src/uncategorized/arcmgmt.tw
+++ b/src/uncategorized/arcmgmt.tw
@@ -1317,7 +1317,7 @@ You own
 
 
 <<if $fuckdolls > 0>>
-	<<set _AL = $ArcadeiIDs.length>>
+	<<set _AL = App.Entity.facilities.arcade.employeesIDs().size>>
 	<<if ($fuckdolls > $arcade - _AL) && ($arcade > _AL)>>
 		<<set _fuckdollsArcade = $arcade - _AL>>
 	<<elseif $fuckdolls < $arcade - _AL>>
diff --git a/src/uncategorized/brothel.tw b/src/uncategorized/brothel.tw
index e8268bf1fdf16ff8bea7ab31ea127284ca5013c3..29755dcf271fd7a914f3878cff276013414fa3c6 100644
--- a/src/uncategorized/brothel.tw
+++ b/src/uncategorized/brothel.tw
@@ -1,6 +1,6 @@
 :: Brothel [nobr]
 
-<<set $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Brothel", $showEncyclopedia = 1, $encyclopedia = "Brothel", _BL = $BrothiIDs.length>>
+<<set $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Brothel", $showEncyclopedia = 1, $encyclopedia = "Brothel", _BL = App.Entity.facilities.brothel.employeesIDs().size>>
 
 <p class="scene-intro">
 	<<if $brothelName != "the Brothel">>
diff --git a/src/uncategorized/brothelAdvertisement.tw b/src/uncategorized/brothelAdvertisement.tw
index 90d9a7cf0fa7c8ddd40520a2eafa4ee4dd440c46..6578d5031a708863ca4d0914c2ca146846bb7577 100644
--- a/src/uncategorized/brothelAdvertisement.tw
+++ b/src/uncategorized/brothelAdvertisement.tw
@@ -133,7 +133,7 @@
 	<div>
 		You are spending <<print cashFormatColor(forceNeg($brothelAdsSpending))>> each week to advertise $brothelName.
 		<<if $lastWeeksCashIncome.brothelAds > 0>>
-			Last week's ads increased profits by <<print cashFormatColor($lastWeeksCashIncome.brothelAds)>><<if $BrothiIDs.length > 1>> and also increased business for your whores<</if>>, and cost <<print cashFormatColor(forceNeg($lastWeeksCashExpenses.brothelAds))>>.
+			Last week's ads increased profits by <<print cashFormatColor($lastWeeksCashIncome.brothelAds)>><<if App.Entity.facilities.brothel.employeesIDs().size > 1>> and also increased business for your whores<</if>>, and cost <<print cashFormatColor(forceNeg($lastWeeksCashExpenses.brothelAds))>>.
 		<</if>>
 	</div>
 
diff --git a/src/uncategorized/brothelReport.tw b/src/uncategorized/brothelReport.tw
index b31a1b09d83819b1f41bb09223525eddc72fa219..fd1b2b681c5e5e4eee2def624caae4b0d3239bcd 100644
--- a/src/uncategorized/brothelReport.tw
+++ b/src/uncategorized/brothelReport.tw
@@ -3,8 +3,8 @@
 <span id="brothelstats">
 </span>
 
-<<SlaveIDSort $BrothiIDs>>
-<<set _DL = $BrothiIDs.length, _SL = $slaves.length, $legendaryWhoreID = 0, _FLsFetish = 0, _profits = 0>>
+<<set _slaves = App.Utils.sortedEmployees(App.Entity.facilities.brothel)>>
+<<set _DL = _slaves.length, _SL = $slaves.length, $legendaryWhoreID = 0, _FLsFetish = 0, _profits = 0>>
 <<set $legendaryWombID = 0>>
 <<set _minBonus = 50, _maxBonus = 150>>
 
@@ -81,84 +81,85 @@
 	<<if ($Madam.dick > 2) && (canPenetrate($Madam))>>
 		$His turgid dick helps $him manage the bitches.
 	<</if>>
-	<<for _dI = 0; _dI < _DL; _dI++>>
-		<<set $i = $slaveIndices[$BrothiIDs[_dI]]>>
-		<<if $Madam.rivalryTarget == $slaves[$i].ID>>
+	<<for _slave range _slaves>>
+		<<set $i = $slaveIndices[_slave.ID]>> /% for the included passages %/
+
+		<<if $Madam.rivalryTarget == _slave.ID>>
 			$He forces $his <<print rivalryTerm($Madam)>>, to service all the men in the brothel.
-			<<set $slaves[$i].devotion -= 2, $slaves[$i].trust -= 2>>
-			<<if canDoVaginal($slaves[$i])>>
+			<<set _slave.devotion -= 2, _slave.trust -= 2>>
+			<<if canDoVaginal(_slave)>>
 				<<run seX($activeSlave, "vaginal", "public", "penetrative", 10)>>
 			<</if>>
-			<<if canDoAnal($slaves[$i])>>
+			<<if canDoAnal(_slave)>>
 				<<run seX($activeSlave, "anal", "public", "penetrative", 12)>>
 			<</if>>
 			<<run seX($activeSlave, "anal", "public", "penetrative", 10)>>
 			<<if random(1,100) > 65>>
-				<<set $slaves[_FLs].rivalry++, $Madam.rivalry++, $slaves[$i].rivalry++>>
+				<<set $slaves[_FLs].rivalry++, $Madam.rivalry++, _slave.rivalry++>>
 			<</if>>
-		<<elseif $Madam.relationshipTarget == $slaves[$i].ID>>
-			<<setLocalPronouns $slaves[$i] 2>>
-			$He dotes over $his <<print relationshipTerm($Madam)>>, $slaves[$i].slaveName, making sure _he2 is safe, but unfortunately driving potential customers away from _him2.
-			<<set $slaves[$i].devotion++>>
-		<<elseif areRelated($Madam, $slaves[$i])>>
-			<<setLocalPronouns $slaves[$i] 2>>
-			$He pays special attention to $his <<print relativeTerm($Madam,$slaves[$i])>>, $slaves[$i].slaveName, making sure _he2 is treated well and showing off _his2 skills.
-			<<set $slaves[$i].trust++>>
+		<<elseif $Madam.relationshipTarget == _slave.ID>>
+			<<setLocalPronouns _slave 2>>
+			$He dotes over $his <<print relationshipTerm($Madam)>>, _slave.slaveName, making sure _he2 is safe, but unfortunately driving potential customers away from _him2.
+			<<set _slave.devotion++>>
+		<<elseif areRelated($Madam, _slave)>>
+			<<setLocalPronouns _slave 2>>
+			$He pays special attention to $his <<print relativeTerm($Madam,_slave)>>, _slave.slaveName, making sure _he2 is treated well and showing off _his2 skills.
+			<<set _slave.trust++>>
 		<</if>>
-		<<if $slaves[$i].prestigeDesc == "$He is a famed Free Cities whore, and commands top prices.">>
-			<<setLocalPronouns $slaves[$i] 2>>
-			$He makes sure to promote $slaves[$i].slaveName, the famed whore, in order to capitalize on _his2 popularity.
-		<<elseif $slaves[$i].prestigeDesc == "$He is a famed Free Cities slut, and can please anyone.">>
-			<<setLocalPronouns $slaves[$i] 2>>
-			$He makes sure to promote $slaves[$i].slaveName, the famed entertainer, in order to capitalize on _his2 popularity.
-		<<elseif $slaves[$i].prestigeDesc == "$He is remembered for winning best in show as a dairy cow.">>
-			<<setLocalPronouns $slaves[$i] 2>>
+		<<if _slave.prestigeDesc == "$He is a famed Free Cities whore, and commands top prices.">>
+			<<setLocalPronouns _slave 2>>
+			$He makes sure to promote _slave.slaveName, the famed whore, in order to capitalize on _his2 popularity.
+		<<elseif _slave.prestigeDesc == "$He is a famed Free Cities slut, and can please anyone.">>
+			<<setLocalPronouns _slave 2>>
+			$He makes sure to promote _slave.slaveName, the famed entertainer, in order to capitalize on _his2 popularity.
+		<<elseif _slave.prestigeDesc == "$He is remembered for winning best in show as a dairy cow.">>
+			<<setLocalPronouns _slave 2>>
 			<<if ($arcologies[0].FSPhysicalIdealist != "unset")>>
-				<<if ($slaves[$i].muscles > 60) && ($slaves[$i].weight < 30) && ($slaves[$i].lactation > 0) && (($slaves[$i].boobs-$slaves[$i].boobsImplant) > 6000)>>
-					$He shows off how even a cow like $slaves[$i].slaveName can achieve physical perfection.
+				<<if (_slave.muscles > 60) && (_slave.weight < 30) && (_slave.lactation > 0) && ((_slave.boobs-_slave.boobsImplant) > 6000)>>
+					$He shows off how even a cow like _slave.slaveName can achieve physical perfection.
 				<<else>>
-					A<<if ($slaves[$i].muscles < 30)>>n unmuscled,<</if>><<if ($slaves[$i].weight > 30)>> fat,<</if>> 'prestigious' <<if ($slaves[$i].lactation > 0)>>cow<<elseif (($slaves[$i].boobs-$slaves[$i].boobsImplant) > 6000)>>mass of titflesh<<else>>slave<</if>> like $slaves[$i].slaveName is woefully out of fashion, so $Madam.slaveName tries to draw attention away from _him2.
+					A<<if (_slave.muscles < 30)>>n unmuscled,<</if>><<if (_slave.weight > 30)>> fat,<</if>> 'prestigious' <<if (_slave.lactation > 0)>>cow<<elseif ((_slave.boobs-_slave.boobsImplant) > 6000)>>mass of titflesh<<else>>slave<</if>> like _slave.slaveName is woefully out of fashion, so $Madam.slaveName tries to draw attention away from _him2.
 				<</if>>
 			<<else>>
-				<<if ($slaves[$i].lactation > 0) && (($slaves[$i].boobs-$slaves[$i].boobsImplant) > 6000)>>
-					$He makes sure to massage $slaves[$i].slaveName's huge breasts to get the milk flowing before enticing clients to suckle and play with _him2.
+				<<if (_slave.lactation > 0) && ((_slave.boobs-_slave.boobsImplant) > 6000)>>
+					$He makes sure to massage _slave.slaveName's huge breasts to get the milk flowing before enticing clients to suckle and play with _him2.
 				<<else>>
-					$He would like to show off $slaves[$i].slaveName's huge udders, but $slaves[$i].slaveName <<if ($slaves[$i].lactation == 0)>>isn't producing milk anymore<<else>>doesn't exactly have huge udders anymore<</if>>.
+					$He would like to show off _slave.slaveName's huge udders, but _slave.slaveName <<if (_slave.lactation == 0)>>isn't producing milk anymore<<else>>doesn't exactly have huge udders anymore<</if>>.
 				<</if>>
 			<</if>>
-		<<elseif $slaves[$i].prestigeDesc == "$He is remembered for winning best in show as a cockmilker.">>
-			<<setLocalPronouns $slaves[$i] 2>>
+		<<elseif _slave.prestigeDesc == "$He is remembered for winning best in show as a cockmilker.">>
+			<<setLocalPronouns _slave 2>>
 			<<if $arcologies[0].FSGenderFundamentalist != "unset">> /* this needs review - doesn't fit right. An XY slave would be expected to be masculine. */
-				<<if ($slaves[$i].balls == 0) && ($slaves[$i].dick == 0) && ($slaves[$i].vagina > -1)>>
-					$He uses $slaves[$i].slaveName as an example of how even a huge-balled freak like _him2 can be restored to proper femininity.
+				<<if (_slave.balls == 0) && (_slave.dick == 0) && (_slave.vagina > -1)>>
+					$He uses _slave.slaveName as an example of how even a huge-balled freak like _him2 can be restored to proper femininity.
 				<<else>>
-					$He tries to hide $slaves[$i].slaveName, 'her' body being notorious for its defiance of conventional femininity.
+					$He tries to hide _slave.slaveName, 'her' body being notorious for its defiance of conventional femininity.
 				<</if>>
 			<<else>>
-				<<if (($slaves[$i].balls > 5) && ($slaves[$i].dick != 0)) || (($slaves[$i].balls > 4) && ($slaves[$i].dick != 0) && ($slaves[$i].prostate > 1))>>
-					$He shows off $slaves[$i].slaveName's copious loads by putting a condom over _his2 dick and teasing _him2 till _he2 bursts it. The show draws multiple clients that want to play with _his2 oversized junk and messy orgasms.
+				<<if ((_slave.balls > 5) && (_slave.dick != 0)) || ((_slave.balls > 4) && (_slave.dick != 0) && (_slave.prostate > 1))>>
+					$He shows off _slave.slaveName's copious loads by putting a condom over _his2 dick and teasing _him2 till _he2 bursts it. The show draws multiple clients that want to play with _his2 oversized junk and messy orgasms.
 				<<else>>
-					$He would love to show off $slaves[$i].slaveName's copious loads, but $slaves[$i].slaveName<<if $slaves[$i].dick == 0>> doesn't have a dick<<elseif $slaves[$i].balls == 0>>'s not producing cum<<else>>'s orgasms just aren't messy enough<</if>>.
+					$He would love to show off _slave.slaveName's copious loads, but _slave.slaveName<<if _slave.dick == 0>> doesn't have a dick<<elseif _slave.balls == 0>>'s not producing cum<<else>>'s orgasms just aren't messy enough<</if>>.
 				<</if>>
 			<</if>>
-		<<elseif $slaves[$i].prestigeDesc == "$He is remembered for winning best in show as a breeder.">>
-			<<setLocalPronouns $slaves[$i] 2>>
-			<<if $slaves[$i].bellyPreg >= 5000>>
-				$He makes sure $slaves[$i].slaveName's growing pregnancy is well taken care of, even if it means driving away potential customers away when the mother-to-be needs a rest.
-			<<elseif canGetPregnant($slaves[$i])>>
-				$He makes sure to play off $slaves[$i].slaveName's fame and fertility by enticing potential customers to be the one to claim _his2 womb by filling it with their child.
+		<<elseif _slave.prestigeDesc == "$He is remembered for winning best in show as a breeder.">>
+			<<setLocalPronouns _slave 2>>
+			<<if _slave.bellyPreg >= 5000>>
+				$He makes sure _slave.slaveName's growing pregnancy is well taken care of, even if it means driving away potential customers away when the mother-to-be needs a rest.
+			<<elseif canGetPregnant(_slave)>>
+				$He makes sure to play off _slave.slaveName's fame and fertility by enticing potential customers to be the one to claim _his2 womb by filling it with their child.
 			<<else>>
-				$He would love to play off of $slaves[$i].slaveName's fame and fertility, but unfortunately _he2 <<if $slaves[$i].pregKnown == 1 && $slaves[$i].bellyPreg < 1500>>is already pregnant and not far enough along to show it<<elseif $slaves[$i].pregKnown == 1 && $slaves[$i].bellyPreg < 5000>>already pregnant, but not enough to be exciting<<else>>is unable to get knocked up<</if>>.
+				$He would love to play off of _slave.slaveName's fame and fertility, but unfortunately _he2 <<if _slave.pregKnown == 1 && _slave.bellyPreg < 1500>>is already pregnant and not far enough along to show it<<elseif _slave.pregKnown == 1 && _slave.bellyPreg < 5000>>already pregnant, but not enough to be exciting<<else>>is unable to get knocked up<</if>>.
 			<</if>>
 		<</if>>
 	<</for>>
 
 	<<if (_DL+$brothelSlavesGettingHelp < 10)>>
 		<<set $i = _FLs>> /* apply following SA passages to facility leader */
-		<<setLocalPronouns $slaves[$i]>>
+		<<setLocalPronouns _slave>>
 		<<set _oldCash = $cash>>
 		<<if $showEWD != 0>>
-			<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.whore($slaves[$i])>>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.whore(_slave)>>
 		<<else>>
 			<<run App.SlaveAssignment.whore($slaves[$i])>>
 		<</if>>
@@ -225,46 +226,46 @@
 		<<set _healthBonus += 3, _aphrod = 2>>
 	<</if>>
 	<<set _oldCash = $cash>>
-	<<for _dI = 0; _dI < _DL; _dI++>>
-		<<set $i = $slaveIndices[$BrothiIDs[_dI]]>>
-		<<setLocalPronouns $slaves[$i]>>
-		<<if ($legendaryWombID == 0) && (!isAmputee($slaves[$i])) && ($slaves[$i].preg > $slaves[$i].pregData.normalBirth/1.33) && ($slaves[$i].broodmother == 0) && ($slaves[$i].eggType == "human") && ($slaves[$i].counter.births > 10) && ($slaves[$i].devotion > 50) && ($slaves[$i].prestige == 0)>>
-			<<set $legendaryWombID = $slaves[$i].ID>>
+	<<for _slave range _slaves>>
+		<<set $i = $slaveIndices[_slave.ID]>>
+		<<setLocalPronouns _slave>>
+		<<if ($legendaryWombID == 0) && (!isAmputee(_slave)) && (_slave.preg > _slave.pregData.normalBirth/1.33) && (_slave.broodmother == 0) && (_slave.eggType == "human") && (_slave.counter.births > 10) && (_slave.devotion > 50) && (_slave.prestige == 0)>>
+			<<set $legendaryWombID = _slave.ID>>
 		<</if>>
-		<<if ($legendaryWhoreID == 0) && ($slaves[$i].skill.whoring >= 100) && ($slaves[$i].devotion > 50) && ($slaves[$i].prestige == 0)>>
-			<<set $legendaryWhoreID = $slaves[$i].ID>>
+		<<if ($legendaryWhoreID == 0) && (_slave.skill.whoring >= 100) && (_slave.devotion > 50) && (_slave.prestige == 0)>>
+			<<set $legendaryWhoreID = _slave.ID>>
 		<</if>>
 
 		/* Perform facility based rule changes */
-		<<run improveCondition($slaves[$i], _healthBonus)>>
-		<<set $slaves[$i].aphrodisiacs = _aphrod>>
+		<<run improveCondition(_slave, _healthBonus)>>
+		<<set _slave.aphrodisiacs = _aphrod>>
 		<<switch $brothelDecoration>>
 		<<case "Degradationist" "standard">>
-			<<set $slaves[$i].rules.living = "spare">>
+			<<set _slave.rules.living = "spare">>
 		<<default>>
-			<<set $slaves[$i].rules.living = "normal">>
+			<<set _slave.rules.living = "normal">>
 		<</switch>>
-		<<if ($slaves[$i].health.condition < -80)>>
-			<<run improveCondition($slaves[$i], 20)>>
-		<<elseif $slaves[$i].health.condition < -40>>
-			<<run improveCondition($slaves[$i], 15)>>
-		<<elseif $slaves[$i].health.condition < 0>>
-			<<run improveCondition($slaves[$i], 10)>>
-		<<elseif $slaves[$i].health.condition < 90>>
-			<<run improveCondition($slaves[$i], 7)>>
+		<<if (_slave.health.condition < -80)>>
+			<<run improveCondition(_slave, 20)>>
+		<<elseif _slave.health.condition < -40>>
+			<<run improveCondition(_slave, 15)>>
+		<<elseif _slave.health.condition < 0>>
+			<<run improveCondition(_slave, 10)>>
+		<<elseif _slave.health.condition < 90>>
+			<<run improveCondition(_slave, 7)>>
 		<</if>>
-		<<if ($slaves[$i].devotion <= 20) && ($slaves[$i].trust >= -20)>>
-			<<set $slaves[$i].devotion -= 5, $slaves[$i].trust -= 5>>
-		<<elseif ($slaves[$i].devotion < 45)>>
-			<<set $slaves[$i].devotion += 4>>
-		<<elseif ($slaves[$i].devotion > 50)>>
-			<<set $slaves[$i].devotion -= 4>>
+		<<if (_slave.devotion <= 20) && (_slave.trust >= -20)>>
+			<<set _slave.devotion -= 5, _slave.trust -= 5>>
+		<<elseif (_slave.devotion < 45)>>
+			<<set _slave.devotion += 4>>
+		<<elseif (_slave.devotion > 50)>>
+			<<set _slave.devotion -= 4>>
 		<</if>>
-		<<if ($slaves[$i].trust < 30)>>
-			<<set $slaves[$i].trust += 5>>
+		<<if (_slave.trust < 30)>>
+			<<set _slave.trust += 5>>
 		<</if>>
-		<<if $slaves[$i].energy > 40 && $slaves[$i].energy < 95>>
-			<<set $slaves[$i].energy++>>
+		<<if _slave.energy > 40 && _slave.energy < 95>>
+			<<set _slave.energy++>>
 		<</if>>
 
 		<<if $showEWD != 0>>
@@ -272,44 +273,44 @@
 			/* 000-250-006 */
 			<<if $seeImages && $seeReportImages>>
 			<div class="imageRef tinyImg">
-				<<= SlaveArt($slaves[$i], 0, 0)>>
+				<<= SlaveArt(_slave, 0, 0)>>
 			</div>
 			<</if>>
 			/* 000-250-006 */
-			<span class="slave-name"><<= SlaveFullName($slaves[$i])>></span>
-			<<if $slaves[$i].choosesOwnAssignment == 2>>
+			<span class="slave-name"><<= SlaveFullName(_slave)>></span>
+			<<if _slave.choosesOwnAssignment == 2>>
 				<<include "SA chooses own job">>
 			<<else>>
 				is working out of $brothelName.
 			<</if>>
-			<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.whore($slaves[$i])>>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.whore(_slave)>>
 			<br>&nbsp;&nbsp;&nbsp;
-			<<= App.SlaveAssignment.choosesOwnClothes($slaves[$i])>>
+			<<= App.SlaveAssignment.choosesOwnClothes(_slave)>>
 			<<include "SA rules">>
 			<<include "SA diet">>
 			<<include "SA long term effects">>
-			<<= App.SlaveAssignment.drugs($slaves[$i])>>
+			<<= App.SlaveAssignment.drugs(_slave)>>
 			<<include "SA relationships">>
 			<<include "SA rivalries">>
 			<br><<include "SA devotion">>
 		<<else>>
 			<<silently>>
 			<<include "SA chooses own job">>
-			<<run App.SlaveAssignment.whore($slaves[$i])>>
-			<<run App.SlaveAssignment.choosesOwnClothes($slaves[$i])>>
+			<<run App.SlaveAssignment.whore(_slave)>>
+			<<run App.SlaveAssignment.choosesOwnClothes(_slave)>>
 			<<include "SA rules">>
 			<<include "SA diet">>
 			<<include "SA long term effects">>
-			<<run App.SlaveAssignment.drugs($slaves[$i])>>
+			<<run App.SlaveAssignment.drugs(_slave)>>
 			<<include "SA relationships">>
 			<<include "SA rivalries">>
 			<<include "SA devotion">>
 			<</silently>>
 		<</if>>
 
-		<<set _seed = Math.max(App.Ads.getMatchedCategoryCount($slaves[$i], "brothel"), 1)>>
+		<<set _seed = Math.max(App.Ads.getMatchedCategoryCount(_slave, "brothel"), 1)>>
 		<<set _adsIncome = _seed * random(50,60) * Math.trunc($brothelAdsSpending/1000)>>
-		<<set _cashX = _adsIncome, getSlaveStatisticData($slaves[$i], $facility.brothel).adsIncome += _adsIncome>>
+		<<set _cashX = _adsIncome, getSlaveStatisticData(_slave, $facility.brothel).adsIncome += _adsIncome>>
 		<<run cashX(_cashX, "brothelAds")>>
 	<</for>>
 
diff --git a/src/uncategorized/cellblock.tw b/src/uncategorized/cellblock.tw
index 903ecea20d5142de9b99851c628eb5943e267278..6af055a19cd6f33e006df4ebfd8e005db04785bf 100644
--- a/src/uncategorized/cellblock.tw
+++ b/src/uncategorized/cellblock.tw
@@ -1,6 +1,6 @@
 :: Cellblock [nobr]
 
-<<set $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Cellblock", $showEncyclopedia = 1, $encyclopedia = "Cellblock", _CL = $CellBiIDs.length>>
+<<set $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Cellblock", $showEncyclopedia = 1, $encyclopedia = "Cellblock", _CL = App.Entity.facilities.cellblock.employeesIDs().size>>
 
 <<if $cellblockName != "the Cellblock">>
 	<<set $cellblockNameCaps = $cellblockName.replace("the ", "The ")>>
diff --git a/src/uncategorized/cellblockReport.tw b/src/uncategorized/cellblockReport.tw
index c4a7a01421accdc3303445f4e9287dc793ef73ca..3dda3ca2d91be55d7e7d5db85e5f37a9ce08ba41 100644
--- a/src/uncategorized/cellblockReport.tw
+++ b/src/uncategorized/cellblockReport.tw
@@ -1,7 +1,7 @@
 :: Cellblock Report [nobr]
 
-<<SlaveIDSort $CellBiIDs>>
-<<set _DL = $CellBiIDs.length, _SL = $slaves.length, _brokenSlaves = 0, _idleBonus = 0, _softenedQuirks = 0, _trustMalus = 0, _FLsFetish = 0>>
+<<set _slaves = App.Utils.sortedEmployees(App.Entity.facilities.cellblock)>>
+<<set _DL = _slaves.length, _SL = $slaves.length, _brokenSlaves = 0, _idleBonus = 0, _softenedQuirks = 0, _trustMalus = 0, _FLsFetish = 0>>
 
 <<if $cellblockDecoration != "standard">>
 	<<set _devBonus = 1>>
@@ -90,25 +90,24 @@
 		<<set _devBonus++, _trustMalus++, _idleBonus++>>
 		$His devotion to you is so absolute that $he sees breaking bitches for your service as a noble calling.
 	<</if>>
-	<<for _dI = 0; _dI < _DL; _dI++>>
-		<<set $i = $slaveIndices[$CellBiIDs[_dI]]>>
-		<<if $Wardeness.rivalryTarget == $slaves[$i].ID>>
-			$He greatly enjoys breaking $his <<print rivalryTerm($Wardeness)>>, $slaves[$i].slaveName's will.
-			<<set $slaves[$i].devotion++, $slaves[$i].trust -= 3>>
+	<<for _slave range _slaves>>
+		<<if $Wardeness.rivalryTarget == _slave.ID>>
+			$He greatly enjoys breaking $his <<print rivalryTerm($Wardeness)>>, _slave.slaveName's will.
+			<<set _slave.devotion++, _slave.trust -= 3>>
 			<<if random(1,100) > 30>>
-				<<set $Wardeness.rivalry++, $slaves[_FLs].rivalry++, $slaves[$i].rivalry++>>
+				<<set $Wardeness.rivalry++, $slaves[_FLs].rivalry++, _slave.rivalry++>>
 			<</if>>
-		<<elseif $Wardeness.relationshipTarget == $slaves[$i].ID>>
-			$He hates having to break $his <<print relationshipTerm($Wardeness)>>, $slaves[$i].slaveName, but $his devotion to you wins out in the end.
-			<<set $slaves[$i].devotion++, $slaves[$i].trust -= 3>>
+		<<elseif $Wardeness.relationshipTarget == _slave.ID>>
+			$He hates having to break $his <<print relationshipTerm($Wardeness)>>, _slave.slaveName, but $his devotion to you wins out in the end.
+			<<set _slave.devotion++, _slave.trust -= 3>>
 			<<if random(1,100) >= 50>>
-				$His and $slaves[$i].slaveName's relationship has been shattered by these events.
-				<<set $Wardeness.relationship = 0, $Wardeness.relationshipTarget = 0, $slaves[_FLs].relationship = 0, $slaves[_FLs].relationshipTarget = 0, $slaves[$i].relationship = 0, $slaves[$i].relationshipTarget = 0>>
+				$His and _slave.slaveName's relationship has been shattered by these events.
+				<<set $Wardeness.relationship = 0, $Wardeness.relationshipTarget = 0, $slaves[_FLs].relationship = 0, $slaves[_FLs].relationshipTarget = 0, _slave.relationship = 0, _slave.relationshipTarget = 0>>
 			<</if>>
-		<<elseif areRelated($Wardeness, $slaves[$i])>>
-			<<setLocalPronouns $slaves[$i] 2>>
-			$He shows $his <<print relativeTerm($Wardeness,$slaves[$i])>> $slaves[$i].slaveName no mercy, making sure _he2 understands _his2 place.
-			<<set $slaves[$i].devotion++, $slaves[$i].trust-->>
+		<<elseif areRelated($Wardeness, _slave)>>
+			<<setLocalPronouns _slave 2>>
+			$He shows $his <<print relativeTerm($Wardeness,_slave)>> _slave.slaveName no mercy, making sure _he2 understands _his2 place.
+			<<set _slave.devotion++, _slave.trust-->>
 		<</if>>
 	<</for>>
 	<<if (_DL < $cellblock)>>
@@ -161,122 +160,122 @@
 	<<set $Wardeness = $slaves[_FLs]>>
 <</if>>
 
-<<for _dI = 0; _dI < _DL; _dI++>>
-	<<set $i = $slaveIndices[$CellBiIDs[_dI]]>>
-	<<setLocalPronouns $slaves[$i]>>
-	<<if ($slaves[$i].devotion <= 20)>>
-		<<if ($slaves[$i].trust >= -20)>>
-			<<if (($slaves[$i].hears == -1 && $slaves[$i].earwear != "hearing aids") || ($slaves[$i].hears == 0 && $slaves[$i].earwear == "muffling ear plugs") ||($slaves[$i].hears == -2))>>
-				<<set $slaves[$i].devotion -= 2, $slaves[$i].trust -= 2>>
+<<for _slave range _slaves>>
+	<<set $i = $slaveIndices[_slave.ID]>>
+	<<setLocalPronouns _slave>>
+	<<if (_slave.devotion <= 20)>>
+		<<if (_slave.trust >= -20)>>
+			<<if ((_slave.hears == -1 && _slave.earwear != "hearing aids") || (_slave.hears == 0 && _slave.earwear == "muffling ear plugs") ||(_slave.hears == -2))>>
+				<<set _slave.devotion -= 2, _slave.trust -= 2>>
 			<<else>>
-				<<set $slaves[$i].devotion -= 4, $slaves[$i].trust -= 4>>
+				<<set _slave.devotion -= 4, _slave.trust -= 4>>
 			<</if>>
 		<<else>>
-			<<set $slaves[$i].devotion++>>
+			<<set _slave.devotion++>>
 		<</if>>
 	<</if>>
 	<<switch $cellblockDecoration>>
 	<<case "Paternalist">>
-		<<set $slaves[$i].rules.living = "normal">>
-		<<if ($slaves[$i].inflation > 0)>>
-			<<set $slaves[$i].inflation = 0, $slaves[$i].inflationType = "none", $slaves[$i].inflationMethod = 0, $slaves[$i].milkSource = 0>>
-			<<run SetBellySize($slaves[$i])>>
+		<<set _slave.rules.living = "normal">>
+		<<if (_slave.inflation > 0)>>
+			<<set _slave.inflation = 0, _slave.inflationType = "none", _slave.inflationMethod = 0, _slave.milkSource = 0>>
+			<<run SetBellySize(_slave)>>
 		<</if>>
 	<<case "Pastoralist">>
-		<<set $slaves[$i].rules.living = "spare">>
-		<<if $slaves[$i].inflation == 0>>
-			<<if $slaves[$i].pregKnown == 0 && $slaves[$i].bellyImplant < 1500>>
-				<<set $slaves[$i].inflation = 2, $slaves[$i].inflationType = "milk", $slaves[$i].inflationMethod = 1>>
+		<<set _slave.rules.living = "spare">>
+		<<if _slave.inflation == 0>>
+			<<if _slave.pregKnown == 0 && _slave.bellyImplant < 1500>>
+				<<set _slave.inflation = 2, _slave.inflationType = "milk", _slave.inflationMethod = 1>>
 			<<else>>
-				<<set $slaves[$i].inflation = 1, $slaves[$i].inflationType = "milk", $slaves[$i].inflationMethod = 1>>
+				<<set _slave.inflation = 1, _slave.inflationType = "milk", _slave.inflationMethod = 1>>
 			<</if>>
-			<<run SetBellySize($slaves[$i])>>
+			<<run SetBellySize(_slave)>>
 		<</if>>
 	<<case "Hedonistic">>
-		<<set $slaves[$i].rules.living = "spare">>
-		<<if $slaves[$i].weight < 200>>
-			<<if $slaves[$i].weightDirection == 1>>
-				<<set $slaves[$i].weight += 5>>
-			<<elseif $slaves[$i].weightDirection == -1>>
-				<<set $slaves[$i].weight += 1>>
+		<<set _slave.rules.living = "spare">>
+		<<if _slave.weight < 200>>
+			<<if _slave.weightDirection == 1>>
+				<<set _slave.weight += 5>>
+			<<elseif _slave.weightDirection == -1>>
+				<<set _slave.weight += 1>>
 			<<else>>
-				<<set $slaves[$i].weight += 3>>
+				<<set _slave.weight += 3>>
 			<</if>>
 		<</if>>
-		<<if $slaves[$i].muscles > -100>>
-			<<set $slaves[$i].muscles -= 2>>
+		<<if _slave.muscles > -100>>
+			<<set _slave.muscles -= 2>>
 		<</if>>
-		<<if $slaves[$i].inflation == 0>>
-			<<if $slaves[$i].pregKnown == 0 && $slaves[$i].bellyImplant < 1500>>
-				<<set $slaves[$i].inflation = 3, $slaves[$i].inflationType = "food", $slaves[$i].inflationMethod = 1>>
+		<<if _slave.inflation == 0>>
+			<<if _slave.pregKnown == 0 && _slave.bellyImplant < 1500>>
+				<<set _slave.inflation = 3, _slave.inflationType = "food", _slave.inflationMethod = 1>>
 			<<else>>
-				<<set $slaves[$i].inflation = 1, $slaves[$i].inflationType = "food", $slaves[$i].inflationMethod = 1>>
+				<<set _slave.inflation = 1, _slave.inflationType = "food", _slave.inflationMethod = 1>>
 			<</if>>
-			<<run SetBellySize($slaves[$i])>>
+			<<run SetBellySize(_slave)>>
 		<</if>>
 	<<default>>
-		<<set $slaves[$i].rules.living = "spare">>
-		<<if ($slaves[$i].inflation > 0)>>
-			<<set $slaves[$i].inflation = 0, $slaves[$i].inflationType = "none", $slaves[$i].inflationMethod = 0, $slaves[$i].milkSource = 0>>
-			<<run SetBellySize($slaves[$i])>>
+		<<set _slave.rules.living = "spare">>
+		<<if (_slave.inflation > 0)>>
+			<<set _slave.inflation = 0, _slave.inflationType = "none", _slave.inflationMethod = 0, _slave.milkSource = 0>>
+			<<run SetBellySize(_slave)>>
 		<</if>>
 	<</switch>>
 	<<if $cellblockUpgrade == 1>>
-		<<if ($slaves[$i].behavioralFlaw != "none") && ($slaves[$i].behavioralQuirk == "none")>>
-			<<run SoftenBehavioralFlaw($slaves[$i])>>
-			<<set $slaves[$i].devotion -= 10, _softenedQuirks++>>
-		<<elseif ($slaves[$i].sexualFlaw != "none") && ($slaves[$i].sexualQuirk == "none")>>
-			<<run SoftenSexualFlaw($slaves[$i])>>
-			<<set $slaves[$i].devotion -= 10, _softenedQuirks++>>
+		<<if (_slave.behavioralFlaw != "none") && (_slave.behavioralQuirk == "none")>>
+			<<run SoftenBehavioralFlaw(_slave)>>
+			<<set _slave.devotion -= 10, _softenedQuirks++>>
+		<<elseif (_slave.sexualFlaw != "none") && (_slave.sexualQuirk == "none")>>
+			<<run SoftenSexualFlaw(_slave)>>
+			<<set _slave.devotion -= 10, _softenedQuirks++>>
 		<</if>>
 	<</if>>
-	<<set $slaves[$i].devotion += _devBonus, $slaves[$i].trust -= _trustMalus>>
-	<<if ($Wardeness != 0) && ($Wardeness.sexualFlaw == "malicious") && ($slaves[$i].energy >= 2)>>
-		<<set $slaves[$i].energy -= 2>>
+	<<set _slave.devotion += _devBonus, _slave.trust -= _trustMalus>>
+	<<if ($Wardeness != 0) && ($Wardeness.sexualFlaw == "malicious") && (_slave.energy >= 2)>>
+		<<set _slave.energy -= 2>>
 	<</if>>
-	<<if ($slaves[$i].health.condition < -80)>>
-		<<run improveCondition($slaves[$i], 20)>>
-	<<elseif ($slaves[$i].health.condition < -40)>>
-		<<run improveCondition($slaves[$i], 15)>>
-	<<elseif ($slaves[$i].health.condition < 0)>>
-		<<run improveCondition($slaves[$i], 10)>>
-	<<elseif ($slaves[$i].health.condition < 40)>>
-		<<run improveCondition($slaves[$i], 7)>>
-	<<elseif ($slaves[$i].health.condition < 100)>>
-		<<run improveCondition($slaves[$i], 3)>>
+	<<if (_slave.health.condition < -80)>>
+		<<run improveCondition(_slave, 20)>>
+	<<elseif (_slave.health.condition < -40)>>
+		<<run improveCondition(_slave, 15)>>
+	<<elseif (_slave.health.condition < 0)>>
+		<<run improveCondition(_slave, 10)>>
+	<<elseif (_slave.health.condition < 40)>>
+		<<run improveCondition(_slave, 7)>>
+	<<elseif (_slave.health.condition < 100)>>
+		<<run improveCondition(_slave, 3)>>
 	<</if>>
 	<<if $showEWD != 0>>
 		<br><br>
 		/* 000-250-006 */
 		<<if $seeImages && $seeReportImages>>
 		<div class="imageRef tinyImg">
-			<<= SlaveArt($slaves[$i], 0, 0)>>
+			<<= SlaveArt(_slave, 0, 0)>>
 		</div>
 		<</if>>
 		/* 000-250-006 */
-		<span class='slave-name'><<= SlaveFullName($slaves[$i])>></span>
-		<<if $slaves[$i].choosesOwnAssignment == 2>>
+		<span class='slave-name'><<= SlaveFullName(_slave)>></span>
+		<<if _slave.choosesOwnAssignment == 2>>
 			<<include "SA chooses own job">>
 		<<else>>
 			is confined in $cellblockName.
 		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.stayConfined($slaves[$i])>>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.stayConfined(_slave)>>
 		<br>&nbsp;&nbsp;&nbsp;
 		<<include "SA rules">>
 		<<include "SA diet">>
 		<<include "SA long term effects">>
-		<<= App.SlaveAssignment.drugs($slaves[$i])>>
+		<<= App.SlaveAssignment.drugs(_slave)>>
 		<<include "SA relationships">>
 		<<include "SA rivalries">>
 		<br><<include "SA devotion">>
 	<<else>>
 		<<silently>>
 		<<include "SA chooses own job">>
-		<<run App.SlaveAssignment.stayConfined($slaves[$i])>>
+		<<run App.SlaveAssignment.stayConfined(_slave)>>
 		<<include "SA rules">>
 		<<include "SA diet">>
 		<<include "SA long term effects">>
-		<<run App.SlaveAssignment.drugs($slaves[$i])>>
+		<<run App.SlaveAssignment.drugs(_slave)>>
 		<<include "SA relationships">>
 		<<include "SA rivalries">>
 		<<include "SA devotion">>
diff --git a/src/uncategorized/clinic.tw b/src/uncategorized/clinic.tw
index ee8cf5a1f0611cdef56aeb6af953547bc5391c70..9398239decdc54311fab1017eb1e67ddad05c54d 100644
--- a/src/uncategorized/clinic.tw
+++ b/src/uncategorized/clinic.tw
@@ -1,6 +1,6 @@
 :: Clinic [nobr]
 
-<<set $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Clinic", $showEncyclopedia = 1, $encyclopedia = "Clinic", _CL = $CliniciIDs.length>>
+<<set $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Clinic", $showEncyclopedia = 1, $encyclopedia = "Clinic", _CL = App.Entity.facilities.clinic.employeesIDs().size>>
 
 <<if $clinicName != "the Clinic">>
 	<<set $clinicNameCaps = $clinicName.replace("the ", "The ")>>
diff --git a/src/uncategorized/clinicReport.tw b/src/uncategorized/clinicReport.tw
index 81d162a7377a4412934715f73ec48932be7bedc4..595ad6ae31998f92d53b10888b5417df9411a07d 100644
--- a/src/uncategorized/clinicReport.tw
+++ b/src/uncategorized/clinicReport.tw
@@ -1,7 +1,7 @@
 :: Clinic Report [nobr]
 
-<<SlaveIDSort $CliniciIDs>>
-<<set _DL = $CliniciIDs.length, _SL = $slaves.length, _healthBonus = 0, _idleBonus = 0, _FLsFetish = 0, _restedSlaves = 0>>
+<<set _slaves = App.Utils.sortedEmployees(App.Entity.facilities.clinic)>>
+<<set _DL = _slaves.length, _SL = $slaves.length, _healthBonus = 0, _idleBonus = 0, _FLsFetish = 0, _restedSlaves = 0>>
 
 <<if $clinicDecoration != "standard">>
 	<<set _devBonus = 1>>
@@ -78,40 +78,40 @@
 	<<if ($slaves[_FLs].devotion >= 60)>>
 		<<set _healthBonus++>>
 	<</if>>
-	<<for _dI = 0; _dI < _DL; _dI++>>
-		<<set $i = $slaveIndices[$CliniciIDs[_dI]]>>
-		<<if $Nurse.rivalryTarget == $slaves[$i].ID>>
-			<<setLocalPronouns $slaves[$i] 2>>
-			$He purposefully neglects the needs of $his <<print rivalryTerm($Nurse)>>, $slaves[$i].slaveName, hindering _his2 recovery and deepening their dislike for each other.
-			<<set $slaves[$i].devotion--, $slaves[$i].trust-->>
-			<<run healthDamage($slaves[$i], 3)>>
+	<<for _slave range _slaves>>
+		<<set $i = $slaveIndices[_slave.ID]>>
+		<<if $Nurse.rivalryTarget == _slave.ID>>
+			<<setLocalPronouns _slave 2>>
+			$He purposefully neglects the needs of $his <<print rivalryTerm($Nurse)>>, _slave.slaveName, hindering _his2 recovery and deepening their dislike for each other.
+			<<set _slave.devotion--, _slave.trust-->>
+			<<run healthDamage(_slave, 3)>>
 			<<if random(1,100) > 65>>
-				<<set $Nurse.rivalry++, $slaves[_FLs].rivalry++, $slaves[$i].rivalry++>>
+				<<set $Nurse.rivalry++, $slaves[_FLs].rivalry++, _slave.rivalry++>>
 			<</if>>
-		<<elseif $Nurse.relationshipTarget == $slaves[$i].ID>>
-			<<setLocalPronouns $slaves[$i] 2>>
-			$He dedicates most of $his attention to $his <<print relationshipTerm($Nurse)>>, $slaves[$i].slaveName, making sure _he2 has everything _he2 needs and more. This lavish attention detracts from $his overall effectiveness.
-			<<set _idleBonus -= 3, $slaves[$i].devotion++, $slaves[$i].trust++>>
-			<<run improveCondition($slaves[$i], 3)>>
-		<<elseif areRelated($Nurse, $slaves[$i])>>
-			$He makes sure to spend extra time caring for $his <<print relativeTerm($Nurse,$slaves[$i])>>, $slaves[$i].slaveName.
-			<<set $slaves[$i].trust++>>
-			<<run improveCondition($slaves[$i], 1)>>
+		<<elseif $Nurse.relationshipTarget == _slave.ID>>
+			<<setLocalPronouns _slave 2>>
+			$He dedicates most of $his attention to $his <<print relationshipTerm($Nurse)>>, _slave.slaveName, making sure _he2 has everything _he2 needs and more. This lavish attention detracts from $his overall effectiveness.
+			<<set _idleBonus -= 3, _slave.devotion++, _slave.trust++>>
+			<<run improveCondition(_slave, 3)>>
+		<<elseif areRelated($Nurse, _slave)>>
+			$He makes sure to spend extra time caring for $his <<print relativeTerm($Nurse,_slave)>>, _slave.slaveName.
+			<<set _slave.trust++>>
+			<<run improveCondition(_slave, 1)>>
 		<</if>>
-		<<switch $slaves[$i].prestigeDesc>>
+		<<switch _slave.prestigeDesc>>
 		<<case "$He is a famed Free Cities whore, and commands top prices.">>
-			<<setLocalPronouns $slaves[$i] 2>>
-			$He does $his best to aid the famous whore, $slaves[$i].slaveName, making sure to pay special attention to _his2 worn holes.
-			<<run improveCondition($slaves[$i], 2)>>
+			<<setLocalPronouns _slave 2>>
+			$He does $his best to aid the famous whore, _slave.slaveName, making sure to pay special attention to _his2 worn holes.
+			<<run improveCondition(_slave, 2)>>
 		<<case "$He is a famed Free Cities slut, and can please anyone.">>
-			<<setLocalPronouns $slaves[$i] 2>>
-			$He does $his best to aid the famous entertainer, $slaves[$i].slaveName, making sure _he2 can show off as soon as possible.
-			<<run improveCondition($slaves[$i], 2)>>
+			<<setLocalPronouns _slave 2>>
+			$He does $his best to aid the famous entertainer, _slave.slaveName, making sure _he2 can show off as soon as possible.
+			<<run improveCondition(_slave, 2)>>
 		<<case "$He is remembered for winning best in show as a cockmilker.">>
-			<<setLocalPronouns $slaves[$i] 2>>
-			<<if ($slaves[$i].balls > 4) && ($slaves[$i].dick != 0)>>
-				$He does $his best to aid the dribbling $slaves[$i].slaveName, paying special attention to _his2 huge cock and balls as well as making sure to milk _his2 <<if canAchieveErection($slaves[$i])>>erect <</if>>dick hourly.
-				<<run improveCondition($slaves[$i], 4)>>
+			<<setLocalPronouns _slave 2>>
+			<<if (_slave.balls > 4) && (_slave.dick != 0)>>
+				$He does $his best to aid the dribbling _slave.slaveName, paying special attention to _his2 huge cock and balls as well as making sure to milk _his2 <<if canAchieveErection(_slave)>>erect <</if>>dick hourly.
+				<<run improveCondition(_slave, 4)>>
 				<<if (random(1,100) > 65) && (($Nurse.fetish == "none") || ($Nurse.fetish == "cumslut"))>>
 					<<if $Nurse.fetish == "none">>
 						<<set $Nurse.fetish = "cumslut", $slaves[_FLs].fetish = "cumslut">>
@@ -121,11 +121,11 @@
 				<</if>>
 			<</if>>
 		<<case "$He is remembered for winning best in show as a dairy cow.">>
-			<<setLocalPronouns $slaves[$i] 2>>
-			<<if ($slaves[$i].lactation > 0) && (($slaves[$i].boobs-$slaves[$i].boobsImplant) > 6000)>>
-				$He does $his best to aid the leaking $slaves[$i].slaveName, paying special attention to _his2 huge breasts as well as making sure to milk _him2 hourly.
-				<<run improveCondition($slaves[$i], 4)>>
-				<<set $slaves[$i].lactationDuration = 2, $slaves[$i].boobs -= $slaves[$i].boobsMilk, $slaves[$i].boobsMilk = 0>>
+			<<setLocalPronouns _slave 2>>
+			<<if (_slave.lactation > 0) && ((_slave.boobs-_slave.boobsImplant) > 6000)>>
+				$He does $his best to aid the leaking _slave.slaveName, paying special attention to _his2 huge breasts as well as making sure to milk _him2 hourly.
+				<<run improveCondition(_slave, 4)>>
+				<<set _slave.lactationDuration = 2, _slave.boobs -= _slave.boobsMilk, _slave.boobsMilk = 0>>
 				<<if (random(1,100) > 65) && (($Nurse.fetish == "none") || ($Nurse.fetish == "boobs"))>>
 					<<if $Nurse.fetish == "none">>
 						<<set $Nurse.fetish = "boobs", $slaves[_FLs].fetish = "boobs">>
@@ -135,52 +135,52 @@
 				<</if>>
 			<</if>>
 		<<case "$He is remembered for winning best in show as a breeder.">>
-			<<setLocalPronouns $slaves[$i] 2>>
-			<<if $slaves[$i].bellyPreg >= 1500>>
-				$He does $his best to aid the pregnant $slaves[$i].slaveName, paying special attention to _his2 swollen belly and the welfare of the life within.
-				<<run improveCondition($slaves[$i], 6)>>
-			<<elseif $slaves[$i].ovaries == 1 || $slaves[$i].mpreg == 1>>
-				$He does $his best to aid the breeder $slaves[$i].slaveName, paying special attention to _his2 fertility and reproductive organs.
-				<<run improveCondition($slaves[$i], 4)>>
+			<<setLocalPronouns _slave 2>>
+			<<if _slave.bellyPreg >= 1500>>
+				$He does $his best to aid the pregnant _slave.slaveName, paying special attention to _his2 swollen belly and the welfare of the life within.
+				<<run improveCondition(_slave, 6)>>
+			<<elseif _slave.ovaries == 1 || _slave.mpreg == 1>>
+				$He does $his best to aid the breeder _slave.slaveName, paying special attention to _his2 fertility and reproductive organs.
+				<<run improveCondition(_slave, 4)>>
 			<<else>>
-				$He lays out plans on how to restore the breeder $slaves[$i].slaveName to _his2 former gravid glory.
+				$He lays out plans on how to restore the breeder _slave.slaveName to _his2 former gravid glory.
 			<</if>>
 		<</switch>>
-		<<if $slaves[$i].bellyImplant > -1 && $clinicInflateBelly == 1>>
-			<<setLocalPronouns $slaves[$i] 2>>
-			<br>''@@.pink;$slaves[$i].slaveName@@'' spent a lot of time during the week under IV-like stands with bags of inert filler steadily flowing into _his2 belly implant, slowly pushing _his2 belly further and further out. Careful attention, along with several drug injections, were used to make sure _his2 body was able to safely adjust to the implant's rapid growth.
-			<<run healthDamage($slaves[$i], 10)>>
-			<<set $slaves[$i].bellyImplant += 5000>>
-			<<if ($slaves[$i].devotion > 50)>>
-				<<set $slaves[$i].devotion += 4, $slaves[$i].trust += 3>>
-			<<elseif ($slaves[$i].devotion >= -20)>>
-				<<set $slaves[$i].trust -= 5>>
+		<<if _slave.bellyImplant > -1 && $clinicInflateBelly == 1>>
+			<<setLocalPronouns _slave 2>>
+			<br>''@@.pink;_slave.slaveName@@'' spent a lot of time during the week under IV-like stands with bags of inert filler steadily flowing into _his2 belly implant, slowly pushing _his2 belly further and further out. Careful attention, along with several drug injections, were used to make sure _his2 body was able to safely adjust to the implant's rapid growth.
+			<<run healthDamage(_slave, 10)>>
+			<<set _slave.bellyImplant += 5000>>
+			<<if (_slave.devotion > 50)>>
+				<<set _slave.devotion += 4, _slave.trust += 3>>
+			<<elseif (_slave.devotion >= -20)>>
+				<<set _slave.trust -= 5>>
 			<<else>>
-				<<set $slaves[$i].devotion -= 5, $slaves[$i].trust -= 10>>
+				<<set _slave.devotion -= 5, _slave.trust -= 10>>
 			<</if>>
-			<<if $slaves[$i].bellyImplant > ($arcologies[0].FSTransformationFetishistResearch ? 800000 : 130000)>>
-				<<set $slaves[$i].bellyImplant = ($arcologies[0].FSTransformationFetishistResearch ? 800000 : 130000)>>
+			<<if _slave.bellyImplant > ($arcologies[0].FSTransformationFetishistResearch ? 800000 : 130000)>>
+				<<set _slave.bellyImplant = ($arcologies[0].FSTransformationFetishistResearch ? 800000 : 130000)>>
 				_He2 is filled to the maximum that _his2 implant can stand.
 			<</if>>
 		<</if>>
-		<<if $slaves[$i].pregKnown == 1 && $slaves[$i].preg < $slaves[$i].pregData.normalBirth && $slaves[$i].pregControl == "speed up">>
-			<<setLocalPronouns $slaves[$i] 2>>
-			<br>''@@.pink;$slaves[$i].slaveName@@'' spends most of _his2 time on bedrest being filled with rapid gestation agents and concentrated slave food. All _he2 can do is <<if hasAnyArms($slaves[$i]) && canSee($slaves[$i])>>watch and feel _his2 belly pushing further and further out with life<<elseif canSee($slaves[$i])>>watch _his2 belly bulging further and further out with life<<elseif hasAnyArms($slaves[$i])>>feel _his2 belly pushing further and further out with life beneath _his2 fingers<<else>>feel the every growing pressure inside _his2 abdomen<</if>>. Careful attention, along with numerous drug injections, are used to make sure _his2 body is able to safely adjust to _his2 pregnancy's rapid growth.
-			<<run healthDamage($slaves[$i], 10)>>
-			<<if ($slaves[$i].devotion > 50)>>
-				<<set $slaves[$i].devotion += 2, $slaves[$i].trust += 1>>
-			<<elseif ($slaves[$i].devotion >= -20)>>
-				<<set $slaves[$i].trust -= 5>>
+		<<if _slave.pregKnown == 1 && _slave.preg < _slave.pregData.normalBirth && _slave.pregControl == "speed up">>
+			<<setLocalPronouns _slave 2>>
+			<br>''@@.pink;_slave.slaveName@@'' spends most of _his2 time on bedrest being filled with rapid gestation agents and concentrated slave food. All _he2 can do is <<if hasAnyArms(_slave) && canSee(_slave)>>watch and feel _his2 belly pushing further and further out with life<<elseif canSee(_slave)>>watch _his2 belly bulging further and further out with life<<elseif hasAnyArms(_slave)>>feel _his2 belly pushing further and further out with life beneath _his2 fingers<<else>>feel the every growing pressure inside _his2 abdomen<</if>>. Careful attention, along with numerous drug injections, are used to make sure _his2 body is able to safely adjust to _his2 pregnancy's rapid growth.
+			<<run healthDamage(_slave, 10)>>
+			<<if (_slave.devotion > 50)>>
+				<<set _slave.devotion += 2, _slave.trust += 1>>
+			<<elseif (_slave.devotion >= -20)>>
+				<<set _slave.trust -= 5>>
 			<<else>>
-				<<set $slaves[$i].devotion -= 5, $slaves[$i].trust -= 10>>
+				<<set _slave.devotion -= 5, _slave.trust -= 10>>
 			<</if>>
-			<<if $slaves[$i].preg >= $slaves[$i].pregData.minLiveBirth && $slaves[$i].pregControl == "speed up">>
-				<<set $slaves[$i].pregControl = "none">>
-				''@@.pink;$slaves[$i].slaveName's@@'' child is ready to pop out of _his2 womb, ''@@.yellow;_his2 course of rapid gestation agents is finished@@''.
+			<<if _slave.preg >= _slave.pregData.minLiveBirth && _slave.pregControl == "speed up">>
+				<<set _slave.pregControl = "none">>
+				''@@.pink;_slave.slaveName's@@'' child is ready to pop out of _his2 womb, ''@@.yellow;_his2 course of rapid gestation agents is finished@@''.
 			<</if>>
-		<<elseif $slaves[$i].preg > 2 && $slaves[$i].pregKnown == 0>>
-			During $his tests, $he discovers that $slaves[$i].slaveName @@.lime;is pregnant.@@
-			<<set $slaves[$i].pregKnown = 1>>
+		<<elseif _slave.preg > 2 && _slave.pregKnown == 0>>
+			During $his tests, $he discovers that _slave.slaveName @@.lime;is pregnant.@@
+			<<set _slave.pregKnown = 1>>
 		<</if>>
 	<</for>>
 	<<if (_DL < $clinic)>>
@@ -233,90 +233,90 @@
 	<<set $Nurse = $slaves[_FLs]>>
 <</if>>
 
-<<for _dI = 0; _dI < _DL; _dI++>>
-	<<set $i = $slaveIndices[$CliniciIDs[_dI]]>>
-	<<setLocalPronouns $slaves[$i]>>
+<<for _slave range _slaves>>
+	<<set $i = $slaveIndices[_slave.ID]>>
+	<<setLocalPronouns _slave>>
 
-	<<if $slaves[$i].devotion < 45>>
-		<<set $slaves[$i].devotion += 4>>
+	<<if _slave.devotion < 45>>
+		<<set _slave.devotion += 4>>
 	<</if>>
-	<<set $slaves[$i].devotion += _devBonus>>
-	<<if $slaves[$i].trust < 45>>
-		<<set $slaves[$i].trust += 4>>
+	<<set _slave.devotion += _devBonus>>
+	<<if _slave.trust < 45>>
+		<<set _slave.trust += 4>>
 	<</if>>
 
-	<<if ($slaves[$i].health.condition < -80)>>
-		<<run improveCondition($slaves[$i], (20 + ($curativeUpgrade * 10) + _healthBonus))>>
-	<<elseif ($slaves[$i].health.condition < -40)>>
-		<<run improveCondition($slaves[$i], (10 + ($curativeUpgrade * 7) + _healthBonus))>>
-	<<elseif ($slaves[$i].health.condition < 0)>>
-		<<run improveCondition($slaves[$i], (7 + ($curativeUpgrade * 5) + _healthBonus))>>
-	<<elseif ($slaves[$i].health.condition < 90)>>
-		<<run improveCondition($slaves[$i], (3 + ($curativeUpgrade * 3) + _healthBonus))>>
+	<<if (_slave.health.condition < -80)>>
+		<<run improveCondition(_slave, (20 + ($curativeUpgrade * 10) + _healthBonus))>>
+	<<elseif (_slave.health.condition < -40)>>
+		<<run improveCondition(_slave, (10 + ($curativeUpgrade * 7) + _healthBonus))>>
+	<<elseif (_slave.health.condition < 0)>>
+		<<run improveCondition(_slave, (7 + ($curativeUpgrade * 5) + _healthBonus))>>
+	<<elseif (_slave.health.condition < 90)>>
+		<<run improveCondition(_slave, (3 + ($curativeUpgrade * 3) + _healthBonus))>>
 	<</if>>
 
 	/* the clinic is a well-equipped medical facility and can allow the Nurse or player to
 	 * directly cure serious wounds caused by injury and surgery with minimal side effects */
-	<<if $slaves[$i].health.shortDamage >= 10>>
+	<<if _slave.health.shortDamage >= 10>>
 		<<if ($Nurse != 0)>>
-			<<run healthCure($slaves[$i], 5 + _healthBonus)>>
+			<<run healthCure(_slave, 5 + _healthBonus)>>
 		<<else>>
-			<<run healthCure($slaves[$i], $PC.skill.medicine / 15)>> /* maximum of 6...even a bad full-time nurse will be better than a player doctor */
+			<<run healthCure(_slave, $PC.skill.medicine / 15)>> /* maximum of 6...even a bad full-time nurse will be better than a player doctor */
 		<</if>>
 	<</if>>
 
 	<<switch $clinicDecoration>>
 	<<case "Eugenics" "Gender Fundamentalist" "Gender Radicalist" "Hedonistic" "Intellectual Dependency" "Maturity Preferentialist" "Paternalist" "Petite Admiration" "Repopulation Focus" "Slimness Enthusiast" "Statuesque Glorification" "Youth Preferentialist">>
-		<<set $slaves[$i].rules.living = "luxurious">>
+		<<set _slave.rules.living = "luxurious">>
 	<<case "Arabian Revivalist" "Aztec Revivalist" "Chattel Religionist" "Chinese Revivalist" "Edo Revivalist" "Egyptian Revivalist" "Roman Revivalist">>
-		<<set $slaves[$i].rules.living = "normal">>
+		<<set _slave.rules.living = "normal">>
 	<<default>>
-		<<set $slaves[$i].rules.living = "spare">>
+		<<set _slave.rules.living = "spare">>
 	<</switch>>
 
 	<<if ($Nurse != 0)>>
-		<<if ($clinicSpeedGestation == 1) && ($slaves[$i].pregKnown == 1)>>
-			<<set $slaves[$i].pregControl = "speed up">>
+		<<if ($clinicSpeedGestation == 1) && (_slave.pregKnown == 1)>>
+			<<set _slave.pregControl = "speed up">>
 		<</if>>
-		<<if ($slaves[$i].chem > 10) && ($clinicUpgradeFilters >= 1)>>
-			<<if $slaves[$i].health.health > -50 && ($clinicUpgradePurge > 0)>>
-				<<set $slaves[$i].chem -= 100 * $clinicUpgradePurge>>
-				<<run healthDamage($slaves[$i], 15)>>
+		<<if (_slave.chem > 10) && ($clinicUpgradeFilters >= 1)>>
+			<<if _slave.health.health > -50 && ($clinicUpgradePurge > 0)>>
+				<<set _slave.chem -= 100 * $clinicUpgradePurge>>
+				<<run healthDamage(_slave, 15)>>
 			<</if>>
-			<<set $slaves[$i].chem = Math.max($slaves[$i].chem - 5, 0)>>
+			<<set _slave.chem = Math.max(_slave.chem - 5, 0)>>
 		<</if>>
-		<<if $slaves[$i].lactation == 1>>
-			<<set $slaves[$i].boobs -= $slaves[$i].boobsMilk, $slaves[$i].boobsMilk = 0>>
+		<<if _slave.lactation == 1>>
+			<<set _slave.boobs -= _slave.boobsMilk, _slave.boobsMilk = 0>>
 		<</if>>
 	<</if>>
-	<<if ($slaves[$i].health.illness > 0)>>
-	<<elseif ($slaves[$i].health.shortDamage >= 20)>> /* shortDamage does no real harm, until it gets to 20 */
-	<<elseif ($slaves[$i].health.condition <= 40)>>
-	<<elseif ($Nurse != 0) && ($slaves[$i].chem > 15) && ($clinicUpgradeFilters == 1)>>
-	<<elseif ($Nurse != 0) && ($slaves[$i].pregKnown == 1) && ($clinicSpeedGestation > 0 || $slaves[$i].pregControl == "speed up")>>
-	<<elseif ($Nurse != 0) && ($clinicObservePregnancy == 1) && ($slaves[$i].pregAdaptation*1000 < $slaves[$i].bellyPreg || $slaves[$i].preg > $slaves[$i].pregData.normalBirth/1.33)>>
-	<<elseif ($Nurse != 0) && ($clinicInflateBelly > 0) && ($slaves[$i].bellyImplant >= 0) && ($slaves[$i].bellyImplant <= ($arcologies[0].FSTransformationFetishistResearch ? 800000 : 130000))>>
+	<<if (_slave.health.illness > 0)>>
+	<<elseif (_slave.health.shortDamage >= 20)>> /* shortDamage does no real harm, until it gets to 20 */
+	<<elseif (_slave.health.condition <= 40)>>
+	<<elseif ($Nurse != 0) && (_slave.chem > 15) && ($clinicUpgradeFilters == 1)>>
+	<<elseif ($Nurse != 0) && (_slave.pregKnown == 1) && ($clinicSpeedGestation > 0 || _slave.pregControl == "speed up")>>
+	<<elseif ($Nurse != 0) && ($clinicObservePregnancy == 1) && (_slave.pregAdaptation*1000 < _slave.bellyPreg || _slave.preg > _slave.pregData.normalBirth/1.33)>>
+	<<elseif ($Nurse != 0) && ($clinicInflateBelly > 0) && (_slave.bellyImplant >= 0) && (_slave.bellyImplant <= ($arcologies[0].FSTransformationFetishistResearch ? 800000 : 130000))>>
 	<<else>>
 		<p>
-			<span class="slave-name">$slaves[$i].slaveName</span> has been cured<<if ($Nurse != 0) && ($clinicUpgradeFilters == 1)>> and purified<</if>>,
+			<span class="slave-name">_slave.slaveName</span> has been cured<<if ($Nurse != 0) && ($clinicUpgradeFilters == 1)>> and purified<</if>>,
 			<span class="noteworthy">
-				<<if $assignmentRecords[$slaves[$i].ID]>>
-					<<set _oldJob = $assignmentRecords[$slaves[$i].ID]>>
-					<<= assignJobSafely($slaves[$i], _oldJob)>>
-					<<if $slaves[$i].choosesOwnAssignment === 1>>
+				<<if $assignmentRecords[_slave.ID]>>
+					<<set _oldJob = $assignmentRecords[_slave.ID]>>
+					<<= assignJobSafely(_slave, _oldJob)>>
+					<<if _slave.choosesOwnAssignment === 1>>
 						and $he is resting before choosing another task.
-					<<elseif $slaves[$i].assignment === "rest">>
+					<<elseif _slave.assignment === "rest">>
 						<<if _oldJob != "rest">>
 							and since $he was unable to return to $his old task to <<print _oldJob>>, $his assignment has defaulted to rest.
 						<<else>>
 							so $he has returned to rest.
 						<</if>>
 					<<else>>
-						so $he goes back to <<print $slaves[$i].assignment>>.
+						so $he goes back to <<print _slave.assignment>>.
 					<</if>>
 				<<else>>
 					so $his assignment has defaulted to rest.
-					<<= removeJob($slaves[$i], "get treatment in the clinic")>>
+					<<= removeJob(_slave, "get treatment in the clinic")>>
 				<</if>>
 			</span>
 		</p>
@@ -328,50 +328,50 @@
 		/* 000-250-006 */
 		<<if $seeImages && $seeReportImages>>
 			<div class="imageRef tinyImg">
-				<<= SlaveArt($slaves[$i], 0, 0)>>
+				<<= SlaveArt(_slave, 0, 0)>>
 			</div>
 		<</if>>
 		/* 000-250-006 */
-		<span class='slave-name'><<= SlaveFullName($slaves[$i])>></span>
-		<<if $slaves[$i].choosesOwnAssignment == 2>>
+		<span class='slave-name'><<= SlaveFullName(_slave)>></span>
+		<<if _slave.choosesOwnAssignment == 2>>
 			<<include "SA chooses own job">>
 		<<else>>
 			is receiving treatment in $clinicName.
 		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.rest($slaves[$i])>>
-		<<if ($slaves[$i].health.illness > 0)>>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.rest(_slave)>>
+		<<if (_slave.health.illness > 0)>>
 			$He stays in the clinic since $he is still sick.
-		<<elseif ($slaves[$i].health.condition <= 40)>>
+		<<elseif (_slave.health.condition <= 40)>>
 			$He stays in the clinic since $his health is still poor.
-		<<elseif ($slaves[$i].health.shortDamage >= 20)>>
+		<<elseif (_slave.health.shortDamage >= 20)>>
 			$He stays in the clinic to recover from $his injuries.
-		<<elseif ($Nurse != 0) && ($slaves[$i].chem > 15) && ($clinicUpgradeFilters == 1)>>
+		<<elseif ($Nurse != 0) && (_slave.chem > 15) && ($clinicUpgradeFilters == 1)>>
 			$He stays in the clinic as unhealthy chemicals are still being flushed from $his system.
-		<<elseif ($Nurse != 0) && ($slaves[$i].pregKnown == 1) && ($clinicSpeedGestation > 0 || $slaves[$i].pregControl == "speed up")>>
+		<<elseif ($Nurse != 0) && (_slave.pregKnown == 1) && ($clinicSpeedGestation > 0 || _slave.pregControl == "speed up")>>
 			$He stays in the clinic to hurry $his pregnancy along safely.
-		<<elseif ($Nurse != 0) && ($clinicInflateBelly > 0) && ($slaves[$i].bellyImplant >= 0) && ($slaves[$i].bellyImplant <= ($arcologies[0].FSTransformationFetishistResearch ? 800000 : 130000))>>
+		<<elseif ($Nurse != 0) && ($clinicInflateBelly > 0) && (_slave.bellyImplant >= 0) && (_slave.bellyImplant <= ($arcologies[0].FSTransformationFetishistResearch ? 800000 : 130000))>>
 			$He stays in the clinic as $his implants can still receive more filling.
-		<<elseif ($Nurse != 0) && ($clinicObservePregnancy == 1) && ($slaves[$i].pregAdaptation*1000 < $slaves[$i].bellyPreg || $slaves[$i].preg > $slaves[$i].pregData.normalBirth/1.33)>>
+		<<elseif ($Nurse != 0) && ($clinicObservePregnancy == 1) && (_slave.pregAdaptation*1000 < _slave.bellyPreg || _slave.preg > _slave.pregData.normalBirth/1.33)>>
 			$He stays in the clinic waiting for the child to be born.
 		<</if>>
 		<br>&nbsp;&nbsp;&nbsp;
-		<<= App.SlaveAssignment.choosesOwnClothes($slaves[$i])>>
+		<<= App.SlaveAssignment.choosesOwnClothes(_slave)>>
 		<<include "SA rules">>
 		<<include "SA diet">>
 		<<include "SA long term effects">>
-		<<= App.SlaveAssignment.drugs($slaves[$i])>>
+		<<= App.SlaveAssignment.drugs(_slave)>>
 		<<include "SA relationships">>
 		<<include "SA rivalries">>
 		<br><<include "SA devotion">>
 	<<else>>
 		<<silently>>
 		<<include "SA chooses own job">>
-		<<run App.SlaveAssignment.rest($slaves[$i])>>
-		<<run App.SlaveAssignment.choosesOwnClothes($slaves[$i])>>
+		<<run App.SlaveAssignment.rest(_slave)>>
+		<<run App.SlaveAssignment.choosesOwnClothes(_slave)>>
 		<<include "SA rules">>
 		<<include "SA diet">>
 		<<include "SA long term effects">>
-		<<run App.SlaveAssignment.drugs($slaves[$i])>>
+		<<run App.SlaveAssignment.drugs(_slave)>>
 		<<include "SA relationships">>
 		<<include "SA rivalries">>
 		<<include "SA devotion">>
diff --git a/src/uncategorized/club.tw b/src/uncategorized/club.tw
index d5ee1248cd12cabbcb1866245ab5d5417465d2b7..72a274a2e3dfb49034bdc060e720955ea696394b 100644
--- a/src/uncategorized/club.tw
+++ b/src/uncategorized/club.tw
@@ -1,6 +1,6 @@
 :: Club [nobr]
 
-<<set $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Club", $showEncyclopedia = 1, $encyclopedia = "Club", _CL = $ClubiIDs.length>>
+<<set $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Club", $showEncyclopedia = 1, $encyclopedia = "Club", _CL = App.Entity.facilities.club.employeesIDs().size>>
 
 <p class="scene-intro">
 	<<if $clubName != "the Club">>
diff --git a/src/uncategorized/clubReport.tw b/src/uncategorized/clubReport.tw
index 3e4830ffcc559db9f55e0f79c8b69360f3989c2d..930a6c113e0044a91fed43750ae0bb7eeed6f9b3 100644
--- a/src/uncategorized/clubReport.tw
+++ b/src/uncategorized/clubReport.tw
@@ -1,10 +1,9 @@
 :: Club Report [nobr]
 
-<span id="clubstats">
-</span>
+<span id="clubstats" />
 
-<<SlaveIDSort $ClubiIDs>>
-<<set _DL = $ClubiIDs.length, _SL = $slaves.length, $clubBonuses = 0, $legendaryEntertainerID = 0, _FLsFetish = 0>>
+<<set _slaves = App.Utils.sortedEmployees(App.Entity.facilities.club)>>
+<<set _DL = _slaves.length, _SL = $slaves.length, $clubBonuses = 0, $legendaryEntertainerID = 0, _FLsFetish = 0>>
 <<set $legendaryWombID = 0>>
 <<set _minBonus = 50, _maxBonus = 150>>
 
@@ -145,39 +144,39 @@
 <</if>>
 
 <<if (_DL > 0)>>
-	<<for _dI = 0; _dI < _DL; _dI++>>
-		<<set $i = $slaveIndices[$ClubiIDs[_dI]]>>
-		<<setLocalPronouns $slaves[$i]>>
-		<<if ($legendaryEntertainerID == 0) && ($slaves[$i].prestige == 0) && ($slaves[$i].skill.entertainment >= 100) && ($slaves[$i].devotion > 50)>>
-			<<set $legendaryEntertainerID = $slaves[$i].ID>>
+	<<for _slave range _slaves>>
+		<<set $i = $slaveIndices[_slave.ID]>>
+		<<setLocalPronouns _slave>>
+		<<if ($legendaryEntertainerID == 0) && (_slave.prestige == 0) && (_slave.skill.entertainment >= 100) && (_slave.devotion > 50)>>
+			<<set $legendaryEntertainerID = _slave.ID>>
 		<</if>>
-		<<if ($legendaryWombID == 0) && (!isAmputee($slaves[$i])) && ($slaves[$i].preg > $slaves[$i].pregData.normalBirth/1.33) && ($slaves[$i].broodmother == 0) && ($slaves[$i].eggType == "human") && ($slaves[$i].counter.births > 10) && ($slaves[$i].devotion > 50) && ($slaves[$i].prestige == 0)>>
-			<<set $legendaryWombID = $slaves[$i].ID>>
+		<<if ($legendaryWombID == 0) && (!isAmputee(_slave)) && (_slave.preg > _slave.pregData.normalBirth/1.33) && (_slave.broodmother == 0) && (_slave.eggType == "human") && (_slave.counter.births > 10) && (_slave.devotion > 50) && (_slave.prestige == 0)>>
+			<<set $legendaryWombID = _slave.ID>>
 		<</if>>
-		<<if ($slaves[$i].devotion <= 20) && ($slaves[$i].trust >= -20)>>
-			<<set $slaves[$i].devotion -= 5, $slaves[$i].trust -= 5>>
-		<<elseif ($slaves[$i].devotion < 45)>>
-			<<set $slaves[$i].devotion += 4>>
-		<<elseif ($slaves[$i].devotion > 50)>>
-			<<set $slaves[$i].devotion -= 4>>
+		<<if (_slave.devotion <= 20) && (_slave.trust >= -20)>>
+			<<set _slave.devotion -= 5, _slave.trust -= 5>>
+		<<elseif (_slave.devotion < 45)>>
+			<<set _slave.devotion += 4>>
+		<<elseif (_slave.devotion > 50)>>
+			<<set _slave.devotion -= 4>>
 		<</if>>
 
-		<<if ($slaves[$i].trust < 30)>>
-			<<set $slaves[$i].trust += 5>>
+		<<if (_slave.trust < 30)>>
+			<<set _slave.trust += 5>>
 		<</if>>
 
-		<<if ($slaves[$i].health.condition < -80)>>
-			<<run improveCondition($slaves[$i], 20)>>
-		<<elseif ($slaves[$i].health.condition < -40)>>
-			<<run improveCondition($slaves[$i], 15)>>
-		<<elseif ($slaves[$i].health.condition < 0)>>
-			<<run improveCondition($slaves[$i], 10)>>
-		<<elseif ($slaves[$i].health.condition < 90)>>
-			<<run improveCondition($slaves[$i], 7)>>
+		<<if (_slave.health.condition < -80)>>
+			<<run improveCondition(_slave, 20)>>
+		<<elseif (_slave.health.condition < -40)>>
+			<<run improveCondition(_slave, 15)>>
+		<<elseif (_slave.health.condition < 0)>>
+			<<run improveCondition(_slave, 10)>>
+		<<elseif (_slave.health.condition < 90)>>
+			<<run improveCondition(_slave, 7)>>
 		<</if>>
 
-		<<if $slaves[$i].rules.living != "normal">>
-			<<set $slaves[$i].rules.living = "normal">>
+		<<if _slave.rules.living != "normal">>
+			<<set _slave.rules.living = "normal">>
 		<</if>>
 
 		<<if $showEWD != 0>>
@@ -185,35 +184,35 @@
 			/* 000-250-006 */
 			<<if $seeImages && $seeReportImages>>
 			<div class="imageRef tinyImg">
-				<<= SlaveArt($slaves[$i], 0, 0)>>
+				<<= SlaveArt(_slave, 0, 0)>>
 			</div>
 			<</if>>
 			/* 000-250-006 */
-			<span class='slave-name'><<= SlaveFullName($slaves[$i])>></span>
-			<<if $slaves[$i].choosesOwnAssignment == 2>>
+			<span class='slave-name'><<= SlaveFullName(_slave)>></span>
+			<<if _slave.choosesOwnAssignment == 2>>
 				<<include "SA chooses own job">>
 			<<else>>
 				is serving in $clubName.
 			<</if>>
-			<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.serveThePublic($slaves[$i])>>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.serveThePublic(_slave)>>
 			<br>&nbsp;&nbsp;&nbsp;
-			<<= App.SlaveAssignment.choosesOwnClothes($slaves[$i])>>
+			<<= App.SlaveAssignment.choosesOwnClothes(_slave)>>
 			<<include "SA rules">>
 			<<include "SA diet">>
 			<<include "SA long term effects">>
-			<<= App.SlaveAssignment.drugs($slaves[$i])>>
+			<<= App.SlaveAssignment.drugs(_slave)>>
 			<<include "SA relationships">>
 			<<include "SA rivalries">>
 			<br><<include "SA devotion">>
 		<<else>>
 			<<silently>>
 			<<include "SA chooses own job">>
-			<<run App.SlaveAssignment.serveThePublic($slaves[$i])>>
-			<<run App.SlaveAssignment.choosesOwnClothes($slaves[$i])>>
+			<<run App.SlaveAssignment.serveThePublic(_slave)>>
+			<<run App.SlaveAssignment.choosesOwnClothes(_slave)>>
 			<<include "SA rules">>
 			<<include "SA diet">>
 			<<include "SA long term effects">>
-			<<run App.SlaveAssignment.drugs($slaves[$i])>>
+			<<run App.SlaveAssignment.drugs(_slave)>>
 			<<include "SA relationships">>
 			<<include "SA rivalries">>
 			<<include "SA devotion">>
diff --git a/src/uncategorized/costsBudget.js b/src/uncategorized/costsBudget.js
index dcd76661613ccfa0b9d3b7ce837d3dec40efe142..3224707be519c0ed375fafc89c5e471212833b88 100644
--- a/src/uncategorized/costsBudget.js
+++ b/src/uncategorized/costsBudget.js
@@ -1,6 +1,6 @@
 App.UI.Budget.Cost = function() {
 	let el = document.createElement('p');
-	let table = document.createElement("TABLE");
+	let table = document.createElement("table");
 	table.classList.add("budget");
 	let node;
 	let subNode;
@@ -8,525 +8,6 @@ App.UI.Budget.Cost = function() {
 	let array;
 	let coloredRow = true;
 
-	/* Old way
-	// Set up profits column
-	V.lastWeeksCashProfits = new App.Data.Records.LastWeeksCash();
-
-	// HEADER / PENTHOUSE
-	let header = table.createTHead();
-	let row = header.insertRow(0);
-	let th = document.createElement("th");
-	let pent = document.createElement("h2");
-	pent.textContent = "Penthouse";
-	th.appendChild(pent);
-	row.appendChild(th);
-
-	array = [
-		"Income",
-		"Expense",
-		"Totals"
-	];
-	for (let th of array) {
-		let cell = document.createElement("th");
-		cell.textContent = th;
-		row.appendChild(cell);
-	}
-
-	let body = document.createElement('tbody');
-	table.appendChild(body);
-	row = body.insertRow();
-	// PENTHOUSE
-	generateRowsFromArray([
-		["whore", "Whores"],
-		["rest", "Resting"],
-		["houseServant", "House servants"],
-		["publicServant", "Public servants"],
-		["classes", "Classes"],
-		["milked", "Milked"],
-		["gloryhole", "Gloryhole"],
-	]);
-
-
-	// STRUCTURES
-	createSectionHeader("Structures");
-
-	// Brothel
-	structureSetup(V.brothelNameCaps, "brothel", V.brothel, "Brothel", V.BrothiIDs.length);
-	generateRowsFromArray([
-		["whoreBrothel", "Brothel whores"]
-	]);
-
-	if (V.brothel) {
-		node = new DocumentFragment();
-		node.appendChild(
-			App.UI.DOM.link(
-				"Brothel Ads",
-				() => {
-					V.nextButton = "Back to Budget";
-					V.nextLink = "Costs Budget";
-				},
-				[],
-				"Brothel Advertisement"
-			)
-		);
-	} else {
-		node = document.createTextNode("Brothel Ads");
-	}
-	generateRow("brothelAds", node);
-
-	if (V.brothel) {
-		generateRow("");
-	}
-
-	// Club
-	structureSetup(V.clubNameCaps, "club", V.club, "Club", V.ClubiIDs.length);
-
-	if (V.club) {
-		node = new DocumentFragment();
-		node.appendChild(
-			App.UI.DOM.link(
-				"Club ads",
-				() => {
-					V.nextButton = "Back to Budget";
-					V.nextLink = "Costs Budget";
-				},
-				[],
-				"Club Advertisement"
-			)
-		);
-	} else {
-		node = document.createTextNode(`${V.clubNameCaps} (${V.ClubiIDs.length} slaves)`);
-	}
-	generateRow("clubAds", node);
-
-	if (V.club) {
-		generateRow("");
-	}
-
-	// Arcade
-	structureSetup(V.arcadeNameCaps, "arcade", V.arcade, "Arcade", V.ArcadeiIDs.length);
-	generateRowsFromArray([
-		["gloryholeArcade", "Arcade slaves"]
-	]);
-
-	if (V.arcade) {
-		generateRow("");
-	}
-
-	// Dairy
-	structureSetup(V.dairyNameCaps, "dairy", V.dairy, "Dairy", V.DairyiIDs.length);
-	generateRowsFromArray([
-		["milkedDairy", "Dairy cows"]
-	]);
-
-	if (V.dairy) {
-		generateRow("");
-	}
-
-	structureSetup("Servants' Quarters", "servantsQuarters", V.servantsQuarters, "Servants' Quarters", V.ServQiIDs.length);
-
-	structureSetup("Master Suite", "masterSuite", V.masterSuite, "Master Suite", V.MastSiIDs.length);
-
-	structureSetup(V.schoolroomNameCaps, "school", V.schoolroom, "Schoolroom", V.SchlRiIDs.length);
-
-	structureSetup(V.spaNameCaps, "spa", V.spa, "Spa", V.SpaiIDs.length);
-
-	structureSetup(V.clinicNameCaps, "clinic", V.clinic, "Clinic", V.CliniciIDs.length);
-
-	structureSetup(V.cellblockNameCaps, "cellblock", V.cellblock, "Cellblock", V.CellBiIDs.length);
-
-	structureSetup("Prosthetic Lab", "lab", V.researchLab.level, "Prosthetic Lab", "maintenance for ");
-
-	structureSetup(V.incubatorNameCaps, "incubator", V.incubator, "Incubator", V.incubatorSlaves);
-
-	structureSetup(V.nurseryNameCaps, "nursery", V.nursery, "Nursery", V.NurseryiIDs.length);
-
-	structureSetup(V.farmyardNameCaps, "farmyard", V.farmyard, "Farmyard", V.FarmyardiIDs.length);
-
-	structureSetup(V.pitNameCaps, "pit", V.pit, "Pit", V.fighterIDs.length);
-
-
-	// Weather
-	generateRowsFromArray([
-		["environment", "Environment"]
-	]);
-	if (V.lastWeeksCashExpenses.weather < 0 && V.weatherCladding === 0) {
-		node = new DocumentFragment();
-		node.append("Weather is causing ");
-		let span = document.createElement('span');
-		span.className = "red";
-		span.textContent = "expensive damage. ";
-		node.append(span);
-		node.append("Consider a protective ");
-		node.appendChild(
-			App.UI.DOM.link(
-				"upgrade",
-				() => {
-					V.nextButton = "Back to Budget";
-					V.nextLink = "Costs Budget";
-				},
-				[],
-				"Manage Arcology"
-			)
-		);
-	} else {
-		node = document.createTextNode("Weather");
-	}
-
-	generateRow("weather", node);
-
-	// SLAVES
-	createSectionHeader("Slaves");
-
-	node = App.UI.DOM.link(
-		"Slave maintenance",
-		() => {
-			V.nextButton = "Back to Budget";
-			V.nextLink = "Costs Budget";
-		},
-		[],
-		"Costs Report Slaves"
-	);
-	generateRow("slaveUpkeepUndefined", node);
-
-	generateRowsFromArray([
-		["extraMilk", "Extra milk"],
-		["slaveTransfer", "Selling/buying major slaves"],
-
-	]);
-
-	node = new DocumentFragment();
-	node.append("Menials: ");
-	node.appendChild(
-		App.UI.DOM.link(
-			"Assistant's ",
-			() => {
-				V.nextButton = "Back to Budget";
-				V.nextLink = "Costs Budget";
-			},
-			[],
-			"Personal assistant options"
-		)
-	);
-	node.appendChild(document.createTextNode("flipping"));
-	generateRow("menialTransfer", node);
-
-	node = new DocumentFragment();
-	node.append("Fuckdolls: ");
-	node.appendChild(
-		App.UI.DOM.link(
-			"Assistant's ",
-			() => {
-				V.nextButton = "Back to Budget";
-				V.nextLink = "Costs Budget";
-			},
-			[],
-			"Personal assistant options"
-		)
-	);
-	node.appendChild(document.createTextNode("flipping"));
-	generateRow("fuckdollsTransfer", node);
-
-	node = new DocumentFragment();
-	node.append("Bioreactors: ");
-	node.appendChild(
-		App.UI.DOM.link(
-			"Assistant's ",
-			() => {
-				V.nextButton = "Back to Budget";
-				V.nextLink = "Costs Budget";
-			},
-			[],
-			"Personal assistant options"
-		)
-	);
-	node.appendChild(document.createTextNode("flipping"));
-	generateRow("menialBioreactorsTransfer", node);
-
-
-	generateRowsFromArray([
-		["babyTransfer", "Selling/buying babies"],
-	]);
-
-	node = App.UI.DOM.link(
-		"Menials",
-		() => {
-			V.nextButton = "Back to Budget";
-			V.nextLink = "Costs Budget";
-		},
-		[],
-		"Buy Slaves"
-	);
-	node.appendChild(document.createTextNode(": labor"));
-	generateRow("menialTrades", node);
-
-	generateRowsFromArray([
-		["fuckdolls", "Menials: fuckdolls"],
-		["menialBioreactors", "Menials: bioreactors"],
-		["porn", "Porn"],
-	]);
-
-	node = App.UI.DOM.link(
-		"Recruiter",
-		() => {
-			V.nextButton = "Back to Budget";
-			V.nextLink = "Costs Budget";
-		},
-		[],
-		"Recruiter Select"
-	);
-	node.appendChild(document.createTextNode(": labor"));
-	generateRow("recruiter", node);
-
-	generateRowsFromArray([
-		["menialRetirement", "Menials retiring"],
-		["slaveMod", "Slave modification"],
-		["slaveSurgery", "Slave surgery"],
-		["birth", "Slave birth"],
-	]);
-
-	// FINANCE
-	createSectionHeader("Finance");
-
-	generateRowsFromArray([
-		["personalBusiness", "Personal business"]
-	]);
-
-	if (V.PC.rules.living === "luxurious") {
-		text = `Since you are accustomed to luxury, your personal living expenses are:`;
-	} else if (V.PC.rules.living === "normal") {
-		text = `Since you are used to living well, your personal living expenses are:`;
-	} else {
-		text = `Since you are used to a fairly normal life, your personal living expenses are:`;
-	}
-
-	generateRowsFromArray([
-		["personalLivingExpenses", text]
-	]);
-
-	node = new DocumentFragment();
-	node.append("Your training expenses ");
-
-	switch (V.personalAttention) {
-		case "trading":
-			text = "Trading trainer";
-			break;
-		case "warfare":
-			text = "Warfare trainer";
-			break;
-		case "slaving":
-			text = "Slaving trainer";
-			break;
-		case "engineering":
-			text = "Engineering trainer";
-			break;
-		case "medicine":
-			text = "Medicine trainer";
-			break;
-		case "hacking":
-			text = "Hacking trainer";
-			break;
-		default:
-			text = "";
-	}
-
-	node.appendChild(
-		App.UI.DOM.link(
-			text,
-			() => {
-				V.nextButton = "Back to Budget";
-				V.nextLink = "Costs Budget";
-			},
-			[],
-			"Personal Attention Select"
-		)
-	);
-	if (text !== "") {
-		node.append(" fees");
-	}
-
-	generateRow("PCtraining", node);
-
-	generateRowsFromArray([
-		["PCmedical", "Your medical expenses"],
-		["PCskills", "Your skills"]
-	]);
-
-	node = new DocumentFragment();
-	node.append("Your ");
-	node.appendChild(
-		App.UI.DOM.link(
-			"rents",
-			() => {
-				V.nextButton = "Back to Budget";
-				V.nextLink = "Costs Budget";
-			},
-			[],
-			"Manage Arcology"
-		)
-	);
-	if (V.lastWeeksCashExpenses.rents < 0) {
-		node.append(" and bribes");
-	}
-	generateRow("rents", node);
-
-	generateRowsFromArray([
-		["stocks", `Stock dividends on ${V.personalShares} / ${V.publicShares + V.personalShares} shares.`],
-		["stocksTraded", "Stock trading"],
-		["fines", "Fines"],
-		["event", "Events"],
-		["war", "Arcology conflict"],
-		["capEx", "Capital expenses"],
-		["cheating", "CHEATING"]
-	]);
-
-	// POLICIES
-	createSectionHeader("Policies");
-
-	node = App.UI.DOM.link(
-		"Policies",
-		() => {
-			V.nextButton = "Back to Budget";
-			V.nextLink = "Costs Budget";
-		},
-		[],
-		"Policies"
-	);
-
-	generateRow("policies", node);
-
-	if (V.secExpEnabled) {
-		node = App.UI.DOM.link(
-			"Edicts",
-			() => {
-				V.nextButton = "Back to Budget";
-				V.nextLink = "Costs Budget";
-			},
-			[],
-			"edicts"
-		);
-	} else {
-		node = document.createTextNode("Edicts");
-	}
-	generateRow("edicts", node);
-
-	node = App.UI.DOM.link(
-		"Society shaping",
-		() => {
-			V.nextButton = "Back to Budget";
-			V.nextLink = "Costs Budget";
-		},
-		[],
-		"Future Society"
-	);
-
-	generateRow("futureSocieties", node);
-
-	if (V.TSS.subsidize !== 0) {
-		text = ["The Slavegirl School", "branch campus influence"];
-	} else if (V.GRI.subsidize !== 0) {
-		text = ["Growth Research Institute", "subsidiary lab influence"];
-	} else if (V.SCP.subsidize !== 0) {
-		text = ["St. Claver Preparatory", "branch campus influence"];
-	} else if (V.LDE.subsidize !== 0) {
-		text = ["L'Encole des Enculees", "branch campus influence"];
-	} else if (V.TGA.subsidize !== 0) {
-		text = ["The Gymnasium-Academy", "branch campus influence"];
-	} else if (V.TCR.subsidize !== 0) {
-		text = ["The Cattle Ranch", "branch campus influence"];
-	} else if (V.HA.subsidize !== 0) {
-		text = ["Hippolyta Academy", "branch campus influence"];
-	} else if (V.NUL.subsidize !== 0) {
-		text = ["Nueva Universidad de Libertad", "branch campus influence"];
-	} else if (V.TFS.subsidize !== 0) {
-		text = ["The Futanari Sisters", "community influence"];
-	} else if (V.TSS.schoolPresent === 1) {
-		text = ["The Slavegirl School", "branch campus upkeep"];
-	} else if (V.GRI.schoolPresent === 1) {
-		text = ["Growth Research Institute", "subsidiary lab upkeep"];
-	} else if (V.SCP.schoolPresent === 1) {
-		text = ["St. Claver Preparatory", "branch campus upkeep"];
-	} else if (V.LDE.schoolPresent === 1) {
-		text = ["L'Encole des Enculees", "branch campus upkeep"];
-	} else if (V.TGA.schoolPresent === 1) {
-		text = ["The Gymnasium-Academy", "branch campus upkeep"];
-	} else if (V.TCR.schoolPresent === 1) {
-		text = ["The Cattle Ranch", "branch campus upkeep"];
-	} else if (V.HA.schoolPresent === 1) {
-		text = ["Hippolyta Academy", "branch campus upkeep"];
-	} else if (V.NUL.schoolPresent === 1) {
-		text = ["Nueva Universidad de Libertad", "branch campus upkeep"];
-	} else {
-		text = ["Unknown school expense", ""];
-	}
-
-	node = new DocumentFragment();
-	node.appendChild(
-		App.UI.DOM.link(
-			text[0],
-			() => {
-				V.nextButton = "Back to Budget";
-				V.nextLink = "Costs Budget";
-			},
-			[],
-			"Policies"
-		)
-	);
-	node.append(" " + text[1]);
-
-	generateRow("schoolBacking", node);
-
-
-	generateRowsFromArray([
-		["citizenOrphanage", `Education of ${V.citizenOrphanageTotal} of your slaves' children in citizen schools`],
-		["privateOrphanage", `Private tutelage of ${V.privateOrphanageTotal} of your slaves' children`]
-	]);
-
-	node = document.createElement('div');
-	node.append("Security: ");
-	if (V.barracks) {
-		node.appendChild(
-			App.UI.DOM.link(
-				V.mercenariesTitle,
-				() => {
-					V.nextButton = "Back to Budget";
-					V.nextLink = "Costs Budget";
-				},
-				[],
-				"Barracks"
-			)
-		);
-	} else {
-		node.append("Mercenaries: ");
-		subNode = document.createElement('div');
-		subNode.className = "red detail";
-		subNode.textContent = "Cost increased by the lack of an armory to house them.";
-		node.appendChild(subNode);
-	}
-
-	if ((V.PC.skill.warfare >= 100) || (V.PC.career === "arcology owner")) {
-		subNode = document.createElement('div');
-		subNode.append("Cost reduced by your ");
-
-		subSubNode = document.createElement('span');
-		subSubNode.className = "springgreen";
-		subSubNode.textContent = "mercenary contacts.";
-		subNode.appendChild(subSubNode);
-		node.appendChild(subNode);
-	}
-
-	generateRow("mercenaries", node);
-
-	text = "Peacekeepers"; // set up peacekeepers text a little early so I can fit it into the generateRowsFromArray() call
-	if (V.peacekeepers.undermining !== 0) {
-		text += ", including undermining";
-	}
-	generateRowsFromArray([
-		["securityExpansion", "Security expansion"],
-		["specialForces", "Special forces"],
-		["peacekeepers", text]
-	]);
-	*/
 	// Set up object to track calculated displays
 	const income = "lastWeeksCashIncome";
 	const expenses = "lastWeeksCashExpenses";
@@ -586,7 +67,7 @@ App.UI.Budget.Cost = function() {
 
 	// HEAD GIRL
 	// find passage name for HGSuite
-	generateRowGroup(V.HGSuiteNameCaps, "HEADGIRLSUITE", V.HGSuite, null, V.HGSuiteiIDs.length);
+	generateRowGroup(V.HGSuiteNameCaps, "HEADGIRLSUITE");
 	generateRowCategory("Head Girl", "slaveAssignmentHeadgirl");
 	generateRowCategory("Head Girl Fucktoys", "slaveAssignmentHeadgirlsuite");
 
@@ -596,11 +77,11 @@ App.UI.Budget.Cost = function() {
 
 	// BODYGUARD
 	// find passage name for Armory
-	generateRowGroup("Armory", "DOJO", V.dojo, null, null);
+	generateRowGroup("Armory", "DOJO");
 	generateRowCategory("Bodyguard", "slaveAssignmentBodyguard");
 
 	// CONCUBINE
-	generateRowGroup("Master Suite", "MASTERSUITE", V.masterSuite, "Master Suite", V.MastSiIDs.length);
+	generateRowGroup("Master Suite", "MASTERSUITE");
 	generateRowCategory("Master Suite Maintenance", "masterSuite");
 	generateRowCategory("Master Suite Concubine", "slaveAssignmentConcubine");
 	generateRowCategory("Master Suite Fucktoys", "slaveAssignmentMastersuite");
@@ -611,12 +92,12 @@ App.UI.Budget.Cost = function() {
 	generateRowCategory("Agent's Partner", "slaveAssignmentAgentPartner");
 
 	// ARCADE
-	generateRowGroup(V.arcadeNameCaps, "ARCADE", V.arcade, "Arcade", V.ArcadeiIDs.length);
+	generateRowGroup(V.arcadeNameCaps, "ARCADE");
 	generateRowCategory("Arcade Maintenance", "arcade");
 	generateRowCategory("Arcade Fuckdolls", "slaveAssignmentArcade");
 
 	// BROTHEL
-	generateRowGroup(V.brothelNameCaps, "BROTHEL", V.brothel, "Brothel", V.BrothiIDs.length);
+	generateRowGroup(V.brothelNameCaps, "BROTHEL");
 	generateRowCategory("Brothel Maintenance", "brothel");
 	generateRowCategory("Brothel Madam", "slaveAssignmentMadam");
 	generateRowCategory("Brothel MadamVign", "slaveAssignmentMadamVign");
@@ -625,13 +106,13 @@ App.UI.Budget.Cost = function() {
 	generateRowCategory("Brothel Ads", "brothelAds");
 
 	// CELLBLOCK
-	generateRowGroup(V.cellblockNameCaps, "CELLBLOCK", V.cellblock, "Cellblock", V.CellBiIDs.length);
+	generateRowGroup(V.cellblockNameCaps, "CELLBLOCK");
 	generateRowCategory("Cellblock Maintenance", "cellblock");
 	generateRowCategory("Cellblock Warden", "slaveAssignmentWarden");
 	generateRowCategory("Cellblock Slaves", "slaveAssignmentCellblock");
 
 	// CLUB
-	generateRowGroup(V.clubNameCaps, "CLUB", V.club, "Club", V.ClubiIDs.length);
+	generateRowGroup(V.clubNameCaps, "CLUB");
 	generateRowCategory("Club Maintenance", "club");
 	generateRowCategory("Club DJ", "slaveAssignmentDj");
 	generateRowCategory("Club DJVign", "slaveAssignmentDjVign");
@@ -640,63 +121,63 @@ App.UI.Budget.Cost = function() {
 	generateRowCategory("Club Ads", "clubAds");
 
 	// CLINIC
-	generateRowGroup(V.clinicNameCaps, "CLINIC", V.club, "Club", V.ClubiIDs.length);
+	generateRowGroup(V.clinicNameCaps, "CLINIC");
 	generateRowCategory("Clinic Maintenance", "clinic");
 	generateRowCategory("Clinic Nurse", "slaveAssignmentNurse");
 	generateRowCategory("Clinic Slaves", "slaveAssignmentClinic");
 
 	// DAIRY
-	generateRowGroup(V.dairyNameCaps, "DAIRY", V.dairy, "Dairy", V.DairyiIDs.length);
+	generateRowGroup(V.dairyNameCaps, "DAIRY");
 	generateRowCategory("Dairy Maintenance", "dairy");
 	generateRowCategory("Dairy Milkmaid", "slaveAssignmentMilkmaid");
 	generateRowCategory("Dairy Cows", "slaveAssignmentDairy");
 	generateRowCategory("Dairy Cows", "slaveAssignmentDairyVign");
 
 	// FARMYARD
-	generateRowGroup(V.farmyardNameCaps, "FARMYARD", V.farmyard, "Farmyard", V.FarmyardiIDs.length);
+	generateRowGroup(V.farmyardNameCaps, "FARMYARD");
 	generateRowCategory("Farmyard Maintenance", "farmyard");
 	generateRowCategory("Farmyard Farmer", "slaveAssignmentFarmer");
 	generateRowCategory("Farmyard Farmhands", "slaveAssignmentFarmyard");
 	generateRowCategory("Farmyard FarmhandsVign", "slaveAssignmentFarmyardVign");
 
 	// INCUBATOR
-	generateRowGroup(V.incubatorNameCaps, "INCUBATOR", V.incubator, "Incubator", V.incubatorSlaves);
+	generateRowGroup(V.incubatorNameCaps, "INCUBATOR");
 	generateRowCategory("Incubator Maintenance", "incubator");
 	generateRowCategory("Incubator Babies", "incubatorSlaves");
 
 	// NURSERY
-	generateRowGroup(V.nurseryNameCaps, "NURSERY", V.nursery, "Nursery", V.NurseryiIDs.length);
+	generateRowGroup(V.nurseryNameCaps, "NURSERY");
 	generateRowCategory("Nursery Maintenance", "nursery");
 	generateRowCategory("Nursery Matron", "slaveAssignmentMatron");
 	generateRowCategory("Nursery Nannies", "slaveAssignmentNursery");
 	generateRowCategory("Nursery NanniesVign", "slaveAssignmentNurseryVign");
 
 	// PIT
-	generateRowGroup(V.pitNameCaps, "PIT", V.pit, "Pit", V.fighterIDs.length);
+	generateRowGroup(V.pitNameCaps, "PIT");
 	generateRowCategory("Pit Maintenance", "pit");
 
 	// PROSTHETIC LAB
-	generateRowGroup("Prosthetic Lab", "PROSTHETICLAB", V.researchLab.level, "Prosthetic Lab", null);
+	generateRowGroup("Prosthetic Lab", "PROSTHETICLAB");
 	generateRowCategory("Prosthetic Lab Maintenance", "lab");
 	generateRowCategory("Prostethic Lab Research", "labResearch");
 	generateRowCategory("Prostethic Lab Scientists", "labScientists");
 	generateRowCategory("Prostethic Lab Menials", "labMenials");
 
 	// SCHOOLROOM
-	generateRowGroup(V.schoolroomNameCaps, "SCHOOLROOM", V.schoolroom, "Schoolroom", V.SchlRiIDs.length);
+	generateRowGroup(V.schoolroomNameCaps, "SCHOOLROOM");
 	generateRowCategory("Schoolroom Maintenance", "school");
 	generateRowCategory("Schoolroom Teacher", "slaveAssignmentTeacher");
 	generateRowCategory("Schoolroom Students", "slaveAssignmentSchool");
 
 	// SERVANTS' QUARTERS
-	generateRowGroup(V.servantsQuartersNameCaps, "SERVANTSQUARTERS", V.servantsQuarters, "Servants' Quarters", V.ServQiIDs.length);
+	generateRowGroup(V.servantsQuartersNameCaps, "SERVANTSQUARTERS");
 	generateRowCategory("Servants' Quarters Maintenance", "servantsQuarters");
 	generateRowCategory("Servants' Quarters Steward", "slaveAssignmentSteward");
 	generateRowCategory("Servants' Quarters Servants", "slaveAssignmentQuarter");
 	generateRowCategory("Servants' Quarters ServantsVign", "slaveAssignmentQuarterVign");
 
 	// SPA
-	generateRowGroup(V.spaNameCaps, "SPA", V.spa, "Spa", V.SpaiIDs.length);
+	generateRowGroup(V.spaNameCaps, "SPA");
 	generateRowCategory("Spa Maintenance", "spa");
 	generateRowCategory("Spa Attendant", "slaveAssignmentAttendant");
 	generateRowCategory("Spa Slaves", "slaveAssignmentSpa");
@@ -873,7 +354,7 @@ App.UI.Budget.Cost = function() {
 		}
 	}
 
-	function generateRowGroup(title, group, structure, passage, occupancy) {
+	function generateRowGroup(title, group) {
 		if (F[group].income || F[group].expenses || V.showAllEntries.costsBudget) {
 			row = table.insertRow();
 			cell = row.insertCell();
diff --git a/src/uncategorized/coursingAssociation.tw b/src/uncategorized/coursingAssociation.tw
index bfc787958a9897af0c2d84a436eb9a55fb11d897..a1d356c18ad9c96810ca230b75a0f323c046e479 100644
--- a/src/uncategorized/coursingAssociation.tw
+++ b/src/uncategorized/coursingAssociation.tw
@@ -16,13 +16,13 @@ The chasing slaves are known as lurchers, the term once used for the sighthounds
 
 <<if $LurcherID != 0>>
 	<br><br>''Fire your Lurcher:''
-	<<= App.UI.SlaveList.render.listMarkup([App.Utils.slaveIndexForId($LurcherID)], [],
-		(slave) => App.UI.DOM.passageLink(SlaveFullName(slave), 'Coursing Association', () => removeJob(slave, "@Lurcher")))>>
+	<<= App.UI.SlaveList.render.listMarkup([$LurcherID], [],
+		(slave) => App.UI.DOM.passageLink(SlaveFullName(slave), 'Coursing Association', () => removeJob(slave, Job.LURCHER)))>>
 <</if>>
 
 <br><br>''Select a slave to course as a Lurcher:''
 <br><br>
 <<= App.UI.SlaveList.slaveSelectionList(
 		s => $LurcherID !== s.ID && canWalk(s) && canHold(s) && (canSee(s) || canHear(s)) && s.fuckdoll === 0 && isSlaveAvailable(s),
-		(slave) => App.UI.DOM.link(SlaveFullName(slave), () => assignmentTransition(slave, "@Lurcher", "Coursing Association"))
+		(slave) => App.UI.DOM.link(SlaveFullName(slave), () => assignmentTransition(slave, Job.LURCHER, "Coursing Association"))
 	)>>
diff --git a/src/uncategorized/dairy.tw b/src/uncategorized/dairy.tw
index 3fc4745e1d5225b6e5361edddfbdb9d6a5ea4d61..a7583c5059fff13b31d0a505f7ead6eac434a75d 100644
--- a/src/uncategorized/dairy.tw
+++ b/src/uncategorized/dairy.tw
@@ -1,8 +1,8 @@
 :: Dairy [nobr]
 
-<<set $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Dairy", $showEncyclopedia = 1, $encyclopedia = "Dairy", _SL = $slaves.length, _DL = $DairyiIDs.length>>
+<<set _slaves = App.Utils.sortedEmployees(App.Entity.facilities.dairy)>>
+<<set $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Dairy", $showEncyclopedia = 1, $encyclopedia = "Dairy", _SL = $slaves.length, _DL = _slaves.length>>
 
-<<SlaveIDSort $DairyiIDs>>
 <<if $dairyName != "the Dairy">>
 	<<set $dairyNameCaps = $dairyName.replace("the ", "The ")>>
 <</if>>
@@ -37,24 +37,29 @@
 	</p>
 	<p>
 		<<if $dairyPregSettingChanged == 1>>
-			<<for _Di = 0; _Di < _DL; _Di++>>
-				<<set _i = $slaveIndices[$DairyiIDs[_Di]]>>
-				<<setLocalPronouns $slaves[_i]>>
-				<<if ($slaves[_i].vagina > -1) && ($slaves[_i].vagina < 3)>>
-					$slaves[_i].slaveName's milking machine ejects $him, since it cannot fit the mandated dildo into $his tight cunt.
-					<<= removeJob($slaves[_i], "work in the dairy")>>
-					<<set _DL--, _Di-->>
+			<<set _purgedSlaves = false>>
+			<<for _slave range _slaves>>
+				<<setLocalPronouns _slave>>
+				<<if (_slave.vagina > -1) && (_slave.vagina < 3)>>
+					_slave.slaveName's milking machine ejects $him, since it cannot fit the mandated dildo into $his tight cunt.
+					<<= removeJob(_slave, Job.DAIRY)>>
+					<<set _purgedSlaves = true>>
+					<<continue>>
 				<</if>>
 				<<if ($dairyPregSetting > 0)>>
-					<<set WombCleanGenericReserve($slaves[_i], "incubator", 9999)>>
-					<<set WombCleanGenericReserve($slaves[_i], "nursery", 9999)>>
-					<<if (($slaves[_i].broodmother > 0) || ($slaves[_i].bellyImplant != -1))>>
-						$slaves[_i].slaveName's milking machine ejects $him, since it detected a foreign body in $his womb blocking its required functions.
-						<<= removeJob($slaves[_i], "work in the dairy")>>
-						<<set _DL--, _Di-->>
+					<<set WombCleanGenericReserve(_slave, "incubator", 9999)>>
+					<<set WombCleanGenericReserve(_slave, "nursery", 9999)>>
+					<<if ((_slave.broodmother > 0) || (_slave.bellyImplant != -1))>>
+						_slave.slaveName's milking machine ejects $him, since it detected a foreign body in $his womb blocking its required functions.
+						<<= removeJob(_slave, Job.DAIRY)>>
+						<<set _purgedSlaves = true>>
 					<</if>>
 				<</if>>
 			<</for>>
+			<<if _purgedSlaves>>
+				<<set _slaves = App.Utils.sortedEmployees(App.Entity.facilities.dairy)>>
+				<<set _DL = _slaves.length>>
+			<</if>>
 			In unison, the milking machines withdraw their dildos from the pregnant slaves' vaginas. The auxiliary drug injectors hiss as the slaves are filled with drugs that promote natural lubrication. The slaves begin to shift awkwardly as they feel their pussies begin to drool slick female fluids. Once a machine judges that its slave's cunt is sufficiently wet, it readies a gigantic dildo. The slaves cannot see their own groins, but as soon as the heads of the dildos touch their pussylips, they begin to
 			<<if $dairyFeedersSetting < 2>>
 				struggle instinctively against their restraints, and the more energetic ones begin to weep.
@@ -74,15 +79,19 @@
 	</p>
 	<p>
 		<<if $dairyStimulatorsSettingChanged == 1>>
-			<<for _Di = 0; _Di < _DL; _Di++>>
-				<<set _i = $slaveIndices[$DairyiIDs[_Di]]>>
-				<<setLocalPronouns $slaves[_i]>>
-				<<if ($slaves[_i].anus < 3)>>
-					$slaves[_i].slaveName's milking machine ejects $him, since it cannot fit its massive anal dildo up $his tight asshole.
-					<<= removeJob($slaves[_i], "work in the dairy")>>
-					<<set _DL--, _Di-->>
+			<<set _purgedSlaves = false>>
+			<<for _slave range _slaves>>
+				<<if (_slave.anus < 3)>>
+					<<setLocalPronouns _slave>
+					_slave.slaveName's milking machine ejects $him, since it cannot fit its massive anal dildo up $his tight asshole.
+					<<= removeJob(_slave, Job.DAIRY)>>
+					<<set _purgedSlaves = true>>
 				<</if>>
 			<</for>>
+			<<if _purgedSlaves>>
+				<<set _slaves = App.Utils.sortedEmployees(App.Entity.facilities.dairy)>>
+				<<set _DL = _slaves.length>>
+			<</if>>
 			In unison, the milking machines shove their dildos deep into slaves' anuses, ejaculating large quantities of lubricant deep inside their rectums. The slaves start in surprise at the sudden rush of warm slick fluid, and then relax as the phalli withdraw themselves from their butts. Their relief is short-lived, however, as their assholes are only empty for a moment. The reasonably sized dildos are replaced with dildos the size of horse cocks. As soon as the slaves feel the heads of these monstrous phalli press inexorably against their sphincters,
 			<<if $dairyFeedersSetting < 2>>
 				they begin to scream and struggle instinctively. As the constant assrape that will define their existences for the foreseeable future begins in earnest, their whining
@@ -104,30 +113,38 @@
 	<p>
 		<<if $dairyRestraintsSettingChanged == 1>>
 			<<if $dairyRestraintsSetting == 1>>
-				<<for _Di = 0; _Di < _DL; _Di++>>
-					<<set _i = $slaveIndices[$DairyiIDs[_Di]]>>
-					<<setLocalPronouns $slaves[_i]>>
-					<<if ($slaves[_i].indentureRestrictions >= 2)>>
-						$slaves[_i].slaveName's milking machine declines to restrain $him, since $he is encoded as an indentured servant protected from restraint for milking.
-						<<= removeJob($slaves[_i], "work in the dairy")>>
-						<<set _DL--, _Di-->>
+				<<set _purgedSlaves = false>>
+				<<for _slave range _slaves>>
+					<<setLocalPronouns _slave>>
+					<<if (_slave.indentureRestrictions >= 2)>>
+						_slave.slaveName's milking machine declines to restrain $him, since $he is encoded as an indentured servant protected from restraint for milking.
+						<<= removeJob(_slave, Job.DAIRY)>>
+						<<set _purgedSlaves = true>>
 					<</if>>
 				<</for>>
+				<<if _purgedSlaves>>
+					<<set _slaves = App.Utils.sortedEmployees(App.Entity.facilities.dairy)>>
+					<<set _DL = _slaves.length>>
+				<</if>>
 				The next cow to stumble over to a milking machine to be drained is gently but firmly embraced by its restraints, allowing it to suck _himU dry and violate _himU without any regard for _hisU feelings. Most of the cows accept this new wrinkle in their lives, since the restraints let them go afterward, and the milking machines bring temporary relief. Some, however, begin to regard the machines with concern.
 			<<else>>
 				The next cow to stumble over to a milking machine to be drained finds to _hisU surprise that _heU is not restrained while it sucks _himU dry. _HeU wiggles around experimentally, verifying that _heU is indeed free to pull _himselfU away from its ministrations if _heU wishes. There's little actual impact on the cows' behavior, since they still need the relief the machines offer.
 			<</if>>
 		<<elseif $dairyRestraintsSettingChanged == -1>>
 			<<if $dairyRestraintsSetting == 1>>
-				<<for _Di = 0; _Di < _DL; _Di++>>
-					<<set _i = $slaveIndices[$DairyiIDs[_Di]]>>
-					<<setLocalPronouns $slaves[_i]>>
-					<<if ($slaves[_i].indentureRestrictions >= 1)>>
-						$slaves[_i].slaveName's milking machine declines to restrain $him, since $he is encoded as an indentured servant protected from being restrained for milking.
-						<<= removeJob($slaves[_i], "work in the dairy")>>
-						<<set _DL--, _Di-->>
+				<<set _purgedSlaves = false>>
+				<<for _slave range _slaves>>
+					<<if (_slave.indentureRestrictions >= 1)>>
+						<<setLocalPronouns _slave>>
+						_slave.slaveName's milking machine declines to restrain $him, since $he is encoded as an indentured servant protected from being restrained for milking.
+						<<= removeJob(_slave, "work in the dairy")>>
+						<<set _purgedSlaves = true>>
 					<</if>>
 				<</for>>
+				<<if _purgedSlaves>>
+					<<set _slaves = App.Utils.sortedEmployees(App.Entity.facilities.dairy)>>
+					<<set _DL = _slaves.length>>
+				<</if>>
 				The next time a cow tries to get up after being milked, _heU finds to _hisU sudden terror that the machine will not let _himU go. It continues to add fluids to _hisU body, and remove them from _hisU nipples, ignoring _hisU mounting panic as _heU realizes that it's to be _hisU new partner and lover, on a level far more intimate than any possible human relationship. The other cows approach their machines with trepidation, but the mounting pressure in their udders forces them to embrace their immurement despite their terror.
 			<<else>>
 				The next time a cow finishes an intensive milking period, _hisU restraints loosen. _HeU does not move for a long time, as though _heU is unable to believe that _heU is, at least in an immediate and local sense, free. Finally, _heU prises _himselfU out of _hisU milking machine's embrace, thick strings of fluid leading from it to _hisU orifices as _heU pulls each one off of its corresponding port.
diff --git a/src/uncategorized/dairyReport.tw b/src/uncategorized/dairyReport.tw
index e975241557b4f9072f6df7b7420ce4c531bb3ed9..57719703986872cf6322edaaccfc13cd3ebdc28e 100644
--- a/src/uncategorized/dairyReport.tw
+++ b/src/uncategorized/dairyReport.tw
@@ -5,8 +5,8 @@
 
 <<set _MMWorkout = 0>>
 
-<<SlaveIDSort $DairyiIDs>>
-<<set _DL = $DairyiIDs.length, _SL = $slaves.length, $bioreactorPerfectedID = 0, $legendaryBallsID = 0, $legendaryCowID = 0, $milkmaidDevotionBonus = 1, $milkmaidHealthBonus = 0, $milkmaidTrustBonus = 1, $milkmaidDevotionThreshold = 45, $milkmaidTrustThreshold = 35, _anusesStretched = 0, _birthers = 0, _births = 0, _cumWeek = 0, _femCumWeek = 0, _FLsFetish = 0, _milkWeek = 0, _balltacular = 0, _boobtacular = 0, _careerForgotten = 0, _chemMinor = 0, _chemSevere = 0, _desterilized = 0, _hatefilled = 0, _horrified = 0, _intelligenceLost = 0, _mindbroken = 0, _profits = 0, _skillsLost = 0, _stupidified = 0, _vaginasStretched = 0, _cmSlave = 0, _dsSlave = 0, _hfSlave = 0, _hrSlave = 0, _slSlave = 0, _cfSlave = 0, _stSlave = 0, _btSlave = 0>>
+<<set _slaves = App.Utils.sortedEmployees(App.Entity.facilities.dairy)>>
+<<set _DL = _slaves.length, _SL = $slaves.length, $bioreactorPerfectedID = 0, $legendaryBallsID = 0, $legendaryCowID = 0, $milkmaidDevotionBonus = 1, $milkmaidHealthBonus = 0, $milkmaidTrustBonus = 1, $milkmaidDevotionThreshold = 45, $milkmaidTrustThreshold = 35, _anusesStretched = 0, _birthers = 0, _births = 0, _cumWeek = 0, _femCumWeek = 0, _FLsFetish = 0, _milkWeek = 0, _balltacular = 0, _boobtacular = 0, _careerForgotten = 0, _chemMinor = 0, _chemSevere = 0, _desterilized = 0, _hatefilled = 0, _horrified = 0, _intelligenceLost = 0, _mindbroken = 0, _profits = 0, _skillsLost = 0, _stupidified = 0, _vaginasStretched = 0, _cmSlave = 0, _dsSlave = 0, _hfSlave = 0, _hrSlave = 0, _slSlave = 0, _cfSlave = 0, _stSlave = 0, _btSlave = 0>>
 
 <!-- Statistics gathering -->
 <<set $facility = $facility || {}, $facility.dairy = initFacilityStatistics($facility.dairy)>>
@@ -16,73 +16,72 @@
 	<<set _milkmaidImpregnated = 0, _milkers = 0, _cummers = 0, _breeders = 0, _prostateStim = 0>>
 
 	<<if (_DL > 0)>>
-		<<for _dI = 0; _dI < _DL; _dI++>>
-			<<set _i = $slaveIndices[$DairyiIDs[_dI]]>>
-			<<if $slaves[_i].lactation > 0>>
+		<<for _slave range _slaves>>
+			<<if _slave.lactation > 0>>
 				<<set _milkers++>>
 			<</if>>
-			<<if $slaves[_i].balls > 0 && $slaves[_i].ballType == "human">>
+			<<if _slave.balls > 0 && _slave.ballType == "human">>
 				<<set _cummers++>>
 			<</if>>
-			<<if ($slaves[_i].bellyPreg >= 500 && $dairyPregSetting > 0)>>
+			<<if (_slave.bellyPreg >= 500 && $dairyPregSetting > 0)>>
 				<<set _breeders++>>
 			<</if>>
 			<<if ($milkmaidImpregnates == 1) && (canPenetrate($Milkmaid)) && $Milkmaid.pubertyXY == 1>>
-				<<if (canImpreg($slaves[_i], $Milkmaid))>>
-					<<set $slaves[_i].preg = 1, $slaves[_i].pregSource = $Milkmaid.ID, $slaves[_i].pregKnown = 1, $slaves[_i].pregWeek = 1, _milkmaidImpregnated++>>
-					<<if $slaves[_i].mpreg == 1>>
-						<<set $slaves[_i].counter.anal += 10, $analTotal += 10>>
+				<<if (canImpreg(_slave, $Milkmaid))>>
+					<<set _slave.preg = 1, _slave.pregSource = $Milkmaid.ID, _slave.pregKnown = 1, _slave.pregWeek = 1, _milkmaidImpregnated++>>
+					<<if _slave.mpreg == 1>>
+						<<set _slave.counter.anal += 10, $analTotal += 10>>
 					<<else>>
-						<<set $slaves[_i].counter.vaginal += 10, $vaginalTotal += 10>>
+						<<set _slave.counter.vaginal += 10, $vaginalTotal += 10>>
 					<</if>>
-					<<set $slaves[_i].pregType = setPregType($slaves[_i])>>
-					<<set WombImpregnate($slaves[_i], $slaves[_i].pregType, $Milkmaid.ID, 1)>>
+					<<set _slave.pregType = setPregType(_slave)>>
+					<<set WombImpregnate(_slave, _slave.pregType, $Milkmaid.ID, 1)>>
 				<</if>>
 			<</if>>
 			/* how much effort the MM must take to force a slave into a stall */
-			<<if $slaves[_i].devotion <= 20>>
+			<<if _slave.devotion <= 20>>
 				<<set _MMWorkout++>>
 			<</if>>
-			<<if $slaves[_i].trust < 20>>
+			<<if _slave.trust < 20>>
 				<<set _MMWorkout++>>
 			<</if>>
-			<<if $slaves[_i].muscles >= 30 || $slaves[_i].muscles < -30>>
+			<<if _slave.muscles >= 30 || _slave.muscles < -30>>
 				<<set _MMWorkout++>>
 			<</if>>
-			<<if $slaves[_i].weight >= 70>>
+			<<if _slave.weight >= 70>>
 				<<set _MMWorkout++>>
 			<</if>>
-			<<if $slaves[_i].weight >= 160>>
+			<<if _slave.weight >= 160>>
 				<<set _MMWorkout++>>
 			<</if>>
-			<<if $slaves[_i].boobs >= 20000>>
+			<<if _slave.boobs >= 20000>>
 				<<set _MMWorkout++>>
 			<</if>>
-			<<if $slaves[_i].balls >= 30>>
+			<<if _slave.balls >= 30>>
 				<<set _MMWorkout++>>
 			<</if>>
-			<<if $slaves[_i].belly >= 5000>>
+			<<if _slave.belly >= 5000>>
 				<<set _MMWorkout++>>
 			<</if>>
-			<<if !canWalk($slaves[_i])>> /* big bonus if they can't move themselves and are fat as cows */
-				<<if $slaves[_i].weight >= 70>>
+			<<if !canWalk(_slave)>> /* big bonus if they can't move themselves and are fat as cows */
+				<<if _slave.weight >= 70>>
 					<<set _MMWorkout += 2>>
 				<</if>>
-				<<if $slaves[_i].weight >= 160>>
+				<<if _slave.weight >= 160>>
 					<<set _MMWorkout += 2>>
 				<</if>>
-				<<if $slaves[_i].boobs >= 20000>>
+				<<if _slave.boobs >= 20000>>
 					<<set _MMWorkout += 2>>
 				<</if>>
-				<<if $slaves[_i].balls >= 30>>
+				<<if _slave.balls >= 30>>
 					<<set _MMWorkout += 2>>
 				<</if>>
-				<<if $slaves[_i].belly >= 5000>>
+				<<if _slave.belly >= 5000>>
 					<<set _MMWorkout += 2>>
 				<</if>>
 			<</if>>
 			<<if ($dairyStimulatorsSetting < 2) && ($Milkmaid.dick > 4) && (canPenetrate($Milkmaid)) && _prostateStim != 1>>
-				<<if ($slaves[_i].balls > 0) && ($slaves[_i].prostate > 0)>>
+				<<if (_slave.balls > 0) && (_slave.prostate > 0)>>
 					<<set _prostateStim = 1>>
 				<</if>>
 			<</if>>
@@ -220,44 +219,44 @@
 		<<set $slaves[_FLs].need -= 50>>
 	<</if>>
 	<<set $milkmaidDevotionThreshold += (5*$milkmaidDevotionBonus), $milkmaidTrustThreshold += (5*$milkmaidTrustBonus)>>
-	<<for _dI = 0; _dI < _DL; _dI++>>
-		<<set $i = $slaveIndices[$DairyiIDs[_dI]]>>
-		<<if $Milkmaid.rivalryTarget == $slaves[$i].ID>>
-			<<setLocalPronouns $slaves[$i] 2>>
-			$He either neglects or harasses $his <<print rivalryTerm($Milkmaid)>>, $slaves[$i].slaveName, making sure _he2 is unhappy and uncomfortable.
-			<<set $slaves[$i].devotion -= 3, $slaves[$i].trust -= 3>>
+	<<for _slave range _slaves>>
+		<<set $i = $slaveIndices[_slave.ID]>>
+		<<if $Milkmaid.rivalryTarget == _slave.ID>>
+			<<setLocalPronouns _slave 2>>
+			$He either neglects or harasses $his <<print rivalryTerm($Milkmaid)>>, _slave.slaveName, making sure _he2 is unhappy and uncomfortable.
+			<<set _slave.devotion -= 3, _slave.trust -= 3>>
 			<<if random(1,100) > 65>>
-				<<set $Milkmaid.rivalry++, $slaves[_FLs].rivalry++, $slaves[$i].rivalry++>>
+				<<set $Milkmaid.rivalry++, $slaves[_FLs].rivalry++, _slave.rivalry++>>
 			<</if>>
-		<<elseif $Milkmaid.relationshipTarget == $slaves[$i].ID>>
-			<<setLocalPronouns $slaves[$i] 2>>
-			$He dotes over $his <<print relationshipTerm($Milkmaid)>>, $slaves[$i].slaveName, making sure _he2 is happy and comfortable.
-			<<set $slaves[$i].devotion++, $slaves[$i].trust++>>
-		<<elseif areRelated($Milkmaid, $slaves[$i])>>
-			<<setLocalPronouns $slaves[$i] 2>>
-			$He pays special attention to $his <<print relativeTerm($Milkmaid,$slaves[$i])>>, $slaves[$i].slaveName, making sure _he2 is well kept and happy.
-			<<set $slaves[$i].trust++>>
+		<<elseif $Milkmaid.relationshipTarget == _slave.ID>>
+			<<setLocalPronouns _slave 2>>
+			$He dotes over $his <<print relationshipTerm($Milkmaid)>>, _slave.slaveName, making sure _he2 is happy and comfortable.
+			<<set _slave.devotion++, _slave.trust++>>
+		<<elseif areRelated($Milkmaid, _slave)>>
+			<<setLocalPronouns _slave 2>>
+			$He pays special attention to $his <<print relativeTerm($Milkmaid,_slave)>>, _slave.slaveName, making sure _he2 is well kept and happy.
+			<<set _slave.trust++>>
 		<</if>>
-		<<if $slaves[$i].prestigeDesc == "$He is remembered for winning best in show as a dairy cow.">>
-			<<if ($slaves[$i].lactation > 0) && (($slaves[$i].boobs-$slaves[$i].boobsImplant) > 6000)>>
-				$He spends extra time with $slaves[$i].slaveName, the well-known cow. $He is fascinated by $slaves[$i].slaveName's massive $slaves[$i].boobs cc breasts and spends extra time massaging and kneading them to maximize production.
-				<<set $slaves[$i].devotion += 3, $slaves[$i].trust += 3>>
+		<<if _slave.prestigeDesc == "$He is remembered for winning best in show as a dairy cow.">>
+			<<if (_slave.lactation > 0) && ((_slave.boobs-_slave.boobsImplant) > 6000)>>
+				$He spends extra time with _slave.slaveName, the well-known cow. $He is fascinated by _slave.slaveName's massive _slave.boobs cc breasts and spends extra time massaging and kneading them to maximize production.
+				<<set _slave.devotion += 3, _slave.trust += 3>>
 			<<else>>
-				$He is disappointed that the well-known cow $slaves[$i].slaveName<<if ($slaves[$i].lactation == 0)>> isn't producing milk anymore. <<else>>'s breasts have shrunken considerably from their heyday.<</if>>
+				$He is disappointed that the well-known cow _slave.slaveName<<if (_slave.lactation == 0)>> isn't producing milk anymore. <<else>>'s breasts have shrunken considerably from their heyday.<</if>>
 			<</if>>
 		<</if>>
-		<<if $slaves[$i].prestigeDesc == "$He is remembered for winning best in show as a cockmilker.">>
-			<<if (($slaves[$i].balls > 6) && ($slaves[$i].dick != 0)) || (($slaves[$i].balls > 4) && ($slaves[$i].dick != 0) && ($slaves[$i].prostate > 1))>>
-				$He spends extra time with $slaves[$i].slaveName, the massive ejaculating cow. $He can't help but massage the cow's dick and testes to stimulate them further and coax more from them.
-				<<set $slaves[$i].devotion += 3, $slaves[$i].trust += 3>>
+		<<if _slave.prestigeDesc == "$He is remembered for winning best in show as a cockmilker.">>
+			<<if ((_slave.balls > 6) && (_slave.dick != 0)) || ((_slave.balls > 4) && (_slave.dick != 0) && (_slave.prostate > 1))>>
+				$He spends extra time with _slave.slaveName, the massive ejaculating cow. $He can't help but massage the cow's dick and testes to stimulate them further and coax more from them.
+				<<set _slave.devotion += 3, _slave.trust += 3>>
 			<<else>>
-				$He is disappointed that the (formerly) massive ejaculating cow $slaves[$i].slaveName<<if $slaves[$i].balls == 0 || $slaves[$i].dick == 0>> is incapable of giving cum<<elseif $slaves[$i].prostate < 2>> no longer possesses a hyperactive prostate<<else>>'s balls are considerably smaller than at their heyday<</if>>.
+				$He is disappointed that the (formerly) massive ejaculating cow _slave.slaveName<<if _slave.balls == 0 || _slave.dick == 0>> is incapable of giving cum<<elseif _slave.prostate < 2>> no longer possesses a hyperactive prostate<<else>>'s balls are considerably smaller than at their heyday<</if>>.
 			<</if>>
 		<</if>>
-		<<if $slaves[$i].prestigeDesc == "$He is remembered for winning best in show as a breeder." && $slaves[$i].bellyPreg >= 1500>>
-			<<setLocalPronouns $slaves[$i] 2>>
-			$He spends extra time with $slaves[$i].slaveName, the well-known breeder. $Milkmaid.slaveName is fascinated by _his2 growing pregnancy and popular womb. $He makes sure _his2 belly and its occupants are nice and comfortable.
-			<<set $slaves[$i].devotion += 3, $slaves[$i].trust += 3>>
+		<<if _slave.prestigeDesc == "$He is remembered for winning best in show as a breeder." && _slave.bellyPreg >= 1500>>
+			<<setLocalPronouns _slave 2>>
+			$He spends extra time with _slave.slaveName, the well-known breeder. $Milkmaid.slaveName is fascinated by _his2 growing pregnancy and popular womb. $He makes sure _his2 belly and its occupants are nice and comfortable.
+			<<set _slave.devotion += 3, _slave.trust += 3>>
 		<</if>>
 	<</for>>
 <</if>>
@@ -313,69 +312,69 @@
 <</if>>
 
 <<set _oldCash = $cash>>
-<<for _dI = 0; _dI < _DL; _dI++>>
-	<<set $i = $slaveIndices[$DairyiIDs[_dI]]>>
-	<<setLocalPronouns $slaves[$i]>>
+<<for _slave range _slaves>>
+	<<set $i = $slaveIndices[_slave.ID]>>
+	<<setLocalPronouns _slave>>
 	/* Special attention section */
-	<<if ($legendaryCowID == 0) && ($slaves[$i].lactation > 0) && (($slaves[$i].boobs-$slaves[$i].boobsImplant-$slaves[$i].boobsMilk) > 6000) && ($slaves[$i].devotion > 50) && ($slaves[$i].prestige == 0)>>
-		<<set $legendaryCowID = $slaves[$i].ID>>
+	<<if ($legendaryCowID == 0) && (_slave.lactation > 0) && ((_slave.boobs-_slave.boobsImplant-_slave.boobsMilk) > 6000) && (_slave.devotion > 50) && (_slave.prestige == 0)>>
+		<<set $legendaryCowID = _slave.ID>>
 	<</if>>
-	<<if ($legendaryBallsID == 0) && ($slaves[$i].dick != 0) && ($slaves[$i].balls > 5 || ($slaves[$i].balls > 4 && $slaves[$i].prostate > 1)) && ($slaves[$i].devotion > 50) && ($slaves[$i].prestige == 0)>>
-		<<set $legendaryBallsID = $slaves[$i].ID>>
+	<<if ($legendaryBallsID == 0) && (_slave.dick != 0) && (_slave.balls > 5 || (_slave.balls > 4 && _slave.prostate > 1)) && (_slave.devotion > 50) && (_slave.prestige == 0)>>
+		<<set $legendaryBallsID = _slave.ID>>
 	<</if>>
 
 	/* Perform facility based rule changes */
 	<<if ($dairySlimMaintain == 0)>>
 		<<if $dairyWeightSetting == 0>>
-			<<if $slaves[$i].weight <= 30>>
-				<<set $slaves[$i].diet = "fattening">>
+			<<if _slave.weight <= 30>>
+				<<set _slave.diet = "fattening">>
 			<<else>>
-				<<set $slaves[$i].diet = "healthy">>
+				<<set _slave.diet = "healthy">>
 			<</if>>
 		<<elseif $dairyWeightSetting == 1>>
-			<<if $slaves[$i].weight <= 95>>
-				<<set $slaves[$i].diet = "fattening">>
+			<<if _slave.weight <= 95>>
+				<<set _slave.diet = "fattening">>
 			<<else>>
-				<<set $slaves[$i].diet = "healthy">>
+				<<set _slave.diet = "healthy">>
 			<</if>>
 		<<elseif $dairyWeightSetting == 2>>
-			<<if $slaves[$i].weight <= 130>>
-				<<set $slaves[$i].diet = "fattening">>
+			<<if _slave.weight <= 130>>
+				<<set _slave.diet = "fattening">>
 			<<else>>
-				<<set $slaves[$i].diet = "healthy">>
+				<<set _slave.diet = "healthy">>
 			<</if>>
 		<<elseif $dairyWeightSetting == 3>>
-			<<if $slaves[$i].weight <= 160>>
-				<<set $slaves[$i].diet = "fattening">>
+			<<if _slave.weight <= 160>>
+				<<set _slave.diet = "fattening">>
 			<<else>>
-				<<set $slaves[$i].diet = "healthy">>
+				<<set _slave.diet = "healthy">>
 			<</if>>
 		<<elseif $dairyWeightSetting == 4>>
-			<<if $slaves[$i].weight <= 195>>
-				<<set $slaves[$i].diet = "fattening">>
+			<<if _slave.weight <= 195>>
+				<<set _slave.diet = "fattening">>
 			<<else>>
-				<<set $slaves[$i].diet = "healthy">>
+				<<set _slave.diet = "healthy">>
 			<</if>>
 		<<elseif $dairyRestraintsSetting > 1>>
-			<<set $slaves[$i].diet = "healthy">>
+			<<set _slave.diet = "healthy">>
 		<</if>>
-	<<elseif $slaves[$i].weight > 10>>
-		<<set $slaves[$i].diet = "restricted">>
-	<<elseif ($slaves[$i].diet == "fattening") || $slaves[$i].diet == "healthy" || ($dairyRestraintsSetting > 1)>>
-		<<set $slaves[$i].diet = "healthy">>
+	<<elseif _slave.weight > 10>>
+		<<set _slave.diet = "restricted">>
+	<<elseif (_slave.diet == "fattening") || _slave.diet == "healthy" || ($dairyRestraintsSetting > 1)>>
+		<<set _slave.diet = "healthy">>
 	<</if>>
 	<<if $dairyRestraintsSetting > 1>>
-		<<set $slaves[$i].collar = "none", $slaves[$i].faceAccessory  = "none", $slaves[$i].mouthAccessory = "none", $slaves[$i].choosesOwnClothes = 0, $slaves[$i].clothes = "no clothing", $slaves[$i].vaginalAccessory = "none", $slaves[$i].vaginalAttachment = "none", $slaves[$i].dickAccessory = "none", $slaves[$i].buttplug = "none", $slaves[$i].chastityAnus = 0, $slaves[$i].chastityPenis = 0, $slaves[$i].chastityVagina = 0>>
+		<<set _slave.collar = "none", _slave.faceAccessory  = "none", _slave.mouthAccessory = "none", _slave.choosesOwnClothes = 0, _slave.clothes = "no clothing", _slave.vaginalAccessory = "none", _slave.vaginalAttachment = "none", _slave.dickAccessory = "none", _slave.buttplug = "none", _slave.chastityAnus = 0, _slave.chastityPenis = 0, _slave.chastityVagina = 0>>
 	<</if>>
 	<<switch $dairyDecoration>>
 	<<case "Arabian Revivalist" "Aztec Revivalist" "Chattel Religionist" "Chinese Revivalist" "Degradationist" "Edo Revivalist" "Egyptian Revivalist" "Roman Revivalist" "Subjugationist" "Supremacist">>
-		<<set $slaves[$i].rules.living = "spare">>
+		<<set _slave.rules.living = "spare">>
 	<<default>>
-		<<set $slaves[$i].rules.living = "normal">>
+		<<set _slave.rules.living = "normal">>
 	<</switch>>
 	<<if $dairyPregSetting > 0>>
-		<<set WombCleanGenericReserve($slaves[$i], "incubator", 9999)>>
-		<<set WombCleanGenericReserve($slaves[$i], "nursery", 9999)>>
+		<<set WombCleanGenericReserve(_slave, "incubator", 9999)>>
+		<<set WombCleanGenericReserve(_slave, "nursery", 9999)>>
 	<</if>>
 
 	/* General End of Week effects */
@@ -384,33 +383,33 @@
 		/* 000-250-006 */
 		<<if $seeImages && $seeReportImages>>
 			<div class="imageRef tinyImg">
-				<<= SlaveArt($slaves[$i], 0, 0)>>
+				<<= SlaveArt(_slave, 0, 0)>>
 			</div>
 		<</if>>
 		/* 000-250-006 */
-		<span class='slave-name'><<= SlaveFullName($slaves[$i])>></span>
-		<<if $slaves[$i].choosesOwnAssignment == 2>>
+		<span class='slave-name'><<= SlaveFullName(_slave)>></span>
+		<<if _slave.choosesOwnAssignment == 2>>
 			<<include "SA chooses own job">>
 		<<else>>
 			is serving as a cow in $dairyName.
 		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.getMilked($slaves[$i])>>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.getMilked(_slave)>>
 		<br>&nbsp;&nbsp;&nbsp;
 		<<include "SA rules">>
 		<<include "SA diet">>
 		<<include "SA long term effects">>
-		<<= App.SlaveAssignment.drugs($slaves[$i])>>
+		<<= App.SlaveAssignment.drugs(_slave)>>
 		<<include "SA relationships">>
 		<<include "SA rivalries">>
 		<br><<include "SA devotion">>
 	<<else>>
 		<<silently>>
 		<<include "SA chooses own job">>
-		<<run App.SlaveAssignment.getMilked($slaves[$i])>>
+		<<run App.SlaveAssignment.getMilked(_slave)>>
 		<<include "SA rules">>
 		<<include "SA diet">>
 		<<include "SA long term effects">>
-		<<run App.SlaveAssignment.drugs($slaves[$i])>>
+		<<run App.SlaveAssignment.drugs(_slave)>>
 		<<include "SA relationships">>
 		<<include "SA rivalries">>
 		<<include "SA devotion">>
@@ -419,190 +418,190 @@
 	<<set _milkWeek += $milk, _cumWeek += $cum>>
 
 	/* Facility Specific End of Week effects */
-	<<if ($slaves[$i].devotion <= 20) && ($slaves[$i].trust >= -20)>>
-		<<set $slaves[$i].devotion -= 5, $slaves[$i].trust -= 5>>
+	<<if (_slave.devotion <= 20) && (_slave.trust >= -20)>>
+		<<set _slave.devotion -= 5, _slave.trust -= 5>>
 	<</if>>
-	<<if ($slaves[$i].health.condition < -80)>>
-		<<run improveCondition($slaves[$i], 20)>>
-	<<elseif ($slaves[$i].health.condition < -40)>>
-		<<run improveCondition($slaves[$i], 10)>>
-	<<elseif ($slaves[$i].health.condition < 0)>>
-		<<run improveCondition($slaves[$i], 7)>>
-	<<elseif ($slaves[$i].health.condition < 90)>>
-		<<run improveCondition($slaves[$i], 3)>>
+	<<if (_slave.health.condition < -80)>>
+		<<run improveCondition(_slave, 20)>>
+	<<elseif (_slave.health.condition < -40)>>
+		<<run improveCondition(_slave, 10)>>
+	<<elseif (_slave.health.condition < 0)>>
+		<<run improveCondition(_slave, 7)>>
+	<<elseif (_slave.health.condition < 90)>>
+		<<run improveCondition(_slave, 3)>>
 	<</if>>
-	<<if ($slaves[$i].inflation > 0)>>
-		<<set $slaves[$i].inflation = 0, $slaves[$i].inflationType = "none", $slaves[$i].inflationMethod = 0, $slaves[$i].milkSource = 0>>
-		<<run SetBellySize($slaves[$i])>>
+	<<if (_slave.inflation > 0)>>
+		<<set _slave.inflation = 0, _slave.inflationType = "none", _slave.inflationMethod = 0, _slave.milkSource = 0>>
+		<<run SetBellySize(_slave)>>
 	<</if>>
-	<<set _gigantomastiaMod = $slaves[$i].geneticQuirks.gigantomastia == 2 ? ($slaves[$i].geneticQuirks.macromastia == 2 ? 3 : 2) : 1>>
-	<<if ($slaves[$i].lactation > 0) && (($dairySlimMaintain == 0) || ($slaves[$i].boobs > 700))>>
-		<<if ($slaves[$i].boobs < 2000)>>
+	<<set _gigantomastiaMod = _slave.geneticQuirks.gigantomastia == 2 ? (_slave.geneticQuirks.macromastia == 2 ? 3 : 2) : 1>>
+	<<if (_slave.lactation > 0) && (($dairySlimMaintain == 0) || (_slave.boobs > 700))>>
+		<<if (_slave.boobs < 2000)>>
 			<<set _growth = 100>>
-		<<elseif ($slaves[$i].boobs < 5000*_gigantomastiaMod)>>
+		<<elseif (_slave.boobs < 5000*_gigantomastiaMod)>>
 			<<set _growth = 50>>
-		<<elseif ($slaves[$i].boobs < 10000*_gigantomastiaMod)>>
+		<<elseif (_slave.boobs < 10000*_gigantomastiaMod)>>
 			<<set _growth = 25>>
 		<<else>>
 			<<set _growth = 0>>
 		<</if>>
-		<<if ($slaves[$i].geneMods.NCS == 1)>>
+		<<if (_slave.geneMods.NCS == 1)>>
 			<<set _growth = Math.trunc(_growth/2)>>
 		<</if>>
-		<<set $slaves[$i].boobs += _growth>>
+		<<set _slave.boobs += _growth>>
 	<</if>>
-	<<if $slaves[$i].prostate == 1>>
-		<<set $slaves[$i].prostate = 2>>
-		<<run cashX(forceNeg($surgeryCost), "slaveSurgery", $slaves[$i]), surgeryDamage($slaves[$i], 10)>>
+	<<if _slave.prostate == 1>>
+		<<set _slave.prostate = 2>>
+		<<run cashX(forceNeg($surgeryCost), "slaveSurgery", _slave), surgeryDamage(_slave, 10)>>
 	<</if>>
-	<<if $slaves[$i].vasectomy == 1>>
-		<<set $slaves[$i].vasectomy = 0>>
-		<<run cashX(forceNeg($surgeryCost), "slaveSurgery", $slaves[$i]), surgeryDamage($slaves[$i], 10)>>
+	<<if _slave.vasectomy == 1>>
+		<<set _slave.vasectomy = 0>>
+		<<run cashX(forceNeg($surgeryCost), "slaveSurgery", _slave), surgeryDamage(_slave, 10)>>
 	<</if>>
 	<<if ($dairySlimMaintain == 0)>>
 		<<if $dairyImplantsSetting <= 1>>
-			<<if ($slaves[$i].lactation < 2) && ($slaves[$i].boobs > 300 || $slaves[$i].balls == 0 || $slaves[$i].lactation == 1 || $dairyImplantsSetting == 1)>>
-				<<set $slaves[$i].lactation = 2, $slaves[$i].lactationDuration = 2>>
-				<<run cashX(forceNeg($surgeryCost), "slaveSurgery", $slaves[$i]), surgeryDamage($slaves[$i], 10)>>
+			<<if (_slave.lactation < 2) && (_slave.boobs > 300 || _slave.balls == 0 || _slave.lactation == 1 || $dairyImplantsSetting == 1)>>
+				<<set _slave.lactation = 2, _slave.lactationDuration = 2>>
+				<<run cashX(forceNeg($surgeryCost), "slaveSurgery", _slave), surgeryDamage(_slave, 10)>>
 			<</if>>
 		<<elseif $dairyImplantsSetting == 3>>
-			<<if ($slaves[$i].lactation < 1) && ($slaves[$i].boobs > 300 || $slaves[$i].balls == 0)>>
-				<<set $slaves[$i].induceLactation += 9>>
-				<<run induceLactation($slaves[$i])>>
+			<<if (_slave.lactation < 1) && (_slave.boobs > 300 || _slave.balls == 0)>>
+				<<set _slave.induceLactation += 9>>
+				<<run induceLactation(_slave)>>
 			<</if>>
 		<</if>>
 	<</if>>
 	<<if ($dairyFeedersUpgrade == 1) && ($dairyFeedersSetting > 0)>>
 		<<if ($dairySlimMaintain == 0)>>
-			<<if ($slaves[$i].balls == 0)>>
-				<<set $slaves[$i].hormones = 2>>
+			<<if (_slave.balls == 0)>>
+				<<set _slave.hormones = 2>>
 			<</if>>
-		<<elseif $slaves[$i].diet == "fattening">>
-			<<set $slaves[$i].weight += 2>>
-			<<if $slaves[$i].weightDirection == 1>>
-				<<set $slaves[$i].weight += 2>>
+		<<elseif _slave.diet == "fattening">>
+			<<set _slave.weight += 2>>
+			<<if _slave.weightDirection == 1>>
+				<<set _slave.weight += 2>>
 			<</if>>
 		<</if>>
-		<<if ($slaves[$i].health.condition < 75)>>
-			<<run improveCondition($slaves[$i], 25)>>
+		<<if (_slave.health.condition < 75)>>
+			<<run improveCondition(_slave, 25)>>
 		<<else>>
-			<<if ($dairySlimMaintain == 0) && $slaves[$i].lactation > 0>>
+			<<if ($dairySlimMaintain == 0) && _slave.lactation > 0>>
 				<<if $dairyFeedersSetting > 1 && $dairyStimulatorsSetting > 0>>
-					<<if $slaves[$i].boobs < 50000>>
+					<<if _slave.boobs < 50000>>
 						<<if $arcologies[0].FSAssetExpansionistResearch == 1>>
-							<<if ($slaves[$i].boobs < 2000)>>
+							<<if (_slave.boobs < 2000)>>
 								<<set _growth = 75*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50)/4))>>
-							<<elseif ($slaves[$i].boobs < 5000*_gigantomastiaMod)>>
+							<<elseif (_slave.boobs < 5000*_gigantomastiaMod)>>
 								<<set _growth = 50*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50)/4))>>
 							<<else>>
 								<<set _growth = 25*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50)/4))>>
 							<</if>>
 						<<else>>
-							<<set _growth = 25*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50-$slaves[$i].physicalAge)/4))>>
+							<<set _growth = 25*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50-_slave.physicalAge)/4))>>
 						<</if>>
-						<<if $slaves[$i].boobs <= 20000 && $slaves[$i].boobs+_growth > 20000>>
+						<<if _slave.boobs <= 20000 && _slave.boobs+_growth > 20000>>
 							<<set _boobtacular++>>
 						<</if>>
-						<<if ($slaves[$i].geneMods.NCS == 1)>>
+						<<if (_slave.geneMods.NCS == 1)>>
 							<<set _growth = Math.trunc(_growth/2)>>
 						<</if>>
-						<<set $slaves[$i].boobs += _growth>>
+						<<set _slave.boobs += _growth>>
 					<<else>>
-						/*<<set $slaves[$i].boobs = 50000>>*/
+						/*<<set _slave.boobs = 50000>>*/
 					<</if>>
 				<<elseif $dairyFeedersSetting > 0 && $dairyStimulatorsSetting > 0>>
-					<<if $slaves[$i].boobs < 25000>>
+					<<if _slave.boobs < 25000>>
 						<<if $arcologies[0].FSAssetExpansionistResearch == 1>>
-							<<if ($slaves[$i].boobs < 2000)>>
+							<<if (_slave.boobs < 2000)>>
 								<<set _growth = 75*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50)/4))>>
-							<<elseif ($slaves[$i].boobs < 5000*_gigantomastiaMod)>>
+							<<elseif (_slave.boobs < 5000*_gigantomastiaMod)>>
 								<<set _growth = 50*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50)/4))>>
 							<<else>>
 								<<set _growth = 25*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50)/4))>>
 							<</if>>
 						<<else>>
-							<<set _growth = 25*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50-$slaves[$i].physicalAge)/4))>>
+							<<set _growth = 25*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50-_slave.physicalAge)/4))>>
 						<</if>>
-						<<if $slaves[$i].boobs <= 20000 && $slaves[$i].boobs+_growth > 20000>>
+						<<if _slave.boobs <= 20000 && _slave.boobs+_growth > 20000>>
 							<<set _boobtacular++>>
 						<</if>>
-						<<if ($slaves[$i].geneMods.NCS == 1)>>
+						<<if (_slave.geneMods.NCS == 1)>>
 							<<set _growth = Math.trunc(_growth/2)>>
 						<</if>>
-						<<set $slaves[$i].boobs += _growth>>
+						<<set _slave.boobs += _growth>>
 					<</if>>
 				<<elseif $dairyFeedersSetting > 1>>
-					<<if $slaves[$i].boobs < 10000>>
+					<<if _slave.boobs < 10000>>
 						<<if $arcologies[0].FSAssetExpansionistResearch == 1>>
-							<<if ($slaves[$i].boobs < 2000)>>
+							<<if (_slave.boobs < 2000)>>
 								<<set _growth = 75*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50)/4))>>
-							<<elseif ($slaves[$i].boobs < 5000*_gigantomastiaMod)>>
+							<<elseif (_slave.boobs < 5000*_gigantomastiaMod)>>
 								<<set _growth = 50*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50)/4))>>
 							<<else>>
 								<<set _growth = 25*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50)/4))>>
 							<</if>>
 						<<else>>
-							<<set _growth = 25*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50-$slaves[$i].physicalAge)/4))>>
+							<<set _growth = 25*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50-_slave.physicalAge)/4))>>
 						<</if>>
-						<<if $slaves[$i].boobs <= 20000 && $slaves[$i].boobs+_growth > 20000>>
+						<<if _slave.boobs <= 20000 && _slave.boobs+_growth > 20000>>
 							<<set _boobtacular++>>
 						<</if>>
-						<<if ($slaves[$i].geneMods.NCS == 1)>>
+						<<if (_slave.geneMods.NCS == 1)>>
 							<<set _growth = Math.trunc(_growth/2)>>
 						<</if>>
-						<<set $slaves[$i].boobs += _growth>>
+						<<set _slave.boobs += _growth>>
 					<</if>>
 				<<else>>
-					<<if $slaves[$i].boobs < 5000>>
+					<<if _slave.boobs < 5000>>
 						<<if $arcologies[0].FSAssetExpansionistResearch == 1>>
-							<<if ($slaves[$i].boobs < 2000)>>
+							<<if (_slave.boobs < 2000)>>
 								<<set _growth = 75*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50)/4))>>
-							<<elseif ($slaves[$i].boobs < 5000*_gigantomastiaMod)>>
+							<<elseif (_slave.boobs < 5000*_gigantomastiaMod)>>
 								<<set _growth = 50*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50)/4))>>
 							<<else>>
 								<<set _growth = 25*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50)/4))>>
 							<</if>>
 						<<else>>
-							<<set _growth = 25*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50-$slaves[$i].physicalAge)/4))>>
+							<<set _growth = 25*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50-_slave.physicalAge)/4))>>
 						<</if>>
-						<<if $slaves[$i].boobs <= 20000 && $slaves[$i].boobs+_growth > 20000>>
+						<<if _slave.boobs <= 20000 && _slave.boobs+_growth > 20000>>
 							<<set _boobtacular++>>
 						<</if>>
-						<<if ($slaves[$i].geneMods.NCS == 1)>>
+						<<if (_slave.geneMods.NCS == 1)>>
 							<<set _growth = Math.trunc(_growth/2)>>
 						<</if>>
-						<<set $slaves[$i].boobs += _growth>>
+						<<set _slave.boobs += _growth>>
 					<</if>>
 				<</if>>
 			<</if>>
-			<<if ($slaves[$i].balls > 0)>>
+			<<if (_slave.balls > 0)>>
 				<<if $arcologies[0].FSAssetExpansionistResearch == 1>>
-					<<if ($slaves[$i].geneMods.NCS == 0) && ($slaves[$i].balls < 125)>>
-						<<set $slaves[$i].balls++>>
-					<<elseif ($slaves[$i].geneMods.NCS == 1) && ($slaves[$i].balls < 125) && (random(1,600) > (30+(10*$slaves[$i].balls)-(10*$dairyRestraintsSetting)-($injectionUpgrade*10)))>>
-						<<set $slaves[$i].balls++>>
+					<<if (_slave.geneMods.NCS == 0) && (_slave.balls < 125)>>
+						<<set _slave.balls++>>
+					<<elseif (_slave.geneMods.NCS == 1) && (_slave.balls < 125) && (random(1,600) > (30+(10*_slave.balls)-(10*$dairyRestraintsSetting)-($injectionUpgrade*10)))>>
+						<<set _slave.balls++>>
 					<</if>>
-					<<if ($slaves[$i].balls >= 125)>>
+					<<if (_slave.balls >= 125)>>
 						<<set _balltacular++>>
-						<<set _btSlave = $slaves[$i]>>
+						<<set _btSlave = _slave>>
 					<</if>>
-				<<elseif ($slaves[$i].balls < 10)>>
-					<<if ($slaves[$i].geneMods.NCS == 0) && (random(1,100) > (40+(10*$slaves[$i].balls)-(10*$dairyRestraintsSetting)-($injectionUpgrade*10)))>>
-						<<set $slaves[$i].balls++>>
-					<<elseif ($slaves[$i].geneMods.NCS == 1) && ($slaves[$i].balls < 125) && (random(1,50) > (40+(10*$slaves[$i].balls)-(10*$dairyRestraintsSetting)-($injectionUpgrade*10)))>>
-						<<set $slaves[$i].balls++>>
+				<<elseif (_slave.balls < 10)>>
+					<<if (_slave.geneMods.NCS == 0) && (random(1,100) > (40+(10*_slave.balls)-(10*$dairyRestraintsSetting)-($injectionUpgrade*10)))>>
+						<<set _slave.balls++>>
+					<<elseif (_slave.geneMods.NCS == 1) && (_slave.balls < 125) && (random(1,50) > (40+(10*_slave.balls)-(10*$dairyRestraintsSetting)-($injectionUpgrade*10)))>>
+						<<set _slave.balls++>>
 					<</if>>
-					<<if ($slaves[$i].balls >= 10)>>
+					<<if (_slave.balls >= 10)>>
 						<<set _balltacular++>>
-						<<set _btSlave = $slaves[$i]>>
+						<<set _btSlave = _slave>>
 					<</if>>
 				<</if>>
-				<<if $slaves[$i].dick > 0>>
-					<<if $slaves[$i].dick < 10>>
-						<<if (($slaves[$i].geneMods.NCS == 0) && (random(1,100) > (40+(10*$slaves[$i].dick)-(10*$dairyRestraintsSetting)-($injectionUpgrade*10))))>>
-							<<set $slaves[$i].dick++>>
-						<<elseif (($slaves[$i].geneMods.NCS == 1) && (random(1,50) > (40+(10*$slaves[$i].dick)-(10*$dairyRestraintsSetting)-($injectionUpgrade*10))))>>
-							<<set $slaves[$i].dick++>>
+				<<if _slave.dick > 0>>
+					<<if _slave.dick < 10>>
+						<<if ((_slave.geneMods.NCS == 0) && (random(1,100) > (40+(10*_slave.dick)-(10*$dairyRestraintsSetting)-($injectionUpgrade*10))))>>
+							<<set _slave.dick++>>
+						<<elseif ((_slave.geneMods.NCS == 1) && (random(1,50) > (40+(10*_slave.dick)-(10*$dairyRestraintsSetting)-($injectionUpgrade*10))))>>
+							<<set _slave.dick++>>
 						<</if>>
 					<</if>>
 				<</if>>
@@ -610,112 +609,112 @@
 		<</if>>
 	<</if>> /* closes ($dairyFeedersUpgrade == 1) && ($dairyFeedersSetting > 0) */
 	<<if ($dairyStimulatorsUpgrade == 1) && $dairyStimulatorsSetting > 0>>
-		<<if ($dairyStimulatorsSetting > 1) && ($slaves[$i].anus < 4)>>
-			<<set $slaves[$i].anus++>>
-			<<if ($slaves[$i].anus >= 4)>>
+		<<if ($dairyStimulatorsSetting > 1) && (_slave.anus < 4)>>
+			<<set _slave.anus++>>
+			<<if (_slave.anus >= 4)>>
 				<<set _anusesStretched++>>
 			<</if>>
-		<<elseif ($slaves[$i].anus < 3)>>
-			<<set $slaves[$i].anus++>>
+		<<elseif (_slave.anus < 3)>>
+			<<set _slave.anus++>>
 		<</if>>
-		<<if ($slaves[$i].health.condition < 60)>>
-			<<run improveCondition($slaves[$i], 20)>>
-		<<elseif $dairySlimMaintain == 0 && $slaves[$i].lactation > 0>>
+		<<if (_slave.health.condition < 60)>>
+			<<run improveCondition(_slave, 20)>>
+		<<elseif $dairySlimMaintain == 0 && _slave.lactation > 0>>
 			<<if $dairyFeedersSetting > 1>>
-				<<if $slaves[$i].boobs < 50000>>
+				<<if _slave.boobs < 50000>>
 					<<if $arcologies[0].FSAssetExpansionistResearch == 1>>
-						<<if ($slaves[$i].boobs < 2000)>>
+						<<if (_slave.boobs < 2000)>>
 							<<set _growth = 75*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50)/4))>>
-						<<elseif ($slaves[$i].boobs < 5000*_gigantomastiaMod)>>
+						<<elseif (_slave.boobs < 5000*_gigantomastiaMod)>>
 							<<set _growth = 50*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50)/4))>>
 						<<else>>
 							<<set _growth = 25*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50)/4))>>
 						<</if>>
 					<<else>>
-						<<set _growth = 25*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50-$slaves[$i].physicalAge)/4))>>
+						<<set _growth = 25*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50-_slave.physicalAge)/4))>>
 					<</if>>
-					<<if $slaves[$i].boobs <= 20000 && $slaves[$i].boobs+_growth > 20000>>
+					<<if _slave.boobs <= 20000 && _slave.boobs+_growth > 20000>>
 						<<set _boobtacular++>>
 					<</if>>
-					<<if ($slaves[$i].geneMods.NCS == 1)>>
+					<<if (_slave.geneMods.NCS == 1)>>
 						<<set _growth = Math.trunc(_growth/2)>>
 					<</if>>
-					<<set $slaves[$i].boobs += _growth>>
+					<<set _slave.boobs += _growth>>
 				<</if>>
 			<<elseif $dairyFeedersSetting > 0>>
-				<<if $slaves[$i].boobs < 25000>>
+				<<if _slave.boobs < 25000>>
 					<<if $arcologies[0].FSAssetExpansionistResearch == 1>>
-						<<if ($slaves[$i].boobs < 2000)>>
+						<<if (_slave.boobs < 2000)>>
 							<<set _growth = 75*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50)/4))>>
-						<<elseif ($slaves[$i].boobs < 5000*_gigantomastiaMod)>>
+						<<elseif (_slave.boobs < 5000*_gigantomastiaMod)>>
 							<<set _growth = 50*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50)/4))>>
 						<<else>>
 							<<set _growth = 25*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50)/4))>>
 						<</if>>
 					<<else>>
-						<<set _growth = 25*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50-$slaves[$i].physicalAge)/4))>>
+						<<set _growth = 25*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50-_slave.physicalAge)/4))>>
 					<</if>>
-					<<if $slaves[$i].boobs <= 20000 && $slaves[$i].boobs+_growth > 20000>>
+					<<if _slave.boobs <= 20000 && _slave.boobs+_growth > 20000>>
 						<<set _boobtacular++>>
 					<</if>>
-					<<if ($slaves[$i].geneMods.NCS == 1)>>
+					<<if (_slave.geneMods.NCS == 1)>>
 						<<set _growth = Math.trunc(_growth/2)>>
 					<</if>>
-					<<set $slaves[$i].boobs += _growth>>
+					<<set _slave.boobs += _growth>>
 				<</if>>
 			<<else>>
-				<<if $slaves[$i].boobs < 10000>>
+				<<if _slave.boobs < 10000>>
 					<<if $arcologies[0].FSAssetExpansionistResearch == 1>>
-						<<if ($slaves[$i].boobs < 2000)>>
+						<<if (_slave.boobs < 2000)>>
 							<<set _growth = 75*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50)/4))>>
-						<<elseif ($slaves[$i].boobs < 5000*_gigantomastiaMod)>>
+						<<elseif (_slave.boobs < 5000*_gigantomastiaMod)>>
 							<<set _growth = 50*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50)/4))>>
 						<<else>>
 							<<set _growth = 25*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50)/4))>>
 						<</if>>
 					<<else>>
-						<<set _growth = 25*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50-$slaves[$i].physicalAge)/4))>>
+						<<set _growth = 25*Math.trunc(($injectionUpgrade*2)+$dairyFeedersSetting+$dairyRestraintsSetting+((50-_slave.physicalAge)/4))>>
 					<</if>>
-					<<if $slaves[$i].boobs <= 20000 && $slaves[$i].boobs+_growth > 20000>>
+					<<if _slave.boobs <= 20000 && _slave.boobs+_growth > 20000>>
 						<<set _boobtacular++>>
 					<</if>>
-					<<if ($slaves[$i].geneMods.NCS == 1)>>
+					<<if (_slave.geneMods.NCS == 1)>>
 						<<set _growth = Math.trunc(_growth/2)>>
 					<</if>>
-					<<set $slaves[$i].boobs += _growth>>
+					<<set _slave.boobs += _growth>>
 				<</if>>
 			<</if>>
 		<</if>>
 	<</if>>
 	<<if ($dairyRestraintsSetting > 1)>>
-		<<if $slaves[$i].lactation > 0>>
-			<<set $slaves[$i].lactationAdaptation += 1>>
+		<<if _slave.lactation > 0>>
+			<<set _slave.lactationAdaptation += 1>>
 		<</if>>
-		<<if ($slaves[$i].muscles > -100)>>
-			<<set $slaves[$i].muscles -= 1+$slaves[$i].geneticQuirks.mLoss>>
+		<<if (_slave.muscles > -100)>>
+			<<set _slave.muscles -= 1+_slave.geneticQuirks.mLoss>>
 		<</if>>
-		<<if ($slaves[$i].fetish == "mindbroken")>>
-			<<if ($slaves[$i].boobs > 48000) && (($slaves[$i].balls >= 10) || ($slaves[$i].balls == 0))>>
-				<<set $bioreactorPerfectedID = $slaves[$i].ID>>
+		<<if (_slave.fetish == "mindbroken")>>
+			<<if (_slave.boobs > 48000) && ((_slave.balls >= 10) || (_slave.balls == 0))>>
+				<<set $bioreactorPerfectedID = _slave.ID>>
 			<</if>>
 		<<else>>
-			<<if ($slaves[$i].sexualFlaw != "self hating")>>
-				<<if ($slaves[$i].sexualFlaw != "cum addict") || ($dairyFeedersSetting == 0)>>
-					<<if ($slaves[$i].sexualFlaw != "anal addict") || ($dairyStimulatorsSetting == 0)>>
-						<<if ($slaves[$i].sexualFlaw != "breeder") || ($slaves[$i].preg < 0) || ($dairyPregSetting == 0)>>
+			<<if (_slave.sexualFlaw != "self hating")>>
+				<<if (_slave.sexualFlaw != "cum addict") || ($dairyFeedersSetting == 0)>>
+					<<if (_slave.sexualFlaw != "anal addict") || ($dairyStimulatorsSetting == 0)>>
+						<<if (_slave.sexualFlaw != "breeder") || (_slave.preg < 0) || ($dairyPregSetting == 0)>>
 							<<if $dairyStimulatorsSetting > 1>>
-								<<if ($slaves[$i].sexualFlaw != "hates anal") && ($slaves[$i].sexualQuirk != "painal queen")>>
-									<<set $slaves[$i].sexualFlaw = "hates anal">>
+								<<if (_slave.sexualFlaw != "hates anal") && (_slave.sexualQuirk != "painal queen")>>
+									<<set _slave.sexualFlaw = "hates anal">>
 								<</if>>
 							<</if>>
 							<<if $dairyPregSetting > 1>>
-								<<if ($slaves[$i].sexualFlaw != "hates penetration") && ($slaves[$i].sexualQuirk != "strugglefuck queen")>>
-									<<set $slaves[$i].sexualFlaw = "hates penetration">>
+								<<if (_slave.sexualFlaw != "hates penetration") && (_slave.sexualQuirk != "strugglefuck queen")>>
+									<<set _slave.sexualFlaw = "hates penetration">>
 								<</if>>
 							<</if>>
 							<<if $dairyFeedersSetting > 1>>
-								<<if ($slaves[$i].sexualFlaw != "hates oral") && ($slaves[$i].sexualQuirk != "gagfuck queen")>>
-									<<set $slaves[$i].sexualFlaw = "hates oral">>
+								<<if (_slave.sexualFlaw != "hates oral") && (_slave.sexualQuirk != "gagfuck queen")>>
+									<<set _slave.sexualFlaw = "hates oral">>
 								<</if>>
 							<</if>>
 						<</if>>
@@ -723,173 +722,173 @@
 				<</if>>
 			<</if>>
 		<</if>>
-		<<if $slaves[$i].chem > 250>>
+		<<if _slave.chem > 250>>
 			<<set _chemSevere++>>
-		<<elseif $slaves[$i].chem > 100>>
+		<<elseif _slave.chem > 100>>
 			<<set _chemMinor++>>
-			<<set _cmSlave = $slaves[$i]>>
+			<<set _cmSlave = _slave>>
 		<</if>>
 	<</if>>
 	<<if ($dairyStimulatorsSetting + $dairyFeedersSetting + $dairyPregSetting) > 5>>
-		<<if $slaves[$i].devotion <= 95 && $slaves[$i].sexualFlaw != "self hating">>
-			<<if ($slaves[$i].sexualFlaw != "breeder") || ($slaves[$i].preg < 0)>>
-				<<if ($slaves[$i].devotion > -75)>>
-					<<set $slaves[$i].devotion -= 10>>
-					<<if ($slaves[$i].devotion < -65)>>
+		<<if _slave.devotion <= 95 && _slave.sexualFlaw != "self hating">>
+			<<if (_slave.sexualFlaw != "breeder") || (_slave.preg < 0)>>
+				<<if (_slave.devotion > -75)>>
+					<<set _slave.devotion -= 10>>
+					<<if (_slave.devotion < -65)>>
 						<<set _hatefilled++>>
-						<<set _hfSlave = $slaves[$i]>>
+						<<set _hfSlave = _slave>>
 					<</if>>
-				<<elseif ($slaves[$i].trust > -75)>>
-					<<set $slaves[$i].trust -= 10>>
-					<<if ($slaves[$i].trust < -65)>>
+				<<elseif (_slave.trust > -75)>>
+					<<set _slave.trust -= 10>>
+					<<if (_slave.trust < -65)>>
 						<<set _horrified++>>
-						<<set _hrSlave = $slaves[$i]>>
+						<<set _hrSlave = _slave>>
 					<</if>>
-				<<elseif ($slaves[$i].skill.vaginal > 0)>>
-					<<set $slaves[$i].skill.vaginal -= 10, _skillsLost++>>
-					<<set _slSlave = $slaves[$i]>>
-				<<elseif ($slaves[$i].skill.oral > 0)>>
-					<<set $slaves[$i].skill.oral -= 10, _skillsLost++>>
-					<<set _slSlave = $slaves[$i]>>
-				<<elseif ($slaves[$i].skill.anal > 0)>>
-					<<set $slaves[$i].skill.anal -= 10, _skillsLost++>>
-					<<set _slSlave = $slaves[$i]>>
-				<<elseif ($slaves[$i].career != "a bioreactor")>>
-					<<set $slaves[$i].career = "a bioreactor", _careerForgotten++>>
-					<<set _cfSlave = $slaves[$i]>>
-				<<elseif ($slaves[$i].intelligenceImplant > 0)>>
-					<<set $slaves[$i].intelligenceImplant = Math.clamp($slaves[$i].intelligenceImplant-5, 0, 30), _skillsLost++>>
-					<<set _slSlave = $slaves[$i]>>
-				<<elseif ($slaves[$i].intelligence >= -15)>>
-					<<set $slaves[$i].intelligence -= 5, _intelligenceLost++>>
-				<<elseif ($slaves[$i].devotion >= -20)>>
-					<<set $slaves[$i].devotion -= 10>>
-				<<elseif ($slaves[$i].trust >= -20)>>
-					<<set $slaves[$i].trust -= 10>>
-				<<elseif ($slaves[$i].skill.whoring > 0)>>
-					<<set $slaves[$i].skill.whoring -= 10, _skillsLost++>>
-					<<set _slSlave = $slaves[$i]>>
-				<<elseif ($slaves[$i].skill.entertainment > 0)>>
-					<<set $slaves[$i].skill.entertainment -= 10, _skillsLost++>>
-					<<set _slSlave = $slaves[$i]>>
-				<<elseif ($slaves[$i].intelligence >= -50)>>
-					<<set $slaves[$i].intelligence -= 5>>
-					<<if $slaves[$i].intelligence < -50>>
+				<<elseif (_slave.skill.vaginal > 0)>>
+					<<set _slave.skill.vaginal -= 10, _skillsLost++>>
+					<<set _slSlave = _slave>>
+				<<elseif (_slave.skill.oral > 0)>>
+					<<set _slave.skill.oral -= 10, _skillsLost++>>
+					<<set _slSlave = _slave>>
+				<<elseif (_slave.skill.anal > 0)>>
+					<<set _slave.skill.anal -= 10, _skillsLost++>>
+					<<set _slSlave = _slave>>
+				<<elseif (_slave.career != "a bioreactor")>>
+					<<set _slave.career = "a bioreactor", _careerForgotten++>>
+					<<set _cfSlave = _slave>>
+				<<elseif (_slave.intelligenceImplant > 0)>>
+					<<set _slave.intelligenceImplant = Math.clamp(_slave.intelligenceImplant-5, 0, 30), _skillsLost++>>
+					<<set _slSlave = _slave>>
+				<<elseif (_slave.intelligence >= -15)>>
+					<<set _slave.intelligence -= 5, _intelligenceLost++>>
+				<<elseif (_slave.devotion >= -20)>>
+					<<set _slave.devotion -= 10>>
+				<<elseif (_slave.trust >= -20)>>
+					<<set _slave.trust -= 10>>
+				<<elseif (_slave.skill.whoring > 0)>>
+					<<set _slave.skill.whoring -= 10, _skillsLost++>>
+					<<set _slSlave = _slave>>
+				<<elseif (_slave.skill.entertainment > 0)>>
+					<<set _slave.skill.entertainment -= 10, _skillsLost++>>
+					<<set _slSlave = _slave>>
+				<<elseif (_slave.intelligence >= -50)>>
+					<<set _slave.intelligence -= 5>>
+					<<if _slave.intelligence < -50>>
 						<<set _stupidified++>>
-						<<set _stSlave = $slaves[$i]>>
+						<<set _stSlave = _slave>>
 					<</if>>
-				<<elseif ($slaves[$i].fetish != "mindbroken")>>
-					<<set $slaves[$i].fetish = "mindbroken", _mindbroken++>>
+				<<elseif (_slave.fetish != "mindbroken")>>
+					<<set _slave.fetish = "mindbroken", _mindbroken++>>
 				<</if>>
 			<</if>>
 		<</if>>
-		<<if (($slaves[$i].counter.milk > 1000) && ($slaves[$i].boobs > 12000) || ($slaves[$i].counter.cum > 1000) && ($slaves[$i].balls >= 10)) && ($slaves[$i].career != "a bioreactor")>>
-			<<set $slaves[$i].career = "a bioreactor", _careerForgotten++>>
-			<<set _cfSlave = $slaves[$i]>>
+		<<if ((_slave.counter.milk > 1000) && (_slave.boobs > 12000) || (_slave.counter.cum > 1000) && (_slave.balls >= 10)) && (_slave.career != "a bioreactor")>>
+			<<set _slave.career = "a bioreactor", _careerForgotten++>>
+			<<set _cfSlave = _slave>>
 		<</if>>
 		<<if ($arcologies[0].FSBodyPuristLaw == 0) && ($healthyDrugsUpgrade == 0)>>
-			<<set $slaves[$i].chem += 5>>
+			<<set _slave.chem += 5>>
 		<<else>>
-			<<set $slaves[$i].chem += 2>>
+			<<set _slave.chem += 2>>
 		<</if>>
 	<<elseif ($dairyStimulatorsSetting + $dairyFeedersSetting + $dairyPregSetting) > 3>>
-		<<if ($slaves[$i].devotion < 75)>>
-			<<if ($slaves[$i].devotion > -75)>>
-				<<set $slaves[$i].devotion -= 5>>
-				<<if ($slaves[$i].devotion < -70)>>
+		<<if (_slave.devotion < 75)>>
+			<<if (_slave.devotion > -75)>>
+				<<set _slave.devotion -= 5>>
+				<<if (_slave.devotion < -70)>>
 					<<set _hatefilled++>>
-					<<set _hfSlave = $slaves[$i]>>
+					<<set _hfSlave = _slave>>
 				<</if>>
-			<<elseif ($slaves[$i].trust > -75)>>
-				<<set $slaves[$i].trust -= 5>>
-				<<if ($slaves[$i].trust < -70)>>
+			<<elseif (_slave.trust > -75)>>
+				<<set _slave.trust -= 5>>
+				<<if (_slave.trust < -70)>>
 					<<set _horrified++>>
-					<<set _hrSlave = $slaves[$i]>>
+					<<set _hrSlave = _slave>>
 				<</if>>
-			<<elseif ($slaves[$i].skill.vaginal >= 20)>>
-				<<set $slaves[$i].skill.vaginal -= 10, _skillsLost++>>
-				<<set _slSlave = $slaves[$i]>>
-			<<elseif ($slaves[$i].skill.oral >= 20)>>
-				<<set $slaves[$i].skill.oral -= 10, _skillsLost++>>
-				<<set _slSlave = $slaves[$i]>>
-			<<elseif ($slaves[$i].skill.anal >= 20)>>
-				<<set $slaves[$i].skill.anal -= 10, _skillsLost++>>
-				<<set _slSlave = $slaves[$i]>>
-			<<elseif ($slaves[$i].career != "a bioreactor")>>
-				<<set $slaves[$i].career = "a bioreactor", _careerForgotten++>>
-				<<set _cfSlave = $slaves[$i]>>
-			<<elseif ($slaves[$i].intelligenceImplant > 0)>>
-				<<set $slaves[$i].intelligenceImplant = Math.clamp($slaves[$i].intelligenceImplant-5, 0, 30), _skillsLost++>>
-				<<set _slSlave = $slaves[$i]>>
-			<<elseif ($slaves[$i].intelligence >= -15)>>
-				<<set $slaves[$i].intelligence -= 5, _intelligenceLost++>>
-			<<elseif ($slaves[$i].devotion >= -20)>>
-				<<set $slaves[$i].devotion -= 8>>
-			<<elseif ($slaves[$i].trust >= -20)>>
-				<<set $slaves[$i].trust -= 8>>
-			<<elseif ($slaves[$i].skill.whoring >= 20)>>
-				<<set $slaves[$i].skill.whoring -= 10, _skillsLost++>>
-				<<set _slSlave = $slaves[$i]>>
-			<<elseif ($slaves[$i].skill.entertainment >= 20)>>
-				<<set $slaves[$i].skill.entertainment -= 10, _skillsLost++>>
-				<<set _slSlave = $slaves[$i]>>
-			<<elseif ($slaves[$i].intelligence >= -50)>>
-				<<set $slaves[$i].intelligence -= 5>>
-				<<if $slaves[$i].intelligence < -50>>
+			<<elseif (_slave.skill.vaginal >= 20)>>
+				<<set _slave.skill.vaginal -= 10, _skillsLost++>>
+				<<set _slSlave = _slave>>
+			<<elseif (_slave.skill.oral >= 20)>>
+				<<set _slave.skill.oral -= 10, _skillsLost++>>
+				<<set _slSlave = _slave>>
+			<<elseif (_slave.skill.anal >= 20)>>
+				<<set _slave.skill.anal -= 10, _skillsLost++>>
+				<<set _slSlave = _slave>>
+			<<elseif (_slave.career != "a bioreactor")>>
+				<<set _slave.career = "a bioreactor", _careerForgotten++>>
+				<<set _cfSlave = _slave>>
+			<<elseif (_slave.intelligenceImplant > 0)>>
+				<<set _slave.intelligenceImplant = Math.clamp(_slave.intelligenceImplant-5, 0, 30), _skillsLost++>>
+				<<set _slSlave = _slave>>
+			<<elseif (_slave.intelligence >= -15)>>
+				<<set _slave.intelligence -= 5, _intelligenceLost++>>
+			<<elseif (_slave.devotion >= -20)>>
+				<<set _slave.devotion -= 8>>
+			<<elseif (_slave.trust >= -20)>>
+				<<set _slave.trust -= 8>>
+			<<elseif (_slave.skill.whoring >= 20)>>
+				<<set _slave.skill.whoring -= 10, _skillsLost++>>
+				<<set _slSlave = _slave>>
+			<<elseif (_slave.skill.entertainment >= 20)>>
+				<<set _slave.skill.entertainment -= 10, _skillsLost++>>
+				<<set _slSlave = _slave>>
+			<<elseif (_slave.intelligence >= -50)>>
+				<<set _slave.intelligence -= 5>>
+				<<if _slave.intelligence < -50>>
 					<<set _stupidified++>>
-					<<set _stSlave = $slaves[$i]>>
+					<<set _stSlave = _slave>>
 				<</if>>
-			<<elseif ($slaves[$i].fetish != "mindbroken")>>
-				<<set $slaves[$i].fetish = "mindbroken", _mindbroken++>>
+			<<elseif (_slave.fetish != "mindbroken")>>
+				<<set _slave.fetish = "mindbroken", _mindbroken++>>
 			<</if>>
-		<<elseif (($slaves[$i].counter.milk > 1000) && ($slaves[$i].boobs > 12000) || ($slaves[$i].counter.cum > 1000) && ($slaves[$i].balls >= 10)) && ($slaves[$i].career != "a bioreactor")>>
-			<<set $slaves[$i].career = "a bioreactor", _careerForgotten++>>
-			<<set _cfSlave = $slaves[$i]>>
+		<<elseif ((_slave.counter.milk > 1000) && (_slave.boobs > 12000) || (_slave.counter.cum > 1000) && (_slave.balls >= 10)) && (_slave.career != "a bioreactor")>>
+			<<set _slave.career = "a bioreactor", _careerForgotten++>>
+			<<set _cfSlave = _slave>>
 		<</if>>
 		<<if ($arcologies[0].FSBodyPuristLaw == 0) && ($healthyDrugsUpgrade == 0)>>
-			<<set $slaves[$i].chem += 2>>
+			<<set _slave.chem += 2>>
 		<<else>>
-			<<set $slaves[$i].chem++>>
+			<<set _slave.chem++>>
 		<</if>>
 	<</if>> /* closes ($dairyStimulatorsSetting + $dairyFeedersSetting + $dairyPregSetting) > 5 */
 	<<if ($dairyPregUpgrade == 1) && ($dairyPregSetting > 0)>>
-		<<if ($slaves[$i].ovaries == 1) && ($slaves[$i].vagina > -1)>>
-			<<set _femCumWeek += Math.trunc((70-$slaves[$i].physicalAge)/(30-($slaves[$i].vaginaLube*10)))>>
-			<<if ($slaves[$i].preg == -2)>>
-				<<set $slaves[$i].preg = 0, _desterilized++>>
-				<<set _dsSlave = $slaves[$i]>>
+		<<if (_slave.ovaries == 1) && (_slave.vagina > -1)>>
+			<<set _femCumWeek += Math.trunc((70-_slave.physicalAge)/(30-(_slave.vaginaLube*10)))>>
+			<<if (_slave.preg == -2)>>
+				<<set _slave.preg = 0, _desterilized++>>
+				<<set _dsSlave = _slave>>
 			<</if>>
-			<<if isFertile($slaves[$i])>>
-				<<if $slaves[$i].eggType == "human">>
-					<<set $slaves[$i].preg = 1, $slaves[$i].pregWeek = 1, $slaves[$i].pregKnown = 1>>
+			<<if isFertile(_slave)>>
+				<<if _slave.eggType == "human">>
+					<<set _slave.preg = 1, _slave.pregWeek = 1, _slave.pregKnown = 1>>
 					<<if ($dairyPregSetting > 2)>>
-						<<set $slaves[$i].pregType = random(10,29)>>
+						<<set _slave.pregType = random(10,29)>>
 					<<elseif ($dairyPregSetting > 1)>>
-						<<set $slaves[$i].pregType = random(3,6)>>
+						<<set _slave.pregType = random(3,6)>>
 					<<else>>
-						<<set $slaves[$i].pregType = either(1, 1, 1, 1, 2, 2, 2, 3, 3, 4)>>
+						<<set _slave.pregType = either(1, 1, 1, 1, 2, 2, 2, 3, 3, 4)>>
 					<</if>>
-					<<set $slaves[$i].pregSource = -2>>
-					<<set WombImpregnate($slaves[$i], $slaves[$i].pregType, -2, 1)>>
+					<<set _slave.pregSource = -2>>
+					<<set WombImpregnate(_slave, _slave.pregType, -2, 1)>>
 				<</if>> /*closes eggType */
-				<<if ($slaves[$i].vagina == 0)>>
-					<<set $slaves[$i].vagina++>>
+				<<if (_slave.vagina == 0)>>
+					<<set _slave.vagina++>>
 				<</if>>
-			<<elseif ($slaves[$i].pregKnown == 1)>>
+			<<elseif (_slave.pregKnown == 1)>>
 				<<if ($dairyPregSetting > 2)>>
-					<<run cashX(100, "slaveAssignmentDairy", $slaves[$i])>>
+					<<run cashX(100, "slaveAssignmentDairy", _slave)>>
 				<<elseif ($dairyPregSetting > 1)>>
-					<<run cashX(50, "slaveAssignmentDairy", $slaves[$i])>>
+					<<run cashX(50, "slaveAssignmentDairy", _slave)>>
 				<<else>>
-					<<run cashX(25, "slaveAssignmentDairy", $slaves[$i])>>
+					<<run cashX(25, "slaveAssignmentDairy", _slave)>>
 				<</if>>
-				<<if ($dairyPregSetting > 1) && ($slaves[$i].vagina < 4)>>
-					<<set $slaves[$i].vagina++>>
-					<<if ($slaves[$i].vagina == 4)>>
+				<<if ($dairyPregSetting > 1) && (_slave.vagina < 4)>>
+					<<set _slave.vagina++>>
+					<<if (_slave.vagina == 4)>>
 						<<set _vaginasStretched++>>
 					<</if>>
-				<<elseif ($slaves[$i].vagina < 3)>>
-					<<set $slaves[$i].vagina++>>
+				<<elseif (_slave.vagina < 3)>>
+					<<set _slave.vagina++>>
 				<</if>>
 			<</if>>
 		<</if>>
@@ -1127,28 +1126,27 @@ $dairyNameCaps produced <<print _milkWeek+_outputMilk>> liters of milk<<if _cumW
 <</if>>
 
 <<if ($createBioreactors == 1) && ($bioreactorPerfectedID != 0)>>
-	<<for _dI = 0; _dI < _DL; _dI++>>
-		<<set $i = $slaveIndices[$DairyiIDs[_dI]]>>
-		<<setLocalPronouns $slaves[$i]>>
-		<<if ($slaves[$i].ID == $bioreactorPerfectedID)>>
-			<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<<= SlaveFullName($slaves[$i])>>'s breasts<<if $slaves[$i].balls > 0>>, balls<</if>><<if $slaves[$i].ovaries == 1>>, belly<</if>>, body, and mind have been completely adapted to synthesize useful products. $He has been reclassified as part of the machine $he's now permanently attached to. This combination is projected to produce approximately
-			<<if $slaves[$i].balls > 0>><<print 1000*Math.trunc((3*52*(45-$slaves[$i].physicalAge))/1000)>> liters of cum,<</if>>
-			<<if $slaves[$i].ovaries == 1>><<print 100*Math.trunc((52*(45-$slaves[$i].physicalAge))/100)>> liters of vaginal secretions, <<if $dairyPregSetting == 3>><<print 13*(45-$slaves[$i].physicalAge)>><<else>><<print 5*(45-$slaves[$i].physicalAge)>><</if>> slaves,<</if>>
-			and <<print 1000*Math.trunc((300*52*(45-$slaves[$i].physicalAge))/1000)>> liters of milk over a <<print 45-$slaves[$i].physicalAge>> year period before its biological components must be replaced.
-			<<if ($slaves[$i].ovaries == 1)>>
-				<<if ($slaves[$i].balls == 0)>>
+	<<for _slave range _slaves>>
+		<<setLocalPronouns _slave>>
+		<<if (_slave.ID == $bioreactorPerfectedID)>>
+			<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<<= SlaveFullName(_slave)>>'s breasts<<if _slave.balls > 0>>, balls<</if>><<if _slave.ovaries == 1>>, belly<</if>>, body, and mind have been completely adapted to synthesize useful products. $He has been reclassified as part of the machine $he's now permanently attached to. This combination is projected to produce approximately
+			<<if _slave.balls > 0>><<print 1000*Math.trunc((3*52*(45-_slave.physicalAge))/1000)>> liters of cum,<</if>>
+			<<if _slave.ovaries == 1>><<print 100*Math.trunc((52*(45-_slave.physicalAge))/100)>> liters of vaginal secretions, <<if $dairyPregSetting == 3>><<print 13*(45-_slave.physicalAge)>><<else>><<print 5*(45-_slave.physicalAge)>><</if>> slaves,<</if>>
+			and <<print 1000*Math.trunc((300*52*(45-_slave.physicalAge))/1000)>> liters of milk over a <<print 45-_slave.physicalAge>> year period before its biological components must be replaced.
+			<<if (_slave.ovaries == 1)>>
+				<<if (_slave.balls == 0)>>
 					<<set $bioreactorsXX++>>
 				<<else>>
 					<<set $bioreactorsHerm++>>
 				<</if>>
 			<<else>>
-				<<if ($slaves[$i].balls == 0)>>
+				<<if (_slave.balls == 0)>>
 					<<set $bioreactorsBarren++>>
 				<<else>>
 					<<set $bioreactorsXY++>>
 				<</if>>
 			<</if>>
-			<<set $activeSlave = $slaves[$i]>>
+			<<set $activeSlave = _slave>>
 			<<= removeActiveSlave() >>
 			<<break>>
 		<</if>>
diff --git a/src/uncategorized/freeRangeDairyAssignmentScene.tw b/src/uncategorized/freeRangeDairyAssignmentScene.tw
index ad3cf8c3df054be206da4f878a85ee80d1b741dd..113cb90f27a87c8e0bc2e849f1f892a6fb4dc64a 100644
--- a/src/uncategorized/freeRangeDairyAssignmentScene.tw
+++ b/src/uncategorized/freeRangeDairyAssignmentScene.tw
@@ -21,7 +21,7 @@
 <p>
 /* AROUSAL WHEN ENTERING */
 <<set _aroused = false >>
-<<if $DairyiIDs.length > 1 && canSee($activeSlave)>>
+<<if App.Entity.facilities.dairy.employeesIDs().size > 1 && canSee($activeSlave)>>
 	While <<if canWalk($activeSlave) >>walking<<else>>being carried<</if>> to $his designated stall, $he passes the other cows currently at their milking machines. Not being hurried, $he occasionally watches a cow in detail.
 	<div>
 		<<if $activeSlave.fetish == "boobs">>
diff --git a/src/uncategorized/headGirlSuite.tw b/src/uncategorized/headGirlSuite.tw
index 50d70b602fbeba42a89efa39764e4a336a9fef3b..7490a6dd0fa7ad3c811bf40f0cd307fea51663ca 100644
--- a/src/uncategorized/headGirlSuite.tw
+++ b/src/uncategorized/headGirlSuite.tw
@@ -13,7 +13,7 @@
 <<if $HeadGirl == 0>>
 	You have no Head Girl appointed to live in $HGSuiteName.
 	<<link "Select Head Girl">><<goto "HG Select">><</link>>
-<<elseif $HGSuiteiIDs.length > 0>>
+<<elseif App.Entity.facilities.headGirlSuite.hasEmployees>>
 	<<setLocalPronouns $HeadGirl>>
 	Your Head Girl $HeadGirl.slaveName has $slaves[_i].slaveName living in $HGSuiteName with $him, as $his servant, assistant, and sexual appliance.
 	<<link "Manage Head Girl">><<goto "HG Select">><</link>>
diff --git a/src/uncategorized/labReport.tw b/src/uncategorized/labReport.tw
index f9220f49c8b005a900f340213ed2d1107d672e83..6c75186b14d22a3a123185983653825d511bf27a 100644
--- a/src/uncategorized/labReport.tw
+++ b/src/uncategorized/labReport.tw
@@ -1,7 +1,5 @@
 :: Lab Report [nobr]
 
-''Lab Report''<hr style="margin:0">
-<br>
 <<if ($researchLab.hired + $researchLab.menials) > 0>>
 	<<if $researchLab.tasks.length == 0>>
 		<<set _cash = ($researchLab.speed * 90)>>
diff --git a/src/uncategorized/masterSuite.tw b/src/uncategorized/masterSuite.tw
index 804291cb4d25ffb3e9a9a22fe843637c63a61403..d74569219fa4841413084ff70b959c16abf1fabf 100644
--- a/src/uncategorized/masterSuite.tw
+++ b/src/uncategorized/masterSuite.tw
@@ -1,8 +1,7 @@
 :: Master Suite [nobr]
 
-<<set $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Master Suite", $showEncyclopedia = 1, $encyclopedia = "Master Suite", _SL = $slaves.length, _MsL = $MastSiIDs.length>>
-
-<<SlaveIDSort $MastSiIDs>>
+<<set _slaves = App.Utils.sortedEmployees(App.Entity.facilities.masterSuite)>>
+<<set $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Master Suite", $showEncyclopedia = 1, $encyclopedia = "Master Suite", _SL = $slaves.length, _MsL = _slaves.length>>
 
 <<if $masterSuiteName != "the Master Suite">>
 	<<set $masterSuiteNameCaps = $masterSuiteName.replace("the ", "The ")>>
@@ -18,28 +17,25 @@
 <</if>>
 
 <<if _MsL > 0>>
-<<for _dI = 0; _dI < _MsL; _dI++>>
-	<<set _i = $slaveIndices[$MastSiIDs[_dI]]>>
-	<<set _Slave = $slaves[_i]>>
-
+<<for _slave range _slaves>>
 	<<if $masterSuiteUpgradeLuxury == 2>>
-	<<if canAchieveErection(_Slave)>>
-		<<set _masterSuiteAverageCum += _Slave.balls, _masterSuiteAverageDick += _Slave.dick>>
+	<<if canAchieveErection(_slave)>>
+		<<set _masterSuiteAverageCum += _slave.balls, _masterSuiteAverageDick += _slave.dick>>
 	<</if>>
-	<<set _masterSuiteAverageMilk += _Slave.lactation*(_Slave.boobs-_Slave.boobsImplant), $masterSuiteAverageEnergy += _Slave.energy, _masterSuiteAveragePreg += _Slave.preg>>
-	<<if _Slave.fetish == "dom">>
-		<<set _masterSuiteAverageDom += _Slave.fetishStrength>>
-	<<elseif _Slave.fetish == "submissive">>
-		<<set _masterSuiteAverageDom -= _Slave.fetishStrength>>
-	<<elseif _Slave.fetish == "sadist">>
-		<<set _masterSuiteAverageSadism += _Slave.fetishStrength>>
-	<<elseif _Slave.fetish == "masochist">>
-		<<set _masterSuiteAverageSadism -= _Slave.fetishStrength>>
+	<<set _masterSuiteAverageMilk += _slave.lactation*(_slave.boobs-_slave.boobsImplant), $masterSuiteAverageEnergy += _slave.energy, _masterSuiteAveragePreg += _slave.preg>>
+	<<if _slave.fetish == "dom">>
+		<<set _masterSuiteAverageDom += _slave.fetishStrength>>
+	<<elseif _slave.fetish == "submissive">>
+		<<set _masterSuiteAverageDom -= _slave.fetishStrength>>
+	<<elseif _slave.fetish == "sadist">>
+		<<set _masterSuiteAverageSadism += _slave.fetishStrength>>
+	<<elseif _slave.fetish == "masochist">>
+		<<set _masterSuiteAverageSadism -= _slave.fetishStrength>>
 	<</if>>
 	<</if>>
-	<<if (_Slave.pregKnown == 1)>>
+	<<if (_slave.pregKnown == 1)>>
 		<<set _masterSuitePregnantSlaves++>>
-		<<if _Slave.pregType > 1>>
+		<<if _slave.pregType > 1>>
 			<<set _masterSuitePregnantSlavesMultiple++>>
 		<</if>>
 	<</if>>
diff --git a/src/uncategorized/masterSuiteReport.tw b/src/uncategorized/masterSuiteReport.tw
index ec5643d19685793048b99a04357f8b22395b2345..b8dd0ef788b7ce79264762c98ac62c0aed0a945b 100644
--- a/src/uncategorized/masterSuiteReport.tw
+++ b/src/uncategorized/masterSuiteReport.tw
@@ -1,38 +1,37 @@
 :: Master Suite Report [nobr]
 
-<<SlaveIDSort $MastSiIDs>>
-<<set _DL = $MastSiIDs.length, _SL = $slaves.length, $legendaryAbolitionistID = 0, $masterSuiteAverageEnergy = 0, _masterSuiteAverageCum = 0, _masterSuiteAverageDick = 0, _masterSuiteAverageDom = 0, _masterSuiteAverageMilk = 0, _masterSuiteAveragePreg = 0, _masterSuiteAverageSadism = 0, _masterSuitePregnantSlaves = 0, _masterSuitePregnantSlavesMultiple = 0>>
+<<set _slaves = App.Utils.sortedEmployees(App.Entity.facilities.masterSuite)>>
+<<set _DL = _slaves.length, _SL = $slaves.length, $legendaryAbolitionistID = 0, $masterSuiteAverageEnergy = 0, _masterSuiteAverageCum = 0, _masterSuiteAverageDick = 0, _masterSuiteAverageDom = 0, _masterSuiteAverageMilk = 0, _masterSuiteAveragePreg = 0, _masterSuiteAverageSadism = 0, _masterSuitePregnantSlaves = 0, _masterSuitePregnantSlavesMultiple = 0>>
 <<if $Concubine != 0>>
 	<<set _FLs = $slaveIndices[$Concubine.ID]>>
 
 	<<if def _FLs>>
-		/% Add the Concubine to the $MastSiIDs list at the front of the array, so that $he displays first %/
-		<<set $MastSiIDs.unshift($Concubine.ID), _DL++>>
+		/% Add the Concubine to the _slaves list at the front of the array, so that $he displays first %/
+		<<set _slaves.unshift($Concubine), _DL++>>
 	<</if>>
 <</if>>
 
 <<if _DL > 0>>
-	<<for _dI = 0; _dI < _DL; _dI++>>
-		<<set $i = $slaveIndices[$MastSiIDs[_dI]]>>
-		<<set $masterSuiteAverageEnergy += $slaves[$i].energy>>
+	<<for _slave range _slaves>>
+		<<set $masterSuiteAverageEnergy += _slave.energy>>
 		<<if $masterSuiteUpgradeLuxury == 2>>
-		<<if canAchieveErection($slaves[$i])>>
-			<<set _masterSuiteAverageCum += $slaves[$i].balls, _masterSuiteAverageDick += $slaves[$i].dick>>
+		<<if canAchieveErection(_slave)>>
+			<<set _masterSuiteAverageCum += _slave.balls, _masterSuiteAverageDick += _slave.dick>>
 		<</if>>
-		<<set _masterSuiteAverageMilk += $slaves[$i].lactation*($slaves[$i].boobs-$slaves[$i].boobsImplant), _masterSuiteAveragePreg += $slaves[$i].pregKnown>>
-		<<switch $slaves[$i].fetish>>
+		<<set _masterSuiteAverageMilk += _slave.lactation*(_slave.boobs-_slave.boobsImplant), _masterSuiteAveragePreg += _slave.pregKnown>>
+		<<switch _slave.fetish>>
 		<<case "dom">>
-			<<set _masterSuiteAverageDom += $slaves[$i].fetishStrength>>
+			<<set _masterSuiteAverageDom += _slave.fetishStrength>>
 		<<case "submissive">>
-			<<set _masterSuiteAverageDom -= $slaves[$i].fetishStrength>>
+			<<set _masterSuiteAverageDom -= _slave.fetishStrength>>
 		<<case "sadist">>
-			<<set _masterSuiteAverageSadism += $slaves[$i].fetishStrength>>
+			<<set _masterSuiteAverageSadism += _slave.fetishStrength>>
 		<<case "masochist">>
-			<<set _masterSuiteAverageSadism -= $slaves[$i].fetishStrength>>
+			<<set _masterSuiteAverageSadism -= _slave.fetishStrength>>
 		<</switch>>
 		<</if>>
-		<<if ($legendaryAbolitionistID == 0) && ($slaves[$i].devotion > 95) && ($slaves[$i].prestige == 0) && (($slaves[$i].origin == "You sentenced $him to enslavement as a punishment for attempted theft of a slave.") || ($slaves[$i].origin == "$He is an enslaved Daughter of Liberty.") || ($slaves[$i].origin === "You got $him at the Slave Shelter. $He is an enslaved Daughter of Liberty, caught some weeks after the failed coup. $His previous owner used $him as a punching bag and dart board, then when he was bored of $him tattooed obscenities all over $his body and threw $him away.") || ($slaves[$i].origin === "$He is an enslaved member of an anti-slavery extremist group.") || ($slaves[$i].career == "an antislavery activist"))>>
-			<<set $legendaryAbolitionistID = $slaves[$i].ID>>
+		<<if ($legendaryAbolitionistID == 0) && (_slave.devotion > 95) && (_slave.prestige == 0) && ((_slave.origin == "You sentenced $him to enslavement as a punishment for attempted theft of a slave.") || (_slave.origin == "$He is an enslaved Daughter of Liberty.") || (_slave.origin === "You got $him at the Slave Shelter. $He is an enslaved Daughter of Liberty, caught some weeks after the failed coup. $His previous owner used $him as a punching bag and dart board, then when he was bored of $him tattooed obscenities all over $his body and threw $him away.") || (_slave.origin === "$He is an enslaved member of an anti-slavery extremist group.") || (_slave.career == "an antislavery activist"))>>
+			<<set $legendaryAbolitionistID = _slave.ID>>
 		<</if>>
 	<</for>>
 	<<set $masterSuiteAverageEnergy = $masterSuiteAverageEnergy/_DL>>
@@ -95,18 +94,18 @@
 		<</if>>
 	<</if>>
 
-	<<for _dI = 0; _dI < _DL; _dI++>>
-		<<set $i = $slaveIndices[$MastSiIDs[_dI]]>>
-		<<setLocalPronouns $slaves[$i]>>
+	<<for _slave range _slaves>>
+		<<set $i = $slaveIndices[_slave.ID]>>
+		<<setLocalPronouns _slave>>
 		<br><br>
 		/* 000-250-006 */
 		<<if $seeImages && $seeReportImages>>
 		<div class="imageRef tinyImg">
-			<<= SlaveArt($slaves[$i], 0, 0)>>
+			<<= SlaveArt(_slave, 0, 0)>>
 		</div>
 		<</if>>
 		/* 000-250-006 */
-		<<if ($slaves[$i].assignment == "be your Concubine")>>
+		<<if (_slave.assignment == "be your Concubine")>>
 			<<set $Concubine = $slaves[_FLs]>>
 			''Your concubine <<= SlaveFullName($Concubine)>> is serving you in $masterSuiteName.'' More than any other slave, $his sexual brilliance and physical appeal are @@.green;critical@@ to your reputation.
 
@@ -164,259 +163,253 @@
 				<<run repX(300, "concubine", $Concubine)>>
 			<</if>>
 			<<if $masterSuiteUpgradeLuxury > 0>>
-				<<set $slaves[$i].rules.living = "luxurious", $slaves[$i].devotion += 4, $slaves[$i].trust += 4>>
+				<<set _slave.rules.living = "luxurious", _slave.devotion += 4, _slave.trust += 4>>
 			<<else>>
-				<<set $slaves[$i].rules.living = "normal", $slaves[$i].devotion += 2, $slaves[$i].trust += 2>>
+				<<set _slave.rules.living = "normal", _slave.devotion += 2, _slave.trust += 2>>
 			<</if>>
 			<<if $masterSuiteDecoration != "standard">>
-				<<set $slaves[$i].devotion++>>
+				<<set _slave.devotion++>>
 			<</if>>
 			<<run repX(Beauty($Concubine) * 5 + ($Concubine.skill.vaginal || 0) + ($Concubine.skill.anal || 0) + ($Concubine.skill.oral || 0) + ($Concubine.skill.whoring || 0) + ($Concubine.skill.entertainment || 0), "concubine", $Concubine)>>
 		<<else>> /* not Concubine */
-			<span class='slave-name'><<= SlaveFullName($slaves[$i])>></span>
-			<<if $slaves[$i].choosesOwnAssignment == 2>>
+			<span class='slave-name'><<= SlaveFullName(_slave)>></span>
+			<<if _slave.choosesOwnAssignment == 2>>
 				<<include "SA chooses own job">>
 			<<else>>
 				sees to your pleasure in $masterSuiteName.
 			<</if>>
 			/* Perform facility based rule changes */
 			<<if ($masterSuiteUpgradeLuxury == 1)>>
-				<<set $slaves[$i].rules.living = "luxurious">>
-				<<if ($slaves[$i].devotion <= 95)>>
-					<<set $slaves[$i].devotion += 2>>
+				<<set _slave.rules.living = "luxurious">>
+				<<if (_slave.devotion <= 95)>>
+					<<set _slave.devotion += 2>>
 				<</if>>
 				<<if $masterSuiteDecoration != "standard">>
-					<<set $slaves[$i].devotion++>>
+					<<set _slave.devotion++>>
 				<</if>>
-				<<if ($slaves[$i].trust < 60)>>
-					<<set $slaves[$i].trust++>>
+				<<if (_slave.trust < 60)>>
+					<<set _slave.trust++>>
 				<</if>>
 			<<elseif ($masterSuiteUpgradeLuxury == 2)>>
-				<<set $slaves[$i].rules.living = "luxurious">>
-				<<if ($slaves[$i].energy > 90)>>
-					<<if ($slaves[$i].devotion <= 95)>>
-						<<set $slaves[$i].devotion += 2>>
+				<<set _slave.rules.living = "luxurious">>
+				<<if (_slave.energy > 90)>>
+					<<if (_slave.devotion <= 95)>>
+						<<set _slave.devotion += 2>>
 					<</if>>
-					<<if ($slaves[$i].trust <= 95)>>
-						<<set $slaves[$i].trust += 2>>
+					<<if (_slave.trust <= 95)>>
+						<<set _slave.trust += 2>>
 					<</if>>
 				<<else>>
-					<<if ($slaves[$i].devotion <= 60)>>
-						<<set $slaves[$i].devotion++>>
+					<<if (_slave.devotion <= 60)>>
+						<<set _slave.devotion++>>
 					<</if>>
-					<<if ($slaves[$i].trust < 60)>>
-						<<set $slaves[$i].trust++>>
+					<<if (_slave.trust < 60)>>
+						<<set _slave.trust++>>
 					<</if>>
 				<</if>>
 			<<else>>
-				<<set $slaves[$i].rules.living = "spare">>
-				<<if ($slaves[$i].devotion <= 20) && ($slaves[$i].trust >= -20)>>
-					<<set $slaves[$i].devotion -= 2, $slaves[$i].trust -= 5>>
-				<<elseif ($slaves[$i].devotion <= 60)>>
-					<<set $slaves[$i].devotion += 2>>
-				<<elseif ($slaves[$i].devotion > 60)>>
-					<<set $slaves[$i].devotion -= 2>>
+				<<set _slave.rules.living = "spare">>
+				<<if (_slave.devotion <= 20) && (_slave.trust >= -20)>>
+					<<set _slave.devotion -= 2, _slave.trust -= 5>>
+				<<elseif (_slave.devotion <= 60)>>
+					<<set _slave.devotion += 2>>
+				<<elseif (_slave.devotion > 60)>>
+					<<set _slave.devotion -= 2>>
 				<</if>>
-				<<if ($slaves[$i].trust < 60)>>
-					<<set $slaves[$i].trust++>>
+				<<if (_slave.trust < 60)>>
+					<<set _slave.trust++>>
 				<</if>>
 			<</if>>
 		<</if>>
 		/% Both Concubine and other slaves %/
 		<<if $masterSuiteUpgradeLuxury == 2 && $masterSuiteAverageEnergy > random(50,90)>>
-			<<set _energy = (Math.ceil($slaves[$i].energy/5)*7)>>
-			<<run SimpleSexAct.Slave($slaves[$i], _energy)>>
-			<<if canPenetrate($slaves[$i])>>
+			<<set _energy = (Math.ceil(_slave.energy/5)*7)>>
+			<<run SimpleSexAct.Slave(_slave, _energy)>>
+			<<if canPenetrate(_slave)>>
 				<<set _fuckCount = (random(1,3)*_energy)>>
-				<<set $slaves[$i].counter.penetrative += _fuckCount, $penetrativeTotal += _fuckCount>>
+				<<set _slave.counter.penetrative += _fuckCount, $penetrativeTotal += _fuckCount>>
 			<</if>>
-			<<if $slaves[$i].nipples == "fuckable" && _masterSuiteAverageDick > 2>>
+			<<if _slave.nipples == "fuckable" && _masterSuiteAverageDick > 2>>
 				<<set _fuckCount = (random(1,3)*_energy)>>
-				<<set $slaves[$i].counter.mammary += _fuckCount, $mammaryTotal += _fuckCount>>
+				<<set _slave.counter.mammary += _fuckCount, $mammaryTotal += _fuckCount>>
 			<</if>>
-			<<if ($slaves[$i].trust >= -20) && ($slaves[$i].devotion > -10) && ($slaves[$i].fetishStrength <= 95) && $slaves[$i].fetish != "mindbroken">>
-				<<set _fetishChangeChance = fetishChangeChance($slaves[$i])>>
+			<<if (_slave.trust >= -20) && (_slave.devotion > -10) && (_slave.fetishStrength <= 95) && _slave.fetish != "mindbroken">>
+				<<set _fetishChangeChance = fetishChangeChance(_slave)>>
 				<<if (_masterSuiteAverageMilk > 2000) && (_fetishChangeChance > random(0,50))>>
-					<<if $slaves[$i].fetish == "boobs">>
-						<<if $verboseDescriptions == 1>>$His<<else>>$slaves[$i].slaveName's<</if>> @@.lightcoral;boob fetish is strengthened@@ by the constant availability of milky nipples for $him to play with.
-						<<set $slaves[$i].fetishStrength += 4>>
+					<<if _slave.fetish == "boobs">>
+						<<if $verboseDescriptions == 1>>$His<<else>>_slave.slaveName's<</if>> @@.lightcoral;boob fetish is strengthened@@ by the constant availability of milky nipples for $him to play with.
+						<<set _slave.fetishStrength += 4>>
 					<<else>>
-						<<if $verboseDescriptions == 1>>$He<<else>>$slaves[$i].slaveName<</if>> @@.lightcoral;acquires a boob fetish@@ after spending a lot of time in the fuckpit drinking from $his fellow fucktoys' tits.
-						<<set $slaves[$i].fetish = "boobs", $slaves[$i].fetishStrength = 65>>
+						<<if $verboseDescriptions == 1>>$He<<else>>_slave.slaveName<</if>> @@.lightcoral;acquires a boob fetish@@ after spending a lot of time in the fuckpit drinking from $his fellow fucktoys' tits.
+						<<set _slave.fetish = "boobs", _slave.fetishStrength = 65>>
 					<</if>>
-				<<elseif (_masterSuiteAverageDick > 3) && ($slaves[$i].anus > 0) && (_fetishChangeChance > random(0,50))>>
+				<<elseif (_masterSuiteAverageDick > 3) && (_slave.anus > 0) && (_fetishChangeChance > random(0,50))>>
 					$He
-					<<if $slaves[$i].fetish == "buttslut">>
+					<<if _slave.fetish == "buttslut">>
 						@@.lightcoral;sinks farther into anal pleasure,@@ since $he spends $his time in the fuckpit with at least one of the many available cocks up $his butt.
-						<<set $slaves[$i].fetishStrength += 4>>
+						<<set _slave.fetishStrength += 4>>
 					<<else>>
 						@@.lightcoral;acquires an anal fetish@@ after helplessly orgasming at the mercy of your many fucktoys eager to shove their big stiff penises up $his ass.
-						<<set $slaves[$i].fetish = "buttslut", $slaves[$i].fetishStrength = 65>>
+						<<set _slave.fetish = "buttslut", _slave.fetishStrength = 65>>
 					<</if>>
 				<<elseif (_masterSuiteAverageCum > 3) && (_fetishChangeChance > random(0,50))>>
 					$He
-					<<if $slaves[$i].fetish == "cumslut">>
+					<<if _slave.fetish == "cumslut">>
 						@@.lightcoral;sinks farther into cum addiction,@@ since $he spends $his time in the fuckpit eagerly sucking down ejaculate, straight from the many sources.
-						<<set $slaves[$i].fetishStrength += 4>>
+						<<set _slave.fetishStrength += 4>>
 					<<else>>
 						@@.lightcoral;acquires an oral fixation@@ after orally servicing your many fucktoys eager to blow their loads down $his throat.
-						<<set $slaves[$i].fetish = "cumslut", $slaves[$i].fetishStrength = 65>>
+						<<set _slave.fetish = "cumslut", _slave.fetishStrength = 65>>
 					<</if>>
 				<<elseif (_masterSuiteAveragePreg > 10) && (_fetishChangeChance > random(0,50))>>
 					$He
-					<<if $slaves[$i].fetish == "pregnancy">>
+					<<if _slave.fetish == "pregnancy">>
 						@@.lightcoral;sinks farther into pregnancy obsession,@@ since $he never wants for a pregnant girl to make love to.
-						<<set $slaves[$i].fetishStrength += 4>>
+						<<set _slave.fetishStrength += 4>>
 					<<else>>
 						@@.lightcoral;acquires a pregnancy fetish,@@ since many of $his sexual partners in the fuckpit are heavily pregnant.
-						<<set $slaves[$i].fetish = "pregnancy", $slaves[$i].fetishStrength = 65>>
+						<<set _slave.fetish = "pregnancy", _slave.fetishStrength = 65>>
 					<</if>>
 				<<elseif (_masterSuiteAverageDom < 50) && (_fetishChangeChance > random(0,50))>>
 					$He
-					<<if $slaves[$i].fetish == "dom">>
+					<<if _slave.fetish == "dom">>
 						@@.lightcoral;becomes more dominant,@@ since there are so many subs in the fuckpit who beg $him to fuck them hard.
-						<<set $slaves[$i].fetishStrength += 4>>
+						<<set _slave.fetishStrength += 4>>
 					<<else>>
 						@@.lightcoral;becomes sexually dominant@@ after having fun satisfying the many submissive fucktoys in the fuckpit who beg $him to top them.
-						<<set $slaves[$i].fetish = "dom", $slaves[$i].fetishStrength = 65>>
+						<<set _slave.fetish = "dom", _slave.fetishStrength = 65>>
 					<</if>>
 				<<elseif (_masterSuiteAverageDom > 50) && (_fetishChangeChance > random(0,50))>>
 					$He
-					<<if $slaves[$i].fetish == "submissive">>
+					<<if _slave.fetish == "submissive">>
 						@@.lightcoral;becomes even more submissive,@@ since there are so many doms in the fuckpit that $he's often used by more than one at once.
-						<<set $slaves[$i].fetishStrength += 4>>
+						<<set _slave.fetishStrength += 4>>
 					<<else>>
 						@@.lightcoral;becomes sexually submissive@@ after the many dominant slaves in the fuckpit hold $him down and use $him for their pleasure.
-						<<set $slaves[$i].fetish = "submissive", $slaves[$i].fetishStrength = 65>>
+						<<set _slave.fetish = "submissive", _slave.fetishStrength = 65>>
 					<</if>>
 				<<elseif (_masterSuiteAverageSadism < 50) && (_fetishChangeChance > random(0,50))>>
 					$He
-					<<if $slaves[$i].fetish == "sadist">>
+					<<if _slave.fetish == "sadist">>
 						@@.lightcoral;becomes more sadistic,@@ since there are so many sluts in the fuckpit who will do anything for $him if $he'll only spank them.
-						<<set $slaves[$i].fetishStrength += 4>>
+						<<set _slave.fetishStrength += 4>>
 					<<else>>
 						@@.lightcoral;becomes a bit of a sadist@@ after $he notices that so many of $his fellow fucktoys cum harder if $he gives them a good slap.
-						<<set $slaves[$i].fetish = "sadist", $slaves[$i].fetishStrength = 65>>
+						<<set _slave.fetish = "sadist", _slave.fetishStrength = 65>>
 					<</if>>
 				<<elseif (_masterSuiteAverageSadism > 50) && (_fetishChangeChance > random(0,50))>>
-					<<if $slaves[$i].fetish == "masochist">>
-						<<if $verboseDescriptions == 1>>$His<<else>>$slaves[$i].slaveName's<</if>> @@.lightcoral;pain addiction deepens,@@ since the fuckpit is full of ladies happy to fuck $him while $he screams.
-						<<set $slaves[$i].fetishStrength += 4>>
+					<<if _slave.fetish == "masochist">>
+						<<if $verboseDescriptions == 1>>$His<<else>>_slave.slaveName's<</if>> @@.lightcoral;pain addiction deepens,@@ since the fuckpit is full of ladies happy to fuck $him while $he screams.
+						<<set _slave.fetishStrength += 4>>
 					<<else>>
-						<<if $verboseDescriptions == 1>>$He<<else>>$slaves[$i].slaveName<</if>> @@.lightcoral;learns masochism@@ after experiencing many orgasms under the exquisite sexual torture of the sadists in the fuckpit.
-						<<set $slaves[$i].fetish = "masochist", $slaves[$i].fetishStrength = 65>>
+						<<if $verboseDescriptions == 1>>$He<<else>>_slave.slaveName<</if>> @@.lightcoral;learns masochism@@ after experiencing many orgasms under the exquisite sexual torture of the sadists in the fuckpit.
+						<<set _slave.fetish = "masochist", _slave.fetishStrength = 65>>
 					<</if>>
 				<</if>>
 			<</if>>
-			<<if $slaves[$i].lactation > 0>>
-				<<set $slaves[$i].lactationDuration = 2>>
-				<<set $slaves[$i].boobs -= $slaves[$i].boobsMilk, $slaves[$i].boobsMilk = 0>>
+			<<if _slave.lactation > 0>>
+				<<set _slave.lactationDuration = 2>>
+				<<set _slave.boobs -= _slave.boobsMilk, _slave.boobsMilk = 0>>
 			<</if>>
-			<<if $slaves[$i].energy > 40 && $slaves[$i].energy < 95>>
+			<<if _slave.energy > 40 && _slave.energy < 95>>
 				Being a constant part of the fuckpit orgy @@.green;greatly heightens $his libido.@@
-				<<set $slaves[$i].energy += 2>>
+				<<set _slave.energy += 2>>
 			<</if>>
-			<<set $slaves[$i].need -= 50>>
+			<<set _slave.need -= 50>>
 		<</if>>
 
 		<<if $masterSuiteUpgradePregnancy == 1>>
 			/* If they're not on fertility drugs and the toggle is active, stick them on (if they can take them). Otherwise take them off. */
-			<<if ($masterSuitePregnancyFertilityDrugs == 1) && ($slaves[$i].drugs != "fertility drugs") && canGetPregnant($slaves[$i])>>
-				<<set $slaves[$i].drugs = "fertility drugs">>
-			<<elseif ($masterSuiteHyperPregnancy == 1) && ($slaves[$i].drugs != "super fertility drugs") && canGetPregnant($slaves[$i])>>
-				<<set $slaves[$i].drugs = "super fertility drugs">>
-			<<elseif ((($masterSuitePregnancyFertilityDrugs == 0) && ($slaves[$i].drugs == "fertility drugs")) || (($masterSuiteHyperPregnancy == 0) && ($slaves[$i].drugs == "super fertility drugs"))) || (!canGetPregnant($slaves[$i]) && ["fertility drugs", "super fertility drugs"].includes($slaves[$i].drugs))>>
-				<<set $slaves[$i].drugs = "no drugs">>
+			<<if ($masterSuitePregnancyFertilityDrugs == 1) && (_slave.drugs != "fertility drugs") && canGetPregnant(_slave)>>
+				<<set _slave.drugs = "fertility drugs">>
+			<<elseif ($masterSuiteHyperPregnancy == 1) && (_slave.drugs != "super fertility drugs") && canGetPregnant(_slave)>>
+				<<set _slave.drugs = "super fertility drugs">>
+			<<elseif ((($masterSuitePregnancyFertilityDrugs == 0) && (_slave.drugs == "fertility drugs")) || (($masterSuiteHyperPregnancy == 0) && (_slave.drugs == "super fertility drugs"))) || (!canGetPregnant(_slave) && ["fertility drugs", "super fertility drugs"].includes(_slave.drugs))>>
+				<<set _slave.drugs = "no drugs">>
 			<</if>>
 			/* We don't know they're pregnant for a month or so by game logic */
-			<<if ($slaves[$i].pregKnown == 1)>>
+			<<if (_slave.pregKnown == 1)>>
 				/* Once we know they're knocked up, get the counter going. */
 				<<set _masterSuitePregnantSlaves += 1>>
 				/* Don't know about twins/triplets etc until 10 weeks. Once we do, get the counter going */
-				<<if ($slaves[$i].pregType > 1) && ($slaves[$i].preg >= $slaves[$i].pregData.normalBirth/1.33)>>
+				<<if (_slave.pregType > 1) && (_slave.preg >= _slave.pregData.normalBirth/1.33)>>
 					<<set _masterSuitePregnantSlavesMultiple += 1>>
 				<</if>>
 				/* If they're preggo and in the upgraded suite, give them extra devotion. More if they're being given lighter duties. */
-				<<if ($slaves[$i].devotion <= 100)>>
+				<<if (_slave.devotion <= 100)>>
 					<<if ($masterSuitePregnancySlaveLuxuries == 0)>>
-						<<set $slaves[$i].devotion += 2>>
+						<<set _slave.devotion += 2>>
 					<<else>>
-						<<set $slaves[$i].devotion += 5>>
+						<<set _slave.devotion += 5>>
 					<</if>>
 				<</if>>
 				/* If they're preggo and in the upgraded suite, give them extra trust. More if they're being given lighter duties. */
-				<<if ($slaves[$i].trust <= 100)>>
+				<<if (_slave.trust <= 100)>>
 					<<if ($masterSuitePregnancySlaveLuxuries == 0)>>
-						<<set $slaves[$i].trust += 2>>
+						<<set _slave.trust += 2>>
 					<<else>>
-						<<set $slaves[$i].trust += 5>>
+						<<set _slave.trust += 5>>
 					<</if>>
 				<</if>>
 				/* If they're preggo and in the upgraded suite, give them extra health. More if they're being given lighter duties. */
-				<<if ($slaves[$i].health.condition < 100)>>
+				<<if (_slave.health.condition < 100)>>
 					<<if ($masterSuitePregnancySlaveLuxuries == 0)>>
-						<<run improveCondition($slaves[$i], 15)>>
+						<<run improveCondition(_slave, 15)>>
 					<<else>>
-						<<run improveCondition($slaves[$i], 25)>>
+						<<run improveCondition(_slave, 25)>>
 					<</if>>
 				<</if>>
 			<</if>>
 		<</if>>
 
 		<<if $verboseDescriptions == 1>>
-			<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.pleaseYou($slaves[$i])>>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.pleaseYou(_slave)>>
 			<br>&nbsp;&nbsp;&nbsp;
-			<<if $servantMilkers == 1 && $slaves[$i].lactation > 0 && $slaves[$i].fuckdoll == 0 && $slaves[$i].fetish != "mindbroken" && canWalk($slaves[$i]) && $slaves[$i].intelligence+$slaves[$i].intelligenceImplant >= -90>>
+			<<if $servantMilkers == 1 && _slave.lactation > 0 && _slave.fuckdoll == 0 && _slave.fetish != "mindbroken" && canWalk(_slave) && _slave.intelligence+_slave.intelligenceImplant >= -90>>
 				When $his breasts begin to feel full and you aren't around, $he avails $himself to the penthouse milkers and
 				<<set $servantMilkersMultiplier = 0.25>>
-				<<run App.SlaveAssignment.getMilked($slaves[$i])>>
+				<<run App.SlaveAssignment.getMilked(_slave)>>
 				<<set $servantMilkersMultiplier = 1>>
 				gives $milk liters of milk over the week, which is sold for @@.yellowgreen;<<print cashFormat($milkSale)>>.@@
 			<</if>>
 			<br>&nbsp;&nbsp;&nbsp;
-			<<= App.SlaveAssignment.choosesOwnClothes($slaves[$i])>>
+			<<= App.SlaveAssignment.choosesOwnClothes(_slave)>>
 			<<include "SA rules">>
 			<<include "SA diet">>
 			<<include "SA long term effects">>
-			<<= App.SlaveAssignment.drugs($slaves[$i])>>
+			<<= App.SlaveAssignment.drugs(_slave)>>
 			<<include "SA relationships">>
 			<<include "SA rivalries">>
 			<br><<include "SA devotion">>
 		<<else>>
 			<<silently>>
 			<<include "SA chooses own job">>
-			<<run App.SlaveAssignment.pleaseYou($slaves[$i])>>
-			<<if $servantMilkers == 1 && $slaves[$i].lactation > 0 && $slaves[$i].fuckdoll == 0 && $slaves[$i].fetish != "mindbroken" && canWalk($slaves[$i]) && $slaves[$i].intelligence+$slaves[$i].intelligenceImplant >= -90>>
+			<<run App.SlaveAssignment.pleaseYou(_slave)>>
+			<<if $servantMilkers == 1 && _slave.lactation > 0 && _slave.fuckdoll == 0 && _slave.fetish != "mindbroken" && canWalk(_slave) && _slave.intelligence+_slave.intelligenceImplant >= -90>>
 				<<set $servantMilkersMultiplier = 0.25>>
-				<<run App.SlaveAssignment.getMilked($slaves[$i])>>
+				<<run App.SlaveAssignment.getMilked(_slave)>>
 				<<set $servantMilkersMultiplier = 1>>
 			<</if>>
-			<<run App.SlaveAssignment.choosesOwnClothes($slaves[$i])>>
+			<<run App.SlaveAssignment.choosesOwnClothes(_slave)>>
 			<<include "SA rules">>
 			<<include "SA diet">>
 			<<include "SA long term effects">>
-			<<run App.SlaveAssignment.drugs($slaves[$i])>>
+			<<run App.SlaveAssignment.drugs(_slave)>>
 			<<include "SA relationships">>
 			<<include "SA rivalries">>
 			<<include "SA devotion">>
 			<</silently>>
 		<</if>>
-		<<if $slaves[$i].health.condition < 80>>
+		<<if _slave.health.condition < 80>>
 			<<if $masterSuiteUpgradeLuxury == 1>>
-				<<run improveCondition($slaves[$i], 20)>>
+				<<run improveCondition(_slave, 20)>>
 			<<else>>
-				<<run improveCondition($slaves[$i], 10)>>
+				<<run improveCondition(_slave, 10)>>
 			<</if>>
 		<</if>>
 
 	<</for>>
 
-	<<if $Concubine != 0 && def _FLs>>
-		/% Remove the Concubine from the $MastSiIDs list %/
-		<<set $Concubine = $slaves[_FLs]>>
-		<<run $MastSiIDs.deleteAt(0), _DL-->>
-	<</if>>
-
 	<br><br>
 
 	<<if $arcologies[0].FSRestart != "unset" && $propOutcome != 1 && _masterSuitePregnantSlaves > 0 && $eugenicsFullControl != 1>>
diff --git a/src/uncategorized/newGamePlus.tw b/src/uncategorized/newGamePlus.tw
index 32041f40d4c0c45b5cb08ec8246f9af87585e54a..ed8e42b62e09064ac4ca23b74b50995e39b6a931 100644
--- a/src/uncategorized/newGamePlus.tw
+++ b/src/uncategorized/newGamePlus.tw
@@ -52,7 +52,7 @@ You <<if $cash >= _fee>>have<<else>>lack<</if>> the funds to bring more than $sl
 
 <br><br>
 
-<<if $cheatMode == 1>> <<link "DEBUG: Add all slaves to import list" "New Game Plus">> <<for _ngi = 0; _ngi < $slaves.length; _ngi++>> <<= assignJob($slaves[_ngi], "be imported")>> <</for>> <</link>> <br> <</if>>
+<<if $cheatMode == 1>> <<link "DEBUG: Add all slaves to import list" "New Game Plus">> <<for _ngi = 0; _ngi < $slaves.length; _ngi++>> <<= assignJob($slaves[_ngi], Job.IMPORTED)>> <</for>> <</link>> <br> <</if>>
 
 Select up to $slavesToImportMax slaves to be imported into a new game and then click [[here.|init][$saveImported = 1,$oldCareer = "undefined",$slavesToImport = 0]]
 
diff --git a/src/uncategorized/newSlaveIntro.tw b/src/uncategorized/newSlaveIntro.tw
index 1e4aaaf8e54290366c2ef77e0855ccd332ddae0e..72dcb834bff59d68cd718801de498cbdf4e539f9 100644
--- a/src/uncategorized/newSlaveIntro.tw
+++ b/src/uncategorized/newSlaveIntro.tw
@@ -2291,7 +2291,7 @@ The legalities completed, <span class='slave-name'><<= SlaveFullName($activeSlav
 		<<set $activeSlave.trust -= 10>>
 	<</link>>
 	<<if ($activeSlave.lactation > 0 || (($dairySlimMaintainUpgrade == 0 || $dairySlimMaintain == 0) && ($activeSlave.boobs > 300 || $activeSlave.dick == 0 || $dairyImplantsSetting == 1) && $dairyImplantsSetting != 2)) || ($activeSlave.balls > 0)>>
-		<<if ($dairyPrepUpgrade == 1) && ($dairy > $DairyiIDs.length+$bioreactorsXY+$bioreactorsXX+$bioreactorsHerm+$bioreactorsBarren)>>
+		<<if ($dairyPrepUpgrade == 1) && App.Entity.facilities.dairy.hasFreeSpace>>
 			| <<link "Send $him straight to the Industrial Dairy">>
 				<<set $activeSlave.choosesOwnAssignment = 0>>
 				<<set $activeSlave.anus = Math.clamp($activeSlave.anus, 3, 4)>>
@@ -2303,7 +2303,7 @@ The legalities completed, <span class='slave-name'><<= SlaveFullName($activeSlav
 				<</replace>>
 			<</link>>
 		<</if>>
-		<<if $dairy > $DairyiIDs.length+$bioreactorsXY+$bioreactorsXX+$bioreactorsHerm+$bioreactorsBarren>>
+		<<if App.Entity.facilities.dairy.hasFreeSpace>>
 			| <<link "Break $him in for the Industrial Dairy">>
 				<<set $activeSlave.choosesOwnAssignment = 0>>
 				<<set $activeSlave.anus = Math.clamp($activeSlave.anus, 3, 4)>>
@@ -2405,13 +2405,13 @@ The legalities completed, <span class='slave-name'><<= SlaveFullName($activeSlav
 		<<set $activeSlave.trust -= 10>>
 	<</link>>
 
-	<<if ($arcade > $ArcadeiIDs.length) || ($arcadeUpgradeFuckdolls == 2)>>
+	<<if (App.Entity.facilities.arcade.hasFreeSpace) || ($arcadeUpgradeFuckdolls == 2)>>
 		| <<link "Send $him straight to the Arcade">>
 			<<set $activeSlave.assignment = "be confined in the arcade">>
 			<<set $activeSlave.choosesOwnAssignment = 0>>
 			<<replace "#introResult">>
 				You order <<if $HeadGirl == 0>>another slave<<else>>$HeadGirl.slaveName<</if>> to get $activeSlave.slaveName set up in $arcadeName. The new slave does not know what $arcadeName is, not really, and $he doesn't know what being set up there means, either. $He'll be confined inside a small space, not too different from the indignities $he's suffered already. It's only when the restraints lock into place that $he'll understand $his doom. $His mouth will be forced open and presented at one wall of $arcadeName, and $his ass will protrude from its other side, $his holes available for public relief at both ends. $He'll probably refuse to believe the truth, until the first cockhead enters $his mouth<<if $activeSlave.vagina > -1>>, parts $his pussylips,<</if>> or presses against $his poor anus.
-				<<if ($arcade <= $ArcadeiIDs.length)>>Mere <<if $showInches == 2>>yards<<else>>meters<</if>> away, preparations to convert the least appealing Arcade slave into a Fuckdoll begin. As $activeSlave.slaveName is broken in by $his first customers, $he's blissfully unaware that $he's $arcade new slaves away from the same fate.<</if>>
+				<<if ($arcade <= App.Entity.facilities.arcade.employeesIDs().size)>>Mere <<if $showInches == 2>>yards<<else>>meters<</if>> away, preparations to convert the least appealing Arcade slave into a Fuckdoll begin. As $activeSlave.slaveName is broken in by $his first customers, $he's blissfully unaware that $he's $arcade new slaves away from the same fate.<</if>>
 			<</replace>>
 		<</link>>
 	<</if>>
diff --git a/src/uncategorized/penthouseReport.tw b/src/uncategorized/penthouseReport.tw
index 078eab1b3d43fe5a856cb8ed14e058f534cf897c..218371beeda33f70d9d41e3901d13a09e657775a 100644
--- a/src/uncategorized/penthouseReport.tw
+++ b/src/uncategorized/penthouseReport.tw
@@ -1,7 +1,13 @@
 :: Penthouse Report [nobr]
 
-<<SlaveIDSort $HGSuiteiIDs>>
 <<set _SL = $slaves.length>>
+<<if _S.HeadGirl>>
+	<<set _HGID = _S.HeadGirl.ID>>
+<<else>>
+	<<set _HGID = 0>>
+<</if>>
+
+<<set _HGSuitSlaves = App.Utils.jobForAssignment(Job.HEADGIRLSUITE).employees()>>
 
 <<for $i = 0; $i < _SL; $i++>>
 	<<if assignmentVisible($slaves[$i])>>
@@ -13,10 +19,10 @@
 		<<include "Full Report">>
 		<br><br>
 
-		<<if ($slaves[$i].assignment == "be your Head Girl") && ($HGSuiteiIDs.length > 0)>>
+		<<if ($slaves[$i].ID == _HGID) && (_HGSuitSlaves.length > 0)>>
 			/% We found the Head Girl, now let's find her slave %/
 			<<set _iTemp = $i>>
-			<<set _ID = $HGSuiteiIDs[0], $i = $slaveIndices[_ID]>>
+			<<set _ID = _HGSuitSlaves[0].ID, $i = $slaveIndices[_ID]>>
 
 			<<if $slaves[$i].assignment != "live with your Head Girl">>
 				<br>@@.red;$slaves[$i].slaveName had been assigned to live with your Head Girl, but this week $he was assigned to $slaves[$i].assignment. $He has been released to your penthouse for reassignment.@@
@@ -38,4 +44,4 @@
 <</for>>
 
 /* count open spots in facilities after all assignments have been decided for the week */
-<<set $brothelSpots = $brothel - $BrothiIDs.length, $clubSpots = $club - $ClubiIDs.length, $dairySpots = $dairy - $DairyiIDs.length, $servantsQuartersSpots = $servantsQuarters - $ServQiIDs.length>>
+<<set $brothelSpots = App.Entity.facilities.brothel.freeSpacee, $clubSpots = App.Entity.facilities.club.freeSpace, $dairySpots = App.Entity.facilities.dairy.freeSpace, $servantsQuartersSpots = App.Entity.facilities.servantsQuarters.freeSpace>>
diff --git a/src/uncategorized/randomNonindividualEvent.tw b/src/uncategorized/randomNonindividualEvent.tw
index e2a2c1732083e4fad023e8fc66cad6d242562cce..da12f5378eab89dde87d6cdf1869a77b0a2c47b8 100644
--- a/src/uncategorized/randomNonindividualEvent.tw
+++ b/src/uncategorized/randomNonindividualEvent.tw
@@ -280,6 +280,7 @@
 	<</for>>
 
 	/* Multislave Events */
+	<<set _L = App.Utils.countFacilityWorkers(["brothel", "clinic", "club", "dairy", "cellblock", "spa", "schoolroom", "servantsQuarters"])>>
 
 	<<if $fuckSlaves > 1>>
 		<<set $bedSlaves = $slaves.filter(function(s) { return s.devotion > 50 && (s.assignment == "please you" || s.assignment == "serve in the master suite" || s.assignment == "be your Concubine") && !isAmputee(s) && canDoAnal(s); })>>
@@ -308,27 +309,27 @@
 		<<set $events.push("RE rebels")>>
 	<</if>>
 
-	<<if $BrothiIDs.length > 3>>
+	<<if _L.brothel > 3>>
 		<<set $events.push("RE busy brothel")>>
 	<</if>>
-	<<if $BrothiIDs.length > 5>>
+	<<if _L.brothel > 5>>
 		<<set $events.push("RE brothel function")>>
 	<</if>>
-	<<if $ClubiIDs.length > 3>>
+	<<if _L.club > 3>>
 		<<set $events.push("RE busy club")>>
 	<</if>>
-	<<if $DairyiIDs.length > 3>>
+	<<if _L.dairy > 3>>
 		<<if $dairyRestraintsSetting < 2>>
 			<<set $events.push("RE busy dairy")>>
 		<</if>>
 	<</if>>
-	<<if $ServQiIDs.length > 3>>
+	<<if _L.servantsQuarters > 3>>
 		<<set $events.push("RE busy servants quarters")>>
 	<</if>>
-	<<if $ArcadeiIDs.length > 3>>
+	<<if App.Entity.facilities.arcade.employeesIDs().size > 3>>
 		<<set $events.push("RE busy arcade")>>
 	<</if>>
-	<<if $MastSiIDs.length > 3>>
+	<<if App.Entity.facilities.masterSuite.employeesIDs().size > 3>>
 		<<if $Concubine != 0>>
 			<<set $events.push("RE busy master suite")>>
 		<</if>>
@@ -406,7 +407,7 @@
 
 	<</if>>
 
-	<<if ($Milkmaid != 0) && ($DairyiIDs.length >= 5) && ($Milkmaid.health.condition >= 70)>>
+	<<if ($Milkmaid != 0) && (_L.dairy >= 5) && ($Milkmaid.health.condition >= 70)>>
 		<<if ($Milkmaid.muscles > 5)>>
 			<<set $PESSevent.push("tired milkmaid")>>
 		<</if>>
@@ -415,31 +416,31 @@
 		<</if>>
 	<</if>>
 
-	<<if ($Stewardess != 0) && ($ServQiIDs.length > 0) && ($Stewardess.actualAge >= 35 || $AgePenalty == 0)>>
+	<<if ($Stewardess != 0) && (_L.servantsQuarters > 0) && ($Stewardess.actualAge >= 35 || $AgePenalty == 0)>>
 		<<set $PETSevent.push("stewardess beating")>>
 	<</if>>
 
-	<<if ($Madam != 0) && ($BrothiIDs.length >= 5) && ($Madam.actualAge >= 35 || $AgePenalty == 0) && ($Madam.skill.whoring >= 100)>>
+	<<if ($Madam != 0) && (_L.brothel >= 5) && ($Madam.actualAge >= 35 || $AgePenalty == 0) && ($Madam.skill.whoring >= 100)>>
 		<<set $PESSevent.push("madam strategy")>>
 	<</if>>
 
-	<<if ($DJ != 0) && ($ClubiIDs.length >= 5) && ($DJ.face > 95) && ($DJ.skill.entertainment >= 100)>>
+	<<if ($DJ != 0) && (_L.club >= 5) && ($DJ.face > 95) && ($DJ.skill.entertainment >= 100)>>
 		<<set $PESSevent.push("DJ publicity")>>
 	<</if>>
 
-	<<if ($Schoolteacher != 0) && ($SchlRiIDs.length > 0) && ($Schoolteacher.intelligence+$Schoolteacher.intelligenceImplant > 15) && ($Schoolteacher.actualAge >= 35)>>
+	<<if ($Schoolteacher != 0) && (_L.schoolroom > 0) && ($Schoolteacher.intelligence+$Schoolteacher.intelligenceImplant > 15) && ($Schoolteacher.actualAge >= 35)>>
 		<<set $PETSevent.push("aggressive schoolteacher")>>
 	<</if>>
 
-	<<if ($Wardeness != 0) && ($CellBiIDs.length > 0) && canTalk($Wardeness)>>
+	<<if ($Wardeness != 0) && (_L.cellblock > 0) && canTalk($Wardeness)>>
 		<<set $PETSevent.push("abusive wardeness")>>
 	<</if>>
 
-	<<if (_S.Attendant) && ($SpaiIDs.length > 0) && canTalk(_S.Attendant)>>
+	<<if (_S.Attendant) && (_L.spa > 0) && canTalk(_S.Attendant)>>
 		<<set $PETSevent.push("comforting attendant")>>
 	<</if>>
 
-	<<if ($Nurse != 0) && ($CliniciIDs.length > 0) && ($Nurse.energy > 95) || (($Nurse.fetishStrength > 60) && ($Nurse.fetish == "sadist" || $Nurse.fetish == "dom"))>>
+	<<if ($Nurse != 0) && (_L.clinic > 0) && ($Nurse.energy > 95) || (($Nurse.fetishStrength > 60) && ($Nurse.fetish == "sadist" || $Nurse.fetish == "dom"))>>
 		<<set $subSlave = $slaves.find(function(s) { return s.anus != 0 && s.assignment == "get treatment in the clinic"; })>>
 		<<if (def $subSlave)>>
 			<<set $PETSevent.push("nurse molestation")>>
diff --git a/src/uncategorized/reBusyArcade.tw b/src/uncategorized/reBusyArcade.tw
index f94651bd69e7586b217d39e0cb2f07a3f6ad6640..cf3504175da09fcba2c593f132ca59a81e0c6d35 100644
--- a/src/uncategorized/reBusyArcade.tw
+++ b/src/uncategorized/reBusyArcade.tw
@@ -1,13 +1,6 @@
 :: RE busy arcade [nobr]
 
-<<set _rebaIDs = []>>
-<<for _reba = 0; _reba < $ArcadeiIDs.length; _reba++>>
-	<<set _rebaIndex = $slaveIndices[$ArcadeiIDs[_reba]]>>
-	<<if hasAnyArms($slaves[_rebaIndex]) && $slaves[_rebaIndex].fetish != "mindbroken" && $slaves[_rebaIndex].devotion < 45>>
-		<<set _rebaIDs.push($slaves[_rebaIndex].ID)>>
-	<</if>>
-<</for>>
-<<set $activeSlave = getSlave(_rebaIDs.random())>>
+<<set $activeSlave = App.Entity.facilities.arcade.employees().filter(s => hasAnyArms(s) && s.fetish !== "mindbroken" && s.devotion <45).random()>>
 
 <<if (ndef $activeSlave)>>
 	<<goto "RIE Eligibility Check">>
diff --git a/src/uncategorized/reBusyBrothel.tw b/src/uncategorized/reBusyBrothel.tw
index ca2e1c47b183a394133e834356a26657ce5588dd..4812e27841be06f90ffe3d1fd5666653e9ce2096 100644
--- a/src/uncategorized/reBusyBrothel.tw
+++ b/src/uncategorized/reBusyBrothel.tw
@@ -15,51 +15,50 @@ Of course, $brothelName is the best establishment of its kind in the arcology. C
 <<link "Surprise the hardworking whores with a day of rest">>
 	<<replace "#result">>
 		The problem with assembly-line sex is that it has a tendency to destroy any sense of intimacy or fun. So, you make some simple preparations and close the brothel for a day, hiring some freelancers to cover. All your slave whores are allowed to sleep late, and then spend the day with you playing games and enjoying light amusements. The slaves are surprised by your generosity, but they have fun. Many of the games are sexually themed. One day of giggling and squealing can't completely reverse the transactionalization of sex for them, but they @@.hotpink;appreciate the effort.@@
-		<<for $i = 0; $i < $BrothiIDs.length; $i++>>
-			<<set $slaves[$slaveIndices[$BrothiIDs[$i]]].devotion += 4>>
-			<<set $slaves[$slaveIndices[$BrothiIDs[$i]]].lastWeeksCashIncome += 250>>
-			<<set $slaves[$slaveIndices[$BrothiIDs[$i]]].lifetimeCashIncome += 250>>
-		<</for>>
+		<<run App.Entity.facilities.brothel.employees().forEach(s => {
+			s.devotion += 4;
+			s.lastWeeksCashIncome += 250;
+			s.lifetimeCashIncome += 250;
+		})>>
 		<<run cashX(-1000, "event")>>
 	<</replace>>
 <</link>> //This will cost <<print cashFormat(1000)>>//
 <br><<link "Hire an expert hooker to give lessons">>
 	<<replace "#result">>
-	The citizen streetwalker has had her day. A few of the cleverest have avoided being driven into poverty, either by becoming madams or by finding a way to build a new career serving the slave brothel industry. One of these is touring the city, offering her long sexual experience in seminars for slave prostitutes. Her services are not cheap, but it rapidly becomes clear that they are worth it. She is a grey-haired but still elegant woman with deep crow's feet and a smoker's voice. She is not only a sexual master, but a hard-bitten and comprehensively experienced businesswoman. All of your brothel slaves with any room for improvement in their whoring skills @@.green;learn from her lessons,@@ while those who have nothing to learn @@.hotpink;gain confidence@@ from her praise.
-	<<for $i = 0; $i < $BrothiIDs.length; $i++>>
-		<<set $slaves[$slaveIndices[$BrothiIDs[$i]]].lastWeeksCashIncome += 250>>
-		<<set $slaves[$slaveIndices[$BrothiIDs[$i]]].lifetimeCashIncome += 250>>
-		<<if $slaves[$slaveIndices[$BrothiIDs[$i]]].skill.whoring < 100>>
-			<<set $slaves[$i].skill.whoring += 10>>
-		<<else>>
-			<<set $slaves[$slaveIndices[$BrothiIDs[$i]]].devotion += 4>>
-		<</if>>
-	<</for>>
-	<<run cashX(-2000, "event")>>
+		The citizen streetwalker has had her day. A few of the cleverest have avoided being driven into poverty, either by becoming madams or by finding a way to build a new career serving the slave brothel industry. One of these is touring the city, offering her long sexual experience in seminars for slave prostitutes. Her services are not cheap, but it rapidly becomes clear that they are worth it. She is a grey-haired but still elegant woman with deep crow's feet and a smoker's voice. She is not only a sexual master, but a hard-bitten and comprehensively experienced businesswoman. All of your brothel slaves with any room for improvement in their whoring skills @@.green;learn from her lessons,@@ while those who have nothing to learn @@.hotpink;gain confidence@@ from her praise.
+		<<run App.Entity.facilities.brothel.employees().forEach(s => {
+			s.lastWeeksCashIncome += 250;
+			s.lifetimeCashIncome += 250;
+			if (s.skill.whoring < 100) {
+				s.skill.whoring += 10;
+			} else {
+				s.devotion += 4;
+			}
+		})>>
+		<<run cashX(-2000, "event")>>
 	<</replace>>
 <</link>> //This will cost <<print cashFormat(2000)>>//
 <br><<link "Eliminate prices for one morning to promote the brothel">>
 	<<replace "#result">>
-	The news that sex will be free at the brothel travels like wildfire. Security measures are necessary to control the throng that spends the entire day entering and leaving the brothel, though as the day goes on the crowds thin. By midmorning, all the holes on offer are so fucked out that only those who fetishize that sort of thing stick around. The brothel is a real seminal sewer by noon, and it smells like it. Nevertheless, free sex is a short route to @@.green;public approval,@@ though you do miss a morning's fees. The poor slave whores are @@.red;fairly battered@@ by so much wear and tear in so little time.
-	<<for $i = 0; $i < $BrothiIDs.length; $i++>>
-		<<set _rebb = $slaveIndices[$BrothiIDs[$i]]>>
-		<<run healthDamage($slaves[_rebb], 10)>>
-		<<if canDoVaginal($slaves[_rebb])>>
-			<<set $slaves[_rebb].counter.vaginal += 5>>
-			<<set $vaginalTotal += 5>>
-			<<if canDoAnal($slaves[_rebb])>>
-				<<set $slaves[_rebb].counter.anal += 5>>
-				<<set $analTotal += 5>>
-			<</if>>
-		<<elseif canDoAnal($slaves[_rebb])>>
-			<<set $slaves[_rebb].counter.anal += 10>>
-			<<set $analTotal += 10>>
-		<</if>>
-		<<set $slaves[_rebb].counter.oral += 10>>
-		<<set $oralTotal += 10>>
-	<</for>>
-	<<run cashX(-2000, "event")>>
-	<<run repX(1000, "event")>>
+		The news that sex will be free at the brothel travels like wildfire. Security measures are necessary to control the throng that spends the entire day entering and leaving the brothel, though as the day goes on the crowds thin. By midmorning, all the holes on offer are so fucked out that only those who fetishize that sort of thing stick around. The brothel is a real seminal sewer by noon, and it smells like it. Nevertheless, free sex is a short route to @@.green;public approval,@@ though you do miss a morning's fees. The poor slave whores are @@.red;fairly battered@@ by so much wear and tear in so little time.
+		<<run App.Entity.facilities.brothel.employees().forEach(s => {
+			healthDamage(s, 10);
+			if (canDoVaginal(s)) {
+				s.counter.vaginal += 5;
+				V.vaginalTotal += 5;
+				if (canDoAnal(s)) {
+					s.counter.anal += 5;
+					V.analTotal += 5;
+				}
+			} else if (canDoAnal(s)) {
+				s.counter.anal += 10;
+				V.analTotal += 10;
+			}
+			s.counter.oral += 10;
+			V.oralTotal += 10;
+		})>>
+		<<run cashX(-2000, "event")>>
+		<<run repX(1000, "event")>>
 	<</replace>>
 <</link>> //This will cost <<print cashFormat(2000)>>//
 </span>
diff --git a/src/uncategorized/reBusyDairy.tw b/src/uncategorized/reBusyDairy.tw
index dc158dbe820ea5830557a48656915bf27f0e6ddb..d0c3307746154632124c834a91f80f1955d0e281 100644
--- a/src/uncategorized/reBusyDairy.tw
+++ b/src/uncategorized/reBusyDairy.tw
@@ -15,17 +15,16 @@ Even with high doses of modern drugs, human cows simply do not produce a very hi
 <<link "Share a milk bath with the cows">>
 	<<replace "#result">>
 	Milk is a fashionable skin treatment in the Free Cities, and many of the cows fetishize their breasts and their milk. Many of them giggle with delight when you bring them all into a large spa room with a huge tub full of their fresh milk. A pittance will be lost from sales, but it's hard to think of such things when swimming and splashing in warm, nutty mother's milk with so many huge-breasted slaves, many of whom are milking themselves into the bath. Some of the older ones relax and luxuriate, gently milking themselves and masturbating or each other, according to taste. The younger cows prefer to rub themselves against you, taking turns being fucked. Regardless, they all @@.hotpink;appreciate such a special experience.@@
-	<<for $i = 0; $i < $DairyiIDs.length; $i++>>
-		<<set _rebd = $slaveIndices[$DairyiIDs[$i]]>>
-		<<set $slaves[_rebd].devotion += 4>>
-		<<if canDoVaginal($slaves[_rebd])>>
-			<<set $slaves[_rebd].counter.vaginal += 1>>
+	<<for _slave range App.Utils.jobForAssignment(Job.DAIRY).employees()>>
+		<<set _slave.devotion += 4>>
+		<<if canDoVaginal(_slave)>>
+			<<set _slave.counter.vaginal += 1>>
 			<<set $vaginalTotal += 1>>
-		<<elseif canDoAnal($slaves[_rebd])>>
-			<<set $slaves[_rebd].counter.anal += 1>>
+		<<elseif canDoAnal(_slave)>>
+			<<set _slave.counter.anal += 1>>
 			<<set $analTotal += 1>>
 		<</if>>
-		<<set $slaves[_rebd].counter.oral += 1>>
+		<<set _slave.counter.oral += 1>>
 		<<set $oralTotal += 1>>
 	<</for>>
 	<<run cashX(-1000, "event")>>
diff --git a/src/uncategorized/reRecruit.tw b/src/uncategorized/reRecruit.tw
index 80cc3ab9c9fe8bde70a2813f9b37cea7d908af07..a3e2b22c7625da506c6ed93aa6acebe59e0ba358 100644
--- a/src/uncategorized/reRecruit.tw
+++ b/src/uncategorized/reRecruit.tw
@@ -2582,7 +2582,7 @@ He explains that one of his servant <<= $girl>>s was impregnated by his fool of
 			You complete the legalities and biometric scanning quickly and without fuss. $activeSlave.slaveName participates matter-of-factly, and there's a certain sense of relief about $him. $His fate is out of $his hands now, and you get the impression $he isn't sorry about that at all.
 		<<case "desperate birth">>
 			You complete the legalities and biometric scanning quickly before
-			<<if $clinic > 0 && $clinic < $CliniciIDs.length>>
+			<<if App.Entity.facilities.clinic.hasFreeSpace>>
 				rushing $him to $clinicName,
 				<<set $activeSlave.assignment = "get treatment in the clinic">>
 			<<else>>
diff --git a/src/uncategorized/repBudget.tw b/src/uncategorized/repBudget.tw
index ce03bf981b20c0ae38437923aa281ed3d04e36ae..6bfaba0cf7f9a7a77c8706061c282bb134a8b22e 100644
--- a/src/uncategorized/repBudget.tw
+++ b/src/uncategorized/repBudget.tw
@@ -75,13 +75,14 @@ for (var i = 0; i < State.variables.lastWeeksRepIncome.length; i++){
 		<h2>Structures</h2>		/* TODO: using h2s doesn't fit in with the rest of the game */
 	</tr>
 
-	<<print budgetLine("arcade", "<<if $arcade>>[[$arcadeNameCaps|Arcade][$nextButton = \"Back to Budget\", $nextLink = \"Rep Budget\"]]<<else>>$arcadeNameCaps<</if>> ($ArcadeiIDs.length slaves)")>>
+	<<set _L = App.Utils.countFacilityWorkers(["arcade", "brothel", "club", "servantsQuarters", "spa"])>>
+	<<print budgetLine("arcade", "<<if $arcade>>[[$arcadeNameCaps|Arcade][$nextButton = \"Back to Budget\", $nextLink = \"Rep Budget\"]]<<else>>$arcadeNameCaps<</if>> (_L.arcade slaves)")>>
 
 	<<print budgetLine("gloryholeArcade", "Free arcade")>>
 
-	<<print budgetLine("brothel", "<<if $brothel>>[[$brothelNameCaps|Brothel][$nextButton = \"Back to Budget\", $nextLink = \"Rep Budget\"]]<<else>>$brothelNameCaps<</if>> ($BrothiIDs.length slaves)")>>
+	<<print budgetLine("brothel", "<<if $brothel>>[[$brothelNameCaps|Brothel][$nextButton = \"Back to Budget\", $nextLink = \"Rep Budget\"]]<<else>>$brothelNameCaps<</if>> (_L.brothel slaves)")>>
 
-	<<print budgetLine("club", "<<if $club>>[[$clubNameCaps|Club][$nextButton = \"Back to Budget\", $nextLink = \"Rep Budget\"]]<<else>>$clubNameCaps<</if>> ($ClubiIDs.length slaves)")>>
+	<<print budgetLine("club", "<<if $club>>[[$clubNameCaps|Club][$nextButton = \"Back to Budget\", $nextLink = \"Rep Budget\"]]<<else>>$clubNameCaps<</if>> (_L.club slaves)")>>
 
 	<<print budgetLine("publicServantClub", "Club servants")>>
 
@@ -93,9 +94,9 @@ for (var i = 0; i < State.variables.lastWeeksRepIncome.length; i++){
 
 	<<print budgetLine("pit", "<<if $pit>>[[$pitNameCaps|Pit][$nextButton = \"Back to Budget\", $nextLink = \"Rep Budget\"]]<<else>>$pitNameCaps<</if>> ($fighterIDs.length slaves)")>>
 
-	<<print budgetLine("servantsQuarters", "<<if $servantsQuarters>>[[Servants' Quarters][$nextButton = \"Back to Budget\", $nextLink = \"Rep Budget\"]]<<else>>Servants' Quarters<</if>> ($ServQiIDs.length slaves)")>>
+	<<print budgetLine("servantsQuarters", "<<if $servantsQuarters>>[[Servants' Quarters][$nextButton = \"Back to Budget\", $nextLink = \"Rep Budget\"]]<<else>>Servants' Quarters<</if>> (_L.servantsQuarters slaves)")>>
 
-	<<print budgetLine("spa", "<<if $spa>>[[$spaNameCaps|Spa][$nextButton = \"Back to Budget\", $nextLink = \"Rep Budget\"]]<<else>>$spaNameCaps<</if>> ($SpaiIDs.length slaves)")>>
+	<<print budgetLine("spa", "<<if $spa>>[[$spaNameCaps|Spa][$nextButton = \"Back to Budget\", $nextLink = \"Rep Budget\"]]<<else>>$spaNameCaps<</if>> (_L.spa slaves)")>>
 
 	<<print budgetLine("architecture", "[[Architecture|Manage Arcology][$nextButton = \"Back to Budget\", $nextLink = \"Rep Budget\"]]")>>
 
diff --git a/src/uncategorized/saChoosesOwnJob.tw b/src/uncategorized/saChoosesOwnJob.tw
index 595c2d6928e1132b61d29d3741d6d1cd048c64ed..1389233daddff5eb6ec8a2ae51bf2f4408cc2460 100644
--- a/src/uncategorized/saChoosesOwnJob.tw
+++ b/src/uncategorized/saChoosesOwnJob.tw
@@ -1,6 +1,6 @@
 :: SA chooses own job [nobr]
 
-<<set _clinicL = $CliniciIDs.length, _schoolL = $SchlRiIDs.length, _servQL = $ServQiIDs.length, _nurseryL = $NurseryiIDs.length, _brothelL = $BrothiIDs.length, _clubL = $ClubiIDs.length, _masterSL = $MastSiIDs.length, _spaL = $SpaiIDs.length, _dairyL = $DairyiIDs.length>>
+<<set _clinicL = App.Entity.facilities.clinic.employeesIDs().size, _schoolL = App.Entity.facilities.schoolroom.employeesIDs().size, _servQL = App.Entity.facilities.servantsQuarters.employeesIDs().size, _nurseryL = App.Entity.facilities.nursery.employeesIDs().size, _brothelL = App.Entity.facilities.brothel.employeesIDs().size, _clubL = App.Entity.facilities.club.employeesIDs().size, _masterSL = App.Entity.facilities.masterSuite.employeesIDs().size, _spaL = App.Entity.facilities.spa.employeesIDs().size, _dairyL = App.Entity.facilities.dairy.employeesIDs().size>>
 
 <<setLocalPronouns $slaves[$i]>>
 
diff --git a/src/uncategorized/saRecruitGirls.tw b/src/uncategorized/saRecruitGirls.tw
index d5c32d07fd088896ec58e4b5cb3085f724e0874a..962b1d4776013671ccd0cbcaed2a07dc13345dd9 100644
--- a/src/uncategorized/saRecruitGirls.tw
+++ b/src/uncategorized/saRecruitGirls.tw
@@ -1,6 +1,10 @@
 :: SA recruit girls [nobr]
 
 <<set _bellyAccessory = $slaves[$i].bellyAccessory>>
+<<set _ClubL = App.Entity.facilities.club.employeesIDs().size>>
+<<set _DairyL = App.Entity.facilities.dairy.employeesIDs().size>>
+<<set _MastSL = App.Entity.facilities.masterSuite.employeesIDs().size>>
+
 
 /* Note on target sum: HG and Recruiter are the initial 2 counted (no facility req'd), while HGSuite counts the HG's girl, other facilities count associated leader */
 <<if $recruiterIdleRule == "number">>
@@ -696,8 +700,8 @@
 		<</if>>
 	<</if>>
 	<<if $arcologies[0].FSPastoralist != "unset">>
-		<<if $dairy > 0 && ($slaves[$i].lactation > 0 || ($DairyiIDs.length > 0 && _FSIntMod > ($dairyRestraintsSetting+1)))>>
-			<<if $DairyiIDs.length > 0 && _FSIntMod > ($dairyRestraintsSetting+1)>>
+		<<if $dairy > 0 && ($slaves[$i].lactation > 0 || (_DairyL > 0 && _FSIntMod > ($dairyRestraintsSetting+1)))>>
+			<<if _DairyL > 0 && _FSIntMod > ($dairyRestraintsSetting+1)>>
 				<<set _seed += 3, _FSdefend++>>
 			<</if>>
 			<<if $slaves[$i].lactation > 0>>
@@ -747,7 +751,7 @@
 			<</if>>
 		<</if>>
 	<<elseif $arcologies[0].FSEdoRevivalist != "unset">>
-		<<if $clubDecoration != "standard" && $ClubiIDs.length > 1>>
+		<<if $clubDecoration != "standard" && _ClubL > 1>>
 			<<if $clubAdsSpending > 0>>
 				<<set _clubSeed = ($clubBonuses+Math.abs($clubAdsOld)+Math.abs($clubAdsStacked)+Math.abs($clubAdsImplanted)+Math.abs($clubAdsModded)+Math.abs($clubAdsXX))>>
 			<<else>>
@@ -758,7 +762,7 @@
 			<</if>>
 		<</if>>
 	<<elseif $arcologies[0].FSArabianRevivalist != "unset">>
-		<<if $masterSuiteDecoration == "Arabian Revivalist" && $masterSuiteUpgradeLuxury > 0 && $masterSuiteAverageEnergy > 60 && $MastSiIDs.length >= 3>>
+		<<if $masterSuiteDecoration == "Arabian Revivalist" && $masterSuiteUpgradeLuxury > 0 && $masterSuiteAverageEnergy > 60 && _MastSL >= 3>>
 			<<set _seed += 6, _FSmatch++, $arcologies[0].FSArabianRevivalist += 0.02*$FSSingleSlaveRep>>
 		<</if>>
 	<<elseif $arcologies[0].FSChineseRevivalist != "unset">>
@@ -1036,7 +1040,7 @@
 		<</if>>
 		<<if $arcologies[0].FSPastoralist != "unset">>
 			<<if $dairy>>
-				<<if $DairyiIDs.length && _FSIntMod > ($dairyRestraintsSetting+1)>>
+				<<if _DairyL && _FSIntMod > ($dairyRestraintsSetting+1)>>
 					<<if $slaves[$i].lactation > 0>>
 						$He schedules VR tours of $dairyName in order to popularize your free-range practices and quality products: the highlight each time is when $he hooks $his own teats into a milker and brings $himself to orgasm.
 					<<else>>
@@ -1137,7 +1141,7 @@
 				One of the most prominent features of your Egyptian Revival is an open, even expectant, attitude toward slave incest, but $he doesn't have any close family living in your household.
 			<</if>>
 		<<elseif $arcologies[0].FSEdoRevivalist != "unset">>
-			<<if $clubDecoration != "standard" && $ClubiIDs.length > 1>>
+			<<if $clubDecoration != "standard" && _ClubL > 1>>
 				<<if _clubSeed >= 3>>
 					The candid, POV-style videos of $slaves[$i].slaveName dancing, making out, and giving blowjobs alongside your regular sluts in $clubName's $clubDecoration atmosphere earn a lot of thumbs up.
 				<<else>>
@@ -1145,14 +1149,14 @@
 				<</if>>
 			<<elseif $club == 0>>
 				$He'd like to integrate $his personal profile with your cultural Revival, but there's no clear place in your arcology to focus $his attention.
-			<<elseif $ClubiIDs.length <= 1>>
+			<<elseif _ClubL <= 1>>
 				$He travels down to $clubName for some POV video footage, but $he can't get enough reliable dance partners.
 			<<else>>
 				$He gets some hot POV-style footage when $he films in your nightclub, but there's nothing special about its atmosphere to distinguish it from any other bar in any other arcology.
 			<</if>>
 		<<elseif $arcologies[0].FSArabianRevivalist != "unset">>
 			<<if $masterSuiteDecoration == "Arabian Revivalist" && $masterSuiteUpgradeLuxury > 0 && $masterSuiteAverageEnergy > 60>>
-				<<if $MastSiIDs.length >= 3>>
+				<<if _MastSL >= 3>>
 					An exposé that "pulls back the curtain" on your elaborate master bedroom goes viral after several harem slaves drag $him into <<if $masterSuiteUpgradeLuxury == 1>>four-way action with their <<= properMaster()>><<else>>a fuckpit daisy chain<</if>> and another takes over the filming.
 				<<else>>
 					$He makes a short video essay about your elaborate master suite, but the empty space unfilled by luscious slave bodies fails to impress.
diff --git a/src/uncategorized/saRules.tw b/src/uncategorized/saRules.tw
index 340238bfefc89e8bd8a8c147801b5fdf2bffa830..69f0bc8c8e927cbb3027fdb93eaaa2eb8d719ed4 100644
--- a/src/uncategorized/saRules.tw
+++ b/src/uncategorized/saRules.tw
@@ -1,5 +1,6 @@
 :: SA rules [nobr]
 
+<<set _L = App.Utils.countFacilityWorkers()>>
 <<set _release = $slaves[$i].rules.release>>
 
 <<if $slaves[$i].fuckdoll == 0>>
@@ -43,7 +44,7 @@
 				<</if>>
 			<</if>>
 		<<case "be the Madam">>
-			<<set $slaves[$i].need -= ($BrothiIDs.length*10)>>
+			<<set $slaves[$i].need -= (App.Entity.facilities.brothel.employeesIDs().size*10)>>
 			<<if $slaves[$i].energy <= 20>>
 				is frigid and has little interest in getting off<<if App.Utils.releaseRestricted($slaves[$i])>>, making the rule restricting $his sexual outlets superfluous<</if>>.
 				<<set $slaves[$i].need = 0>>
@@ -117,7 +118,7 @@
 			<<if ($universalRulesConsent == 0)>>
 				<<if (_release.slaves === 1)>>
 					<<if ($slaves[$i].energy > 95)>>
-						<<if $BrothiIDs.length > 2>>
+						<<if App.Entity.facilities.brothel.employeesIDs().size > 2>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;adores@@ you for leaving plentiful outlets for $his nymphomania under $his care.
 						<<else>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;eagerly awaits@@ the day you assign more whores to $brothelName.
@@ -125,14 +126,14 @@
 						<<set $slaves[$i].devotion += 1>>
 					<<elseif ($slaves[$i].fetishKnown == 1) && ($slaves[$i].fetishStrength > 60)>>
 						<<if ($slaves[$i].fetish == "sadist")>>
-							<<if $BrothiIDs.length > 2>>
+							<<if App.Entity.facilities.brothel.employeesIDs().size > 2>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;adores@@ you for providing a whole brothel of whores for $him to rape.
 							<<else>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;eagerly awaits@@ the day you assign more whores to $brothelName for $him to rape.
 							<</if>>
 							<<set $slaves[$i].devotion += 1>>
 						<<elseif ($slaves[$i].fetish == "dom")>>
-							<<if $BrothiIDs.length > 2>>
+							<<if App.Entity.facilities.brothel.employeesIDs().size > 2>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;adores@@ you for allowing $him a brothel of whores to dominate.
 							<<else>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;eagerly awaits@@ the day you assign more whores to $his domain.
@@ -180,7 +181,7 @@
 					<<if $spa != 0>>
 						usually spends in $spaName<<if _S.Attendant>>, enjoying _S.Attendant.slaveName's care<</if>>.
 					<<else>>
-						usually spends relaxing in $his room<<if $BrothiIDs.length > 1>> with a whore <<if hasBothLegs($slaves[$i])>>between $his legs<<else>>at $his crotch<</if>><</if>>.
+						usually spends relaxing in $his room<<if App.Entity.facilities.brothel.employeesIDs().size > 1>> with a whore <<if hasBothLegs($slaves[$i])>>between $his legs<<else>>at $his crotch<</if>><</if>>.
 					<</if>>
 					<<if $slaves[$i].relationship > 0>>
 						<<set $subSlave = getSlave($slaves[$i].relationshipTarget)>>
@@ -477,14 +478,14 @@
 			<<if ($universalRulesConsent == 0)>>
 				<<if ($slaves[$i].devotion <= 20)>>
 					<<if ($slaves[$i].trust > -10)>>
-						<<if $BrothiIDs.length > 2 || $Madam != 0>>
+						<<if App.Entity.facilities.brothel.employeesIDs().size > 2 || $Madam != 0>>
 							Under the rules, $he finds $himself constantly molested by other slaves, and lives $his life constantly @@.gold;afraid.@@
 						<<else>>
 							Under the rules, $he is free game for other slaves to molest, and lives $his life constantly @@.gold;afraid@@ of the day you assign more whores to $brothelName.
 						<</if>>
 						<<set $slaves[$i].trust -= 2>>
 					<<else>>
-						<<if $BrothiIDs.length > 2 || $Madam != 0>>
+						<<if App.Entity.facilities.brothel.employeesIDs().size > 2 || $Madam != 0>>
 							Under the rules, $he finds $himself constantly molested by other slaves, but $he's already in such constant terror it doesn't seriously affect $him.
 						<<else>>
 							Under the rules, $he will someday find $himself constantly molested by other slaves, but $he's already in such constant terror it that it doesn't cross $his mind.
@@ -492,7 +493,7 @@
 					<</if>>
 				<<elseif (_release.slaves === 1)>>
 					<<if ($slaves[$i].energy > 95)>>
-						<<if $BrothiIDs.length > 2>>
+						<<if App.Entity.facilities.brothel.employeesIDs().size > 2>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;adores@@ you for providing plentiful outlets for $his nymphomania.
 						<<else>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;eagerly awaits@@ the day you assign more whores to $brothelName to get $him off.
@@ -500,14 +501,14 @@
 						<<set $slaves[$i].devotion += 1>>
 					<<elseif ($slaves[$i].fetishKnown == 1) && ($slaves[$i].fetishStrength > 60)>>
 						<<if ($slaves[$i].fetish == "sadist")>>
-							<<if $BrothiIDs.length > 2>>
+							<<if App.Entity.facilities.brothel.employeesIDs().size > 2>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;adores@@ you for providing a whole brothel of whores for $him to rape.
 							<<else>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;eagerly awaits@@ the day you assign more whores to $brothelName for $him to rape.
 							<</if>>
 							<<set $slaves[$i].devotion += 1>>
 						<<elseif ($slaves[$i].fetish == "dom")>>
-							<<if $BrothiIDs.length > 2>>
+							<<if App.Entity.facilities.brothel.employeesIDs().size > 2>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;adores@@ you for providing a whole brothel of whores for $him to dominate.
 							<<else>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;eagerly awaits@@ the day you assign more whores to $brothelName for $him to dominate.
@@ -518,7 +519,7 @@
 				<</if>>
 			<<else>>
 				<<if ($slaves[$i].devotion <= 20) && ($slaves[$i].devotion >= -20)>>
-					<<if $BrothiIDs.length > 2 || $Madam != 0>>
+					<<if App.Entity.facilities.brothel.employeesIDs().size > 2 || $Madam != 0>>
 						Since $he's low in the slave hierarchy, @@.mediumaquamarine;$he knows@@ that the rule that slaves must get consent before having sex with $him are all that protect $him from abuse.
 					<<else>>
 						Since $he's low in the slave hierarchy, @@.mediumaquamarine;$he knows@@ that the rule that slaves must get consent before having sex with $him are all that protect $him from abuse. Well, that and the fact $brothelName is rather empty.
@@ -708,7 +709,7 @@
 			<<if ($universalRulesConsent == 0)>>
 				<<if (_release.slaves === 1)>>
 					<<if ($slaves[$i].energy > 95)>>
-						<<if $ClubiIDs.length > 2>>
+						<<if App.Entity.facilities.club.employeesIDs().size > 2>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;adores@@ you for leaving plentiful, tantalizing, outlets for $his nymphomania under $his care.
 						<<else>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;eagerly awaits@@ the day you assign more sluts to $clubName.
@@ -716,14 +717,14 @@
 						<<set $slaves[$i].devotion += 1>>
 					<<elseif ($slaves[$i].fetishKnown == 1) && ($slaves[$i].fetishStrength > 60)>>
 						<<if ($slaves[$i].fetish == "sadist")>>
-							<<if $ClubiIDs.length > 2>>
+							<<if App.Entity.facilities.club.employeesIDs().size > 2>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;adores@@ you for providing a whole club of sluts for $him to rape.
 							<<else>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;eagerly awaits@@ the day you assign more sluts to $clubName for $him to rape.
 							<</if>>
 							<<set $slaves[$i].devotion += 1>>
 						<<elseif ($slaves[$i].fetish == "dom")>>
-							<<if $ClubiIDs.length > 2>>
+							<<if App.Entity.facilities.club.employeesIDs().size > 2>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;adores@@ you for allowing $him a club of sluts to dominate.
 							<<else>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;eagerly awaits@@the day you assign more sluts to $his domain.
@@ -977,7 +978,7 @@
 			<</if>>
 
 			<<if ($slaves[$i].devotion <= 20)>>
-				$He shares a room with <<if $ClubiIDs.length > 4>>some of <</if>>the other sluts, preventing $him from becoming too complacent. It doesn't help that during business hours $he has to take citizens in $his own bed.
+				$He shares a room with <<if App.Entity.facilities.club.employeesIDs().size > 4>>some of <</if>>the other sluts, preventing $him from becoming too complacent. It doesn't help that during business hours $he has to take citizens in $his own bed.
 			<<else>>
 				$He likes $his personal space in $clubName, even if <<if canSmell($slaves[$i])>>it smells of<<else>>it's filled with the heat from<</if>> sex and citizens.
 			<</if>>
@@ -1036,14 +1037,14 @@
 			<<if ($universalRulesConsent == 0)>>
 				<<if ($slaves[$i].devotion <= 20)>>
 					<<if ($slaves[$i].trust > -10)>>
-						<<if $ClubiIDs.length > 2 || $DJ != 0>>
+						<<if App.Entity.facilities.club.employeesIDs().size > 2 || $DJ != 0>>
 							Under the rules, $he finds $himself constantly molested by other slaves, and lives $his life constantly @@.gold;afraid.@@
 						<<else>>
 							Under the rules, $he is free game for other slaves to molest, and lives $his life constantly @@.gold;afraid@@ of the day you assign more sluts to $clubName.
 						<</if>>
 						<<set $slaves[$i].trust -= 2>>
 					<<else>>
-						<<if $ClubiIDs.length > 2 || $DJ != 0>>
+						<<if App.Entity.facilities.club.employeesIDs().size > 2 || $DJ != 0>>
 							Under the rules, $he finds $himself constantly molested by other slaves, but $he's already in such constant terror it doesn't seriously affect $him.
 						<<else>>
 							Under the rules, $he will someday find $himself constantly molested by other slaves, but $he's already in such constant terror it that it doesn't cross $his mind.
@@ -1051,7 +1052,7 @@
 					<</if>>
 				<<elseif (_release.slaves === 1)>>
 					<<if ($slaves[$i].energy > 95)>>
-						<<if $ClubiIDs.length > 2>>
+						<<if App.Entity.facilities.club.employeesIDs().size > 2>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;adores@@ you for providing plentiful outlets for $his nymphomania.
 						<<else>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;eagerly awaits@@ the day you assign more sluts to $clubName to get $him off.
@@ -1059,14 +1060,14 @@
 						<<set $slaves[$i].devotion += 1>>
 					<<elseif ($slaves[$i].fetishKnown == 1) && ($slaves[$i].fetishStrength > 60)>>
 						<<if ($slaves[$i].fetish == "sadist")>>
-							<<if $ClubiIDs.length > 2>>
+							<<if App.Entity.facilities.club.employeesIDs().size > 2>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;adores@@ you for providing a whole club of sluts for $him to rape.
 							<<else>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;eagerly awaits@@ the day you assign more sluts to $clubName for $him to rape.
 							<</if>>
 							<<set $slaves[$i].devotion += 1>>
 						<<elseif ($slaves[$i].fetish == "dom")>>
-							<<if $ClubiIDs.length > 2>>
+							<<if App.Entity.facilities.club.employeesIDs().size > 2>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;adores@@ you for providing a whole club of sluts for $him to dominate.
 							<<else>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;eagerly awaits@@ the day you assign more sluts to $clubName for $him to dominate.
@@ -1077,7 +1078,7 @@
 				<</if>>
 			<<else>>
 				<<if ($slaves[$i].devotion <= 20) && ($slaves[$i].devotion >= -20)>>
-					<<if $ClubiIDs.length > 2 || $DJ != 0>>
+					<<if App.Entity.facilities.club.employeesIDs().size > 2 || $DJ != 0>>
 						Since $he's low in the slave hierarchy, @@.mediumaquamarine;$he knows@@ that the rule that slaves must get consent before having sex with $him are all that protect $him from abuse.
 					<<else>>
 						Since $he's low in the slave hierarchy, @@.mediumaquamarine;$he knows@@ that the rule that slaves must get consent before having sex with $him are all that protect $him from abuse. Well, that and the fact $clubName is rather empty.
@@ -1194,7 +1195,7 @@
 				<</switch>>
 			<</if>>
 		<<case "be the Nurse">>
-			<<set $slaves[$i].need -= ($CliniciIDs.length*3)>>
+			<<set $slaves[$i].need -= (App.Entity.facilities.clinic.employeesIDs().size*3)>>
 			<<if $slaves[$i].energy <= 20>>
 				is frigid and has little interest in getting off<<if App.Utils.releaseRestricted($slaves[$i])>>, making the rule restricting $his sexual outlets superfluous<</if>>.
 				<<set $slaves[$i].need = 0>>
@@ -1639,7 +1640,7 @@
 				<</switch>>
 			<</if>>
 		<<case "be the Wardeness">>
-			<<set $slaves[$i].need -= ($CellBiIDs.length*5)>>
+			<<set $slaves[$i].need -= (_L.cellblock*5)>>
 			<<if $slaves[$i].energy <= 20>>
 				is frigid and has little interest in getting off<<if App.Utils.releaseRestricted($slaves[$i])>>, making the rule restricting $his sexual outlets superfluous<</if>>.
 				<<set $slaves[$i].need = 0>>
@@ -1737,7 +1738,7 @@
 					<<if $spa != 0>>
 						usually spends in $spaName<<if _S.Attendant>>, enjoying _S.Attendant.slaveName's care<</if>>.
 					<<else>>
-						usually spends relaxing in $his room<<if $CellBiIDs.length > 1>> teaching a disobedient slave how to properly use their mouth<</if>>.
+						usually spends relaxing in $his room<<if _L.cellblock > 1>> teaching a disobedient slave how to properly use their mouth<</if>>.
 					<</if>>
 					<<if $slaves[$i].relationship > 0>>
 						<<set $subSlave = getSlave($slaves[$i].relationshipTarget)>>
@@ -1924,7 +1925,7 @@
 				<</switch>>
 			<</if>>
 		<<case "be the Attendant">>
-			<<set $slaves[$i].need -= ($SpaiIDs.length*3)>>
+			<<set $slaves[$i].need -= (App.Entity.facilities.spa.employeesIDs().size*3)>>
 			<<if $slaves[$i].energy <= 20>>
 				is frigid and has little interest in getting off<<if App.Utils.releaseRestricted($slaves[$i])>>, making the rule restricting $his sexual outlets superfluous<</if>>.
 				<<set $slaves[$i].need = 0>>
@@ -1998,7 +1999,7 @@
 			<<if ($universalRulesConsent == 0)>>
 				<<if (_release.slaves === 1)>>
 					<<if ($slaves[$i].energy > 95)>>
-						<<if $SpaiIDs.length > 2>>
+						<<if App.Entity.facilities.spa.employeesIDs().size > 2>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;adores@@ you for all the warm, moist bodies lounging around $spaName.
 						<<else>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;eagerly awaits@@ the day more vulnerable slaves enter $spaName.
@@ -2006,14 +2007,14 @@
 						<<set $slaves[$i].devotion += 1>>
 					<<elseif ($slaves[$i].fetishKnown == 1) && ($slaves[$i].fetishStrength > 60)>>
 						<<if ($slaves[$i].fetish == "sadist")>>
-							<<if $SpaiIDs.length > 2>>
+							<<if App.Entity.facilities.spa.employeesIDs().size > 2>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;adores@@ you for providing all the warm, moist bodies lounging around $spaName.
 							<<else>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;eagerly awaits@@ the day more vulnerable slaves come to $spaName for $him to rape.
 							<</if>>
 							<<set $slaves[$i].devotion += 1>>
 						<<elseif ($slaves[$i].fetish == "dom")>>
-							<<if $SpaiIDs.length > 2>>
+							<<if App.Entity.facilities.spa.employeesIDs().size > 2>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;adores@@ you for allotting $him all the warm, moist bodies lounging around $spaName.
 							<<else>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;eagerly awaits@@ the day more vulnerable slaves enter $his domain.
@@ -2311,14 +2312,14 @@
 			<<if ($universalRulesConsent == 0)>>
 				<<if ($slaves[$i].devotion <= 20)>>
 					<<if ($slaves[$i].trust > -10)>>
-						<<if $SpaiIDs.length > 2>>
+						<<if App.Entity.facilities.spa.employeesIDs().size > 2>>
 							Under the rules, $he finds $himself constantly molested by other slaves, and lives $his life constantly @@.gold;afraid.@@
 						<<else>>
 							Under the rules, $he is free game for other slaves to molest, and lives $his life constantly @@.gold;afraid@@ of the day another slave grabs $him from under the water.
 						<</if>>
 						<<set $slaves[$i].trust -= 2>>
 					<<else>>
-						<<if $SpaiIDs.length > 2>>
+						<<if App.Entity.facilities.spa.employeesIDs().size > 2>>
 							Under the rules, $he finds $himself constantly molested by other slaves, but $he's already in such constant terror it doesn't seriously affect $him.
 						<<else>>
 							Under the rules, $he will someday find $himself constantly molested by other slaves, but $he's already in such constant terror it that it doesn't cross $his mind.
@@ -2326,7 +2327,7 @@
 					<</if>>
 				<<elseif (_release.slaves === 1)>>
 					<<if ($slaves[$i].energy > 95)>>
-						<<if $SpaiIDs.length > 2>>
+						<<if App.Entity.facilities.spa.employeesIDs().size > 2>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;adores@@ you for providing plentiful outlets for $his nymphomania.
 						<<else>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;eagerly awaits@@ the day <<if _S.Attendant>>more of your slaves join $him in the pool<<else>>you assign more slaves to $spaName to help $him relieve $his <<if $slaves[$i].balls > 0>>swollen balls<<else>>tension<</if>><</if>>.
@@ -2334,14 +2335,14 @@
 						<<set $slaves[$i].devotion += 1>>
 					<<elseif ($slaves[$i].fetishKnown == 1) && ($slaves[$i].fetishStrength > 60)>>
 						<<if ($slaves[$i].fetish == "sadist")>>
-							<<if $SpaiIDs.length > 2>>
+							<<if App.Entity.facilities.spa.employeesIDs().size > 2>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;adores@@ you for providing a whole pool of slaves for $him to rape.
 							<<else>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;eagerly awaits@@ the day <<if _S.Attendant>>more of your slaves join $him in the pool<<else>>you assign more slaves to $spaName to help $him unwind<</if>>.
 							<</if>>
 							<<set $slaves[$i].devotion += 1>>
 						<<elseif ($slaves[$i].fetish == "dom")>>
-							<<if $SpaiIDs.length > 2>>
+							<<if App.Entity.facilities.spa.employeesIDs().size > 2>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;adores@@ you for providing a whole pool of slaves for $him to dominate.
 							<<else>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;eagerly awaits@@ the day <<if _S.Attendant>>more of your slaves join $him in the pool<<else>>you assign more slaves to $spaName to help $him unwind<</if>>.
@@ -2352,7 +2353,7 @@
 				<</if>>
 			<<else>>
 				<<if ($slaves[$i].devotion <= 20) && ($slaves[$i].devotion >= -20)>>
-					<<if $SpaiIDs.length > 2>>
+					<<if App.Entity.facilities.spa.employeesIDs().size > 2>>
 						Since $he's low in the slave hierarchy, @@.mediumaquamarine;$he knows@@ that the rule that slaves must get consent before having sex with $him are all that protect $him from abuse.
 					<<else>>
 						Since $he's low in the slave hierarchy, @@.mediumaquamarine;$he knows@@ that the rule that slaves must get consent before having sex with $him are all that protect $him from abuse. Well, that and the fact $spaName is <<if _S.Attendant>>mostly frequented by other slaveowners' stock<<else>>$his little private sanctuary<</if>>.
@@ -2464,7 +2465,7 @@
 				<</switch>>
 			<</if>>
 		<<case "be the Matron">>
-			<<set $slaves[$i].need -= ($NurseryiIDs.length*3)>>
+			<<set $slaves[$i].need -= (_L.nursery*3)>>
 			<<if $slaves[$i].energy <= 20>>
 				is frigid and has little interest in getting off<<if App.Utils.releaseRestricted($slaves[$i])>>, making the rule restricting $his sexual outlets superfluous<</if>>.
 				<<set $slaves[$i].need = 0>>
@@ -2535,7 +2536,7 @@
 			<<if ($universalRulesConsent == 0)>>
 				<<if (_release.slaves === 1)>>
 					<<if ($slaves[$i].energy > 95)>>
-						<<if $NurseryiIDs.length > 2>>
+						<<if _L.nursery > 2>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;adores@@ you for all the nannies busily scurrying around $nurseryName.
 						<<else>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;eagerly awaits@@ the day more vulnerable slaves enter $nurseryName.
@@ -2543,14 +2544,14 @@
 						<<set $slaves[$i].devotion += 1>>
 					<<elseif ($slaves[$i].fetishKnown == 1) && ($slaves[$i].fetishStrength > 60)>>
 						<<if ($slaves[$i].fetish == "sadist")>>
-							<<if $NurseryiIDs.length > 2>>
+							<<if _L.nursery > 2>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;adores@@ you for providing all the nannies busily scurrying around $nurseryName.
 							<<else>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;eagerly awaits@@ the day more vulnerable slaves come to $nurseryName for $him to rape.
 							<</if>>
 							<<set $slaves[$i].devotion += 1>>
 						<<elseif ($slaves[$i].fetish == "dom")>>
-							<<if $NurseryiIDs.length > 2>>
+							<<if _L.nursery > 2>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;adores@@ you for allotting $him all the nannies busily scurrying around $nurseryName.
 							<<else>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;eagerly awaits@@ the day more vulnerable slaves enter $his domain.
@@ -2848,14 +2849,14 @@
 			<<if ($universalRulesConsent == 0)>>
 				<<if ($slaves[$i].devotion <= 20)>>
 					<<if ($slaves[$i].trust > -10)>>
-						<<if $NurseryiIDs.length > 2>>
+						<<if _L.nursery > 2>>
 							Under the rules, $he finds $himself constantly molested by other slaves, and lives $his life constantly @@.gold;afraid.@@
 						<<else>>
 							Under the rules, $he is free game for other slaves to molest, and lives $his life constantly @@.gold;afraid@@ of the day another slave grabs $him from under the water.
 						<</if>>
 						<<set $slaves[$i].trust -= 2>>
 					<<else>>
-						<<if $NurseryiIDs.length > 2>>
+						<<if _L.nursery > 2>>
 							Under the rules, $he finds $himself constantly molested by other slaves, but $he's already in such constant terror it doesn't seriously affect $him.
 						<<else>>
 							Under the rules, $he will someday find $himself constantly molested by other slaves, but $he's already in such constant terror it that it doesn't cross $his mind.
@@ -2863,7 +2864,7 @@
 					<</if>>
 				<<elseif (_release.slaves === 1)>>
 					<<if ($slaves[$i].energy > 95)>>
-						<<if $NurseryiIDs.length > 2>>
+						<<if _L.nursery > 2>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;adores@@ you for providing plentiful outlets for $his nymphomania.
 						<<else>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;eagerly awaits@@ the day <<if $Matron != 0>>more of your slaves join $him in $nurseryName <<else>>you assign more nurses to $nurseryName to help $him relieve $his <<if $slaves[$i].balls > 0>>swollen balls<<else>>tension<</if>><</if>>.
@@ -2871,14 +2872,14 @@
 						<<set $slaves[$i].devotion += 1>>
 					<<elseif ($slaves[$i].fetishKnown == 1) && ($slaves[$i].fetishStrength > 60)>>
 						<<if ($slaves[$i].fetish == "sadist")>>
-							<<if $NurseryiIDs.length > 2>>
+							<<if _L.nursery > 2>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;adores@@ you for providing a whole nursery of slaves for $him to rape.
 							<<else>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;eagerly awaits@@ the day <<if $Matron != 0>>more of your slaves join $him in $nurseryName <<else>>you assign more nurses to $nurseryName to help $him unwind<</if>>.
 							<</if>>
 							<<set $slaves[$i].devotion += 1>>
 						<<elseif ($slaves[$i].fetish == "dom")>>
-							<<if $NurseryiIDs.length > 2>>
+							<<if _L.nursery > 2>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;adores@@ you for providing a whole nursery of slaves for $him to dominate.
 							<<else>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;eagerly awaits@@ the day <<if $Matron != 0>>more of your slaves join $him in $nurseryName <<else>>you assign more nurses to $nurseryName to help $him unwind<</if>>.
@@ -2889,7 +2890,7 @@
 				<</if>>
 			<<else>>
 				<<if ($slaves[$i].devotion <= 20) && ($slaves[$i].devotion >= -20)>>
-					<<if $NurseryiIDs.length > 2>>
+					<<if _L.nursery > 2>>
 						Since $he's low in the slave hierarchy, @@.mediumaquamarine;$he knows@@ that the rule that slaves must get consent before having sex with $him are all that protect $him from abuse.
 					<<else>>
 						Since $he's low in the slave hierarchy, @@.mediumaquamarine;$he knows@@ that the rule that slaves must get consent before having sex with $him are all that protect $him from abuse. Well, that and the fact $nurseryName is <<if $Matron != 0>>mostly frequented by other slaveowners' stock<<else>>$his little private sanctuary<</if>>.
@@ -3006,8 +3007,8 @@
 				<</switch>>
 			<</if>>
 		<<case "be the Schoolteacher">>
-			<<set $slaves[$i].need -= $SchlRiIDs.length*10>>
-			<<set _sexLessons = $SchlRiIDs.length*2>>
+			<<set $slaves[$i].need -= _L.schoolroom*10>>
+			<<set _sexLessons = _L.schoolroom*2>>
 			<<if canDoVaginal($slaves[$i]) && $slaves[$i].vagina != 0>>
 				<<set $slaves[$i].counter.vaginal += _sexLessons, $vaginalTotal += _sexLessons>>
 			<</if>>
@@ -3089,7 +3090,7 @@
 			<<if ($universalRulesConsent == 0)>>
 				<<if (_release.slaves === 1)>>
 					<<if ($slaves[$i].energy > 95)>>
-						<<if $SchlRiIDs.length > 2>>
+						<<if _L.schoolroom > 2>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;adores@@ you for giving $him plentiful teacher's assistants for $his nymphomania.
 						<<else>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;eagerly awaits@@ the day more of your slaves enroll in $schoolroomName.
@@ -3097,14 +3098,14 @@
 						<<set $slaves[$i].devotion += 1>>
 					<<elseif ($slaves[$i].fetishKnown == 1) && ($slaves[$i].fetishStrength > 60)>>
 						<<if ($slaves[$i].fetish == "sadist")>>
-							<<if $SchlRiIDs.length > 2>>
+							<<if _L.schoolroom > 2>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;adores@@ you for providing a whole class of students for $him to rape lessons into.
 							<<else>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;eagerly awaits@@ the day more of your slaves enroll in $schoolroomName.
 							<</if>>
 							<<set $slaves[$i].devotion += 1>>
 						<<elseif ($slaves[$i].fetish == "dom")>>
-							<<if $SchlRiIDs.length > 2>>
+							<<if _L.schoolroom > 2>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;adores@@ you for providing a whole class of students to demonstrate proper submission with.
 							<<else>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;eagerly awaits@@ the day more of your slaves enroll in $schoolroomName.
@@ -3152,7 +3153,7 @@
 					<<if $spa != 0>>
 						usually spends in $spaName<<if $AttendantID != 0>>, enjoying _S.Attendant.slaveName's care<</if>>.
 					<<else>>
-						usually spends relaxing in $his room<<if $SchlRiIDs.length > 1>> giving private lessons to a student<</if>>.
+						usually spends relaxing in $his room<<if _L.schoolroom > 1>> giving private lessons to a student<</if>>.
 					<</if>>
 					<<if $slaves[$i].relationship > 0>>
 						<<set $subSlave = getSlave($slaves[$i].relationshipTarget)>>
@@ -3389,14 +3390,14 @@
 			<<if ($universalRulesConsent == 0)>>
 				<<if ($slaves[$i].devotion <= 20)>>
 					<<if ($slaves[$i].trust > -10)>>
-						<<if $SchlRiIDs.length > 2 || $Schoolteacher != 0>>
+						<<if _L.schoolroom > 2 || $Schoolteacher != 0>>
 							Under the rules, $he finds $himself constantly molested by other slaves, and lives $his life constantly @@.gold;afraid.@@
 						<<else>>
 							Under the rules, $he is free game for other slaves to molest, and lives $his life constantly @@.gold;afraid@@ of the day more students enroll in $schoolroomName.
 						<</if>>
 						<<set $slaves[$i].trust -= 2>>
 					<<else>>
-						<<if $SchlRiIDs.length > 2 || $Schoolteacher != 0>>
+						<<if _L.schoolroom > 2 || $Schoolteacher != 0>>
 							Under the rules, $he finds $himself constantly molested by other slaves, but $he's already in such constant terror it doesn't seriously affect $him.
 						<<else>>
 							Under the rules, $he will someday find $himself constantly molested by other slaves, but $he's already in such constant terror it that it doesn't cross $his mind.
@@ -3404,7 +3405,7 @@
 					<</if>>
 				<<elseif (_release.slaves === 1)>>
 					<<if ($slaves[$i].energy > 95)>>
-						<<if $SchlRiIDs.length > 2>>
+						<<if _L.schoolroom > 2>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;adores@@ you for providing plentiful outlets for $his nymphomania.
 						<<else>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;eagerly awaits@@ the day more students enroll in $schoolroomName to get $him off.
@@ -3412,14 +3413,14 @@
 						<<set $slaves[$i].devotion += 1>>
 					<<elseif ($slaves[$i].fetishKnown == 1) && ($slaves[$i].fetishStrength > 60)>>
 						<<if ($slaves[$i].fetish == "sadist")>>
-							<<if $SchlRiIDs.length > 2>>
+							<<if _L.schoolroom > 2>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;adores@@ you for providing a whole class of students for $him to rape.
 							<<else>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;eagerly awaits@@ the day more students enroll in $schoolroomName for $him to rape.
 							<</if>>
 							<<set $slaves[$i].devotion += 1>>
 						<<elseif ($slaves[$i].fetish == "dom")>>
-							<<if $SchlRiIDs.length > 2>>
+							<<if _L.schoolroom > 2>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;adores@@ you for providing a whole class of students for $him to dominate.
 							<<else>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;eagerly awaits@@ the day more students enroll in $schoolroomName for $him to dominate.
@@ -3430,7 +3431,7 @@
 				<</if>>
 			<<else>>
 				<<if ($slaves[$i].devotion <= 20) && ($slaves[$i].devotion >= -20)>>
-					<<if $SchlRiIDs.length > 2 || $Schoolteacher != 0>>
+					<<if _L.schoolroom > 2 || $Schoolteacher != 0>>
 						Since $he's low in the slave hierarchy, @@.mediumaquamarine;$he knows@@ that the rule that slaves must get consent before having sex with $him are all that protect $him from abuse.
 					<<else>>
 						Since $he's low in the slave hierarchy, @@.mediumaquamarine;$he knows@@ that the rule that slaves must get consent before having sex with $him are all that protect $him from abuse. Well, that and the fact $schoolroomName is rather empty.
@@ -3547,7 +3548,7 @@
 				<</switch>>
 			<</if>>
 		<<case "be the Stewardess">>
-			<<set $slaves[$i].need -= $ServQiIDs.length*10>>
+			<<set $slaves[$i].need -= _L.servantsQuarters*10>>
 			<<if $slaves[$i].energy <= 20>>
 				is frigid and has little interest in getting off<<if App.Utils.releaseRestricted($slaves[$i])>>, making the rule restricting $his sexual outlets superfluous<</if>>.
 				<<set $slaves[$i].need = 0>>
@@ -3620,7 +3621,7 @@
 			<<if ($universalRulesConsent == 0)>>
 				<<if (_release.slaves === 1)>>
 					<<if ($slaves[$i].energy > 95)>>
-						<<if $ServQiIDs.length > 2>>
+						<<if _L.servantsQuarters > 2>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;adores@@ you for leaving plentiful outlets for $his nymphomania under $his charge.
 						<<else>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;eagerly awaits@@ the day you assign more maids to $servantsQuartersName.
@@ -3628,14 +3629,14 @@
 						<<set $slaves[$i].devotion += 1>>
 					<<elseif ($slaves[$i].fetishKnown == 1) && ($slaves[$i].fetishStrength > 60)>>
 						<<if ($slaves[$i].fetish == "sadist")>>
-							<<if $ServQiIDs.length > 2>>
+							<<if _L.servantsQuarters > 2>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;adores@@ you for providing so many maids for $him to rape.
 							<<else>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;eagerly awaits@@ the day you assign more maids to $servantsQuartersName for $him to rape.
 							<</if>>
 							<<set $slaves[$i].devotion += 1>>
 						<<elseif ($slaves[$i].fetish == "dom")>>
-							<<if $ServQiIDs.length > 2>>
+							<<if _L.servantsQuarters > 2>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;adores@@ you for allowing $him so many maids to dominate.
 							<<else>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;eagerly awaits@@ the day you assign more maids to $his domain.
@@ -3683,7 +3684,7 @@
 					<<if $spa != 0>>
 						usually spends in $spaName<<if _S.Attendant>>, enjoying _S.Attendant.slaveName's care<</if>>.
 					<<else>>
-						usually spends relaxing in $his room<<if $ServQiIDs.length > 1>> while enjoying some service from $his underlings<</if>>.
+						usually spends relaxing in $his room<<if _L.servantsQuarters > 1>> while enjoying some service from $his underlings<</if>>.
 					<</if>>
 					<<if $slaves[$i].relationship > 0>>
 						<<set $subSlave = getSlave($slaves[$i].relationshipTarget)>>
@@ -4141,7 +4142,7 @@
 				<</switch>>
 			<</if>>
 		<<case "be the Milkmaid">>
-			<<set $slaves[$i].need -= $DairyiIDs.length*5>>
+			<<set $slaves[$i].need -= _L.dairy*5>>
 			<<if $slaves[$i].energy <= 20>>
 				is frigid and has little interest in getting off<<if App.Utils.releaseRestricted($slaves[$i])>>, making the rule restricting $his sexual outlets superfluous<</if>>.
 				<<set $slaves[$i].need = 0>>
@@ -4213,7 +4214,7 @@
 			<<if ($universalRulesConsent == 0)>>
 				<<if (_release.slaves === 1)>>
 					<<if ($slaves[$i].energy > 95)>>
-						<<if $DairyiIDs.length > 2>>
+						<<if _L.dairy > 2>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;adores@@ you for leaving plentiful outlets for $his nymphomania under $his charge.
 						<<else>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;eagerly awaits@@ the day you assign more cows to $dairyName.
@@ -4221,14 +4222,14 @@
 						<<set $slaves[$i].devotion += 1>>
 					<<elseif ($slaves[$i].fetishKnown == 1) && ($slaves[$i].fetishStrength > 60)>>
 						<<if ($slaves[$i].fetish == "sadist")>>
-							<<if $DairyiIDs.length > 2>>
+							<<if _L.dairy > 2>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;adores@@ you for providing so many cows for $him to rape.
 							<<else>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;eagerly awaits@@ the day you assign more cows to $dairyName for $him to rape.
 							<</if>>
 							<<set $slaves[$i].devotion += 1>>
 						<<elseif ($slaves[$i].fetish == "dom")>>
-							<<if $DairyiIDs.length > 2>>
+							<<if _L.dairy > 2>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;adores@@ you for allowing $him so many cows to dominate.
 							<<else>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;eagerly awaits@@ the day you assign more cows to $his domain.
@@ -4271,7 +4272,7 @@
 					<<if $spa != 0>>
 						usually spends in $spaName<<if _S.Attendant>>, enjoying _S.Attendant.slaveName's care<</if>>.
 					<<else>>
-						usually spends relaxing in $his room<<if $DairyiIDs.length > 1>> with the softest cow available<</if>>.
+						usually spends relaxing in $his room<<if _L.dairy > 1>> with the softest cow available<</if>>.
 					<</if>>
 					<<if $slaves[$i].relationship > 0>>
 						<<set $subSlave = getSlave($slaves[$i].relationshipTarget)>>
@@ -4573,14 +4574,14 @@
 					<<if ($universalRulesConsent == 0)>>
 						<<if ($slaves[$i].devotion <= 20)>>
 							<<if ($slaves[$i].trust > -10)>>
-								<<if $DairyiIDs.length > 2 || $Milkmaid != 0>>
+								<<if _L.dairy > 2 || $Milkmaid != 0>>
 									Under the rules, $he finds $himself constantly molested by other slaves, and lives $his life constantly @@.gold;afraid.@@
 								<<else>>
 									Under the rules, $he is free game for other slaves to molest, and lives $his life constantly @@.gold;afraid@@ of the day you assign more cows to $dairyName.
 								<</if>>
 								<<set $slaves[$i].trust -= 2>>
 							<<else>>
-								<<if $DairyiIDs.length > 2 || $Milkmaid != 0>>
+								<<if _L.dairy > 2 || $Milkmaid != 0>>
 									Under the rules, $he finds $himself constantly molested by other slaves, but $he's already in such constant terror it doesn't seriously affect $him.
 								<<else>>
 									Under the rules, $he will someday find $himself constantly molested by other slaves, but $he's already in such constant terror it that it doesn't cross $his mind.
@@ -4588,7 +4589,7 @@
 							<</if>>
 						<<elseif (_release.slaves === 1)>>
 							<<if ($slaves[$i].energy > 95)>>
-								<<if $DairyiIDs.length > 2>>
+								<<if _L.dairy > 2>>
 									Under the rules, $he's allowed to demand that other slaves to get $him off, and $he @@.hotpink;adores@@ you for providing plentiful outlets for $his nymphomania.
 								<<else>>
 									Under the rules, $he's allowed to demand that other slaves to get $him off, and $he @@.hotpink;eagerly awaits@@ the day you assign more cows to $dairyName to get $him off.
@@ -4596,14 +4597,14 @@
 								<<set $slaves[$i].devotion += 1>>
 							<<elseif ($slaves[$i].fetishKnown == 1) && ($slaves[$i].fetishStrength > 60)>>
 								<<if ($slaves[$i].fetish == "sadist")>>
-									<<if $DairyiIDs.length > 2>>
+									<<if _L.dairy > 2>>
 										Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;adores@@ you for providing a whole dairy of cows for $him to rape.
 									<<else>>
 										Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;eagerly awaits@@ the day you assign more cows to $dairyName for $him to rape.
 									<</if>>
 									<<set $slaves[$i].devotion += 1>>
 								<<elseif ($slaves[$i].fetish == "dom")>>
-									<<if $DairyiIDs.length > 2>>
+									<<if _L.dairy > 2>>
 										Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;adores@@ you for providing a whole dairy of cows for $him to dominate.
 									<<else>>
 										Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;eagerly awaits@@ the day you assign more cows to $dairyName for $him to dominate.
@@ -4614,7 +4615,7 @@
 						<</if>>
 					<<else>>
 						<<if ($slaves[$i].devotion <= 20) && ($slaves[$i].devotion >= -20)>>
-							<<if $DairyiIDs.length > 2 || $Milkmaid != 0>>
+							<<if _L.dairy > 2 || $Milkmaid != 0>>
 								Since $he's low in the slave hierarchy, @@.mediumaquamarine;$he knows@@ that the rule that slaves must get consent before having sex with $him are all that protect $him from abuse.
 							<<else>>
 								Since $he's low in the slave hierarchy, @@.mediumaquamarine;$he knows@@ that the rule that slaves must get consent before having sex with $him are all that protect $him from abuse. Well, that and the fact $dairyName is rather empty.
@@ -4727,7 +4728,7 @@
 					<</if>>
 			<</if>>
 		<<case "be the Farmer">>
-			<<set $slaves[$i].need -= $FarmyardiIDs.length*5>>
+			<<set $slaves[$i].need -= _L.farmyard*5>>
 			<<if $slaves[$i].energy <= 20>>
 				is frigid and has little interest in getting off<<if App.Utils.releaseRestricted($slaves[$i])>>, making the rule restricting $his sexual outlets superfluous<</if>>.
 				<<set $slaves[$i].need = 0>>
@@ -4799,7 +4800,7 @@
 			<<if ($universalRulesConsent == 0)>>
 				<<if (_release.slaves === 1)>>
 					<<if ($slaves[$i].energy > 95)>>
-						<<if $FarmyardiIDs.length > 2>>
+						<<if _L.farmyard > 2>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;adores@@ you for leaving plentiful outlets for $his nymphomania under $his charge.
 						<<else>>
 							Under the rules, $he's allowed to demand that other slaves get $him off, and $he @@.hotpink;eagerly awaits@@ the day you assign more cows to $farmyardName.
@@ -4807,14 +4808,14 @@
 						<<set $slaves[$i].devotion += 1>>
 					<<elseif ($slaves[$i].fetishKnown == 1) && ($slaves[$i].fetishStrength > 60)>>
 						<<if ($slaves[$i].fetish == "sadist")>>
-							<<if $FarmyardiIDs.length > 2>>
+							<<if _L.farmyard > 2>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;adores@@ you for providing so many cows for $him to rape.
 							<<else>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;eagerly awaits@@ the day you assign more cows to $farmyardName for $him to rape.
 							<</if>>
 							<<set $slaves[$i].devotion += 1>>
 						<<elseif ($slaves[$i].fetish == "dom")>>
-							<<if $FarmyardiIDs.length > 2>>
+							<<if _L.farmyard > 2>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;adores@@ you for allowing $him so many cows to dominate.
 							<<else>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;eagerly awaits@@ the day you assign more cows to $his domain.
@@ -4862,7 +4863,7 @@
 					<<if $spa != 0>>
 						usually spends in $spaName<<if _S.Attendant>>, enjoying _S.Attendant.slaveName's care<</if>>.
 					<<else>>
-						usually spends relaxing in $his room<<if $FarmyardiIDs.length > 1>> with the softest cow available<</if>>.
+						usually spends relaxing in $his room<<if _L.farmyard > 1>> with the softest cow available<</if>>.
 					<</if>>
 					<<if $slaves[$i].relationship > 0>>
 						<<set $subSlave = getSlave($slaves[$i].relationshipTarget)>>
@@ -5146,14 +5147,14 @@
 			<<if ($universalRulesConsent == 0)>>
 				<<if ($slaves[$i].devotion <= 20)>>
 					<<if ($slaves[$i].trust > -10)>>
-						<<if $FarmyardiIDs.length > 2 || $Farmer != 0>>
+						<<if _L.farmyard > 2 || $Farmer != 0>>
 							Under the rules, $he finds $himself constantly molested by other slaves, and lives $his life constantly @@.gold;afraid.@@
 						<<else>>
 							Under the rules, $he is free game for other slaves to molest, and lives $his life constantly @@.gold;afraid@@ of the day you assign more cows to $farmyardName.
 						<</if>>
 						<<set $slaves[$i].trust -= 2>>
 					<<else>>
-						<<if $FarmyardiIDs.length > 2 || $Farmer != 0>>
+						<<if _L.farmyard > 2 || $Farmer != 0>>
 							Under the rules, $he finds $himself constantly molested by other slaves, but $he's already in such constant terror it doesn't seriously affect $him.
 						<<else>>
 							Under the rules, $he will someday find $himself constantly molested by other slaves, but $he's already in such constant terror it that it doesn't cross $his mind.
@@ -5161,7 +5162,7 @@
 					<</if>>
 				<<elseif (_release.slaves === 1)>>
 					<<if ($slaves[$i].energy > 95)>>
-						<<if $FarmyardiIDs.length > 2>>
+						<<if _L.farmyard > 2>>
 							Under the rules, $he's allowed to demand that other slaves to get $him off, and $he @@.hotpink;adores@@ you for providing plentiful outlets for $his nymphomania.
 						<<else>>
 							Under the rules, $he's allowed to demand that other slaves to get $him off, and $he @@.hotpink;eagerly awaits@@ the day you assign more slaves to $farmyardName to get $him off.
@@ -5169,14 +5170,14 @@
 						<<set $slaves[$i].devotion += 1>>
 					<<elseif ($slaves[$i].fetishKnown == 1) && ($slaves[$i].fetishStrength > 60)>>
 						<<if ($slaves[$i].fetish == "sadist")>>
-							<<if $FarmyardiIDs.length > 2>>
+							<<if _L.farmyard > 2>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;adores@@ you for providing a whole farmyard of slaves for $him to rape.
 							<<else>>
 								Under the rules, $he's allowed to sexually abuse other slaves, and $he @@.hotpink;eagerly awaits@@ the day you assign more slaves to $farmyardName for $him to rape.
 							<</if>>
 							<<set $slaves[$i].devotion += 1>>
 						<<elseif ($slaves[$i].fetish == "dom")>>
-							<<if $FarmyardiIDs.length > 2>>
+							<<if _L.farmyard > 2>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;adores@@ you for providing a whole farmyard of slaves for $him to dominate.
 							<<else>>
 								Under the rules, $he's allowed to force other slaves to have sex with $him, and $he @@.hotpink;eagerly awaits@@ the day you assign more slaves to $farmyardName for $him to dominate.
@@ -5187,7 +5188,7 @@
 				<</if>>
 			<<else>>
 				<<if ($slaves[$i].devotion <= 20) && ($slaves[$i].devotion >= -20)>>
-					<<if $FarmyardiIDs.length > 2 || $Farmer != 0>>
+					<<if _L.farmyard > 2 || $Farmer != 0>>
 						Since $he's low in the slave hierarchy, @@.mediumaquamarine;$he knows@@ that the rule that slaves must get consent before having sex with $him are all that protect $him from abuse.
 					<<else>>
 						Since $he's low in the slave hierarchy, @@.mediumaquamarine;$he knows@@ that the rule that slaves must get consent before having sex with $him are all that protect $him from abuse. Well, that and the fact $farmyardName is rather empty.
@@ -5377,7 +5378,7 @@
 			<<elseif $slaves[$i].energy <= 20>>
 				is frigid and has little interest in getting off.
 				<<set $slaves[$i].need = 0>>
-			<<elseif $masterSuiteUpgradeLuxury == 2 && $MastSiIDs.length > 3>>
+			<<elseif $masterSuiteUpgradeLuxury == 2 && _L.masterSuite > 3>>
 				never goes unsatisfied with all the action in the fuckpit.
 				<<set $slaves[$i].need -= 80>>
 			<<elseif $slaves[$i].need < $slaves[$i].needCap*0.5>>
diff --git a/src/uncategorized/schoolroom.tw b/src/uncategorized/schoolroom.tw
index 24e18f341202ebdbcff81d88a8c76223ef470e75..10a3d7834fddf87a7d1b353fe1588b0c8537a7cd 100644
--- a/src/uncategorized/schoolroom.tw
+++ b/src/uncategorized/schoolroom.tw
@@ -1,6 +1,6 @@
 :: Schoolroom [nobr]
 
-<<set $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Schoolroom", $showEncyclopedia = 1, $encyclopedia = "Schoolroom">>
+<<set _DL = App.Entity.facilities.schoolroom.employeesIDs().size, $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Schoolroom", $showEncyclopedia = 1, $encyclopedia = "Schoolroom">>
 
 <<if $schoolroomName != "the Schoolroom">>
 	<<set $schoolroomNameCaps = $schoolroomName.replace("the ", "The ")>>
@@ -68,9 +68,9 @@
 			reviewing the often complex subject of how to address citizens other that one's owner.
 	<</switch>>
 
-	<<if $SchlRiIDs.length > 2>>
+	<<if _DL > 2>>
 		$schoolroomNameCaps is busy with slaves, repeating their lessons out loud to drill the instruction home. A few students are maintaining uncomfortable positions in the corner as punishment for poor work.
-	<<elseif $SchlRiIDs.length > 0>>
+	<<elseif _DL > 0>>
 		$schoolroomNameCaps is sparsely populated, the few students repeating their lessons out loud to drill the instruction home. One slave is maintaining an uncomfortable position in the corner as punishment for poor work.
 	<<elseif $Schoolteacher != 0>>
 		<<setLocalPronouns $Schoolteacher>>
@@ -85,7 +85,7 @@
 
 <div>
 	<<set _Tmult0 = Math.trunc($schoolroom*1000*$upgradeMultiplierArcology)>>
-	$schoolroomNameCaps has room to house $schoolroom slaves while they learn. There <<if $SchlRiIDs.length == 1>>is<<else>>are<</if>> currently $SchlRiIDs.length slave<<if $SchlRiIDs.length != 1>>s<</if>> learning in $schoolroomName.
+	$schoolroomNameCaps has room to house $schoolroom slaves while they learn. There <<if _DL == 1>>is<<else>>are<</if>> currently _DL slave<<if _DL != 1>>s<</if>> learning in $schoolroomName.
 	<div class="choices">
 		[[Expand the schoolroom|Schoolroom][cashX(forceNeg(_Tmult0), "capEx"), $schoolroom += 5, $PC.skill.engineering += .1]]
 		<span class="note">
@@ -93,7 +93,7 @@
 		</span>
 	</div>
 	<div class="choices">
-		<<if $SchlRiIDs.length > 0>>
+		<<if _DL > 0>>
 			<<removeFacilityWorkers "schoolroom" "rest" "take classes">>
 		<</if>>
 	</div>
diff --git a/src/uncategorized/schoolroomReport.tw b/src/uncategorized/schoolroomReport.tw
index c778ddf545888b762602090dca7322d4c6999157..329c301d27b25866e673b90a6b412689add547a9 100644
--- a/src/uncategorized/schoolroomReport.tw
+++ b/src/uncategorized/schoolroomReport.tw
@@ -1,7 +1,7 @@
 :: Schoolroom Report [nobr]
 
-<<SlaveIDSort $SchlRiIDs>>
-<<set _DL = $SchlRiIDs.length, _SL = $slaves.length, _idleBonus = 0, _FLsFetish = 0>>
+<<set _slaves = App.Utils.sortedEmployees(App.Entity.facilities.schoolroom)>>
+<<set _DL = _slaves.length, _SL = $slaves.length, _idleBonus = 0, _FLsFetish = 0>>
 
 <<if $schoolroomDecoration != "standard">>
 	<<set _devBonus = 1>>
@@ -75,21 +75,21 @@
 		$His students want to be just like their beautiful teacher.
 		<<set _idleBonus++>>
 	<</if>>
-	<<for _dI = 0; _dI < _DL; _dI++>>
-		<<set $i = $slaveIndices[$SchlRiIDs[_dI]]>>
-		<<setLocalPronouns $slaves[$i] 2>>
-		<<if $Schoolteacher.rivalryTarget == $slaves[$i].ID>>
-			Ever since $his <<print rivalryTerm($Schoolteacher)>> was enrolled, $he began stalking the classroom carrying a large paddle, much to $slaves[$i].slaveName's terror.
-			<<set $slaves[$i].devotion -= 4, $slaves[$i].trust -= 4>>
+	<<for _slave range _slaves>>
+		<<set $i = $slaveIndices[_slave.ID]>>
+		<<setLocalPronouns _slave 2>>
+		<<if $Schoolteacher.rivalryTarget == _slave.ID>>
+			Ever since $his <<print rivalryTerm($Schoolteacher)>> was enrolled, $he began stalking the classroom carrying a large paddle, much to _slave.slaveName's terror.
+			<<set _slave.devotion -= 4, _slave.trust -= 4>>
 			<<if random(1,100) > 35>>
-				<<set $Schoolteacher.rivalry++, $slaves[_FLs].rivalry++, $slaves[$i].rivalry++>>
+				<<set $Schoolteacher.rivalry++, $slaves[_FLs].rivalry++, _slave.rivalry++>>
 			<</if>>
-		<<elseif $Schoolteacher.relationshipTarget == $slaves[$i].ID>>
-			$He dedicates most of $his attention to $his <<print relationshipTerm($Schoolteacher)>>, $slaves[$i].slaveName, making sure _he2 understands that day's lesson.
-			<<set $slaves[$i].devotion += 2, $slaves[$i].trust += 2>>
-		<<elseif areRelated($Schoolteacher, $slaves[$i])>>
-			$He makes sure to spend extra time teaching $his <<print relativeTerm($Schoolteacher,$slaves[$i])>>, $slaves[$i].slaveName.
-			<<set $slaves[$i].trust++>>
+		<<elseif $Schoolteacher.relationshipTarget == _slave.ID>>
+			$He dedicates most of $his attention to $his <<print relationshipTerm($Schoolteacher)>>, _slave.slaveName, making sure _he2 understands that day's lesson.
+			<<set _slave.devotion += 2, _slave.trust += 2>>
+		<<elseif areRelated($Schoolteacher, _slave)>>
+			$He makes sure to spend extra time teaching $his <<print relativeTerm($Schoolteacher,_slave)>>, _slave.slaveName.
+			<<set _slave.trust++>>
 		<</if>>
 	<</for>>
 	<<if (_DL < $schoolroom)>>
@@ -143,59 +143,59 @@
 <</if>>
 
 <<set _restedSlaves = 0>>
-<<for _dI = 0; _dI < _DL; _dI++>>
-	<<set $i = $slaveIndices[$SchlRiIDs[_dI]]>>
-	<<setLocalPronouns $slaves[$i] 2>>
-	<<set $slaves[$i].devotion += _devBonus>>
-	<<if ($slaves[$i].health.condition < -80)>>
-		<<run improveCondition($slaves[$i], 20)>>
-	<<elseif ($slaves[$i].health.condition < -40)>>
-		<<run improveCondition($slaves[$i], 10)>>
-	<<elseif ($slaves[$i].health.condition < 0)>>
-		<<run improveCondition($slaves[$i], 7)>>
-	<<elseif ($slaves[$i].health.condition < 90)>>
-		<<run improveCondition($slaves[$i], 3)>>
+<<for _slave range _slaves>>
+	<<set $i = $slaveIndices[_slave.ID]>>
+	<<setLocalPronouns _slave 2>>
+	<<set _slave.devotion += _devBonus>>
+	<<if (_slave.health.condition < -80)>>
+		<<run improveCondition(_slave, 20)>>
+	<<elseif (_slave.health.condition < -40)>>
+		<<run improveCondition(_slave, 10)>>
+	<<elseif (_slave.health.condition < 0)>>
+		<<run improveCondition(_slave, 7)>>
+	<<elseif (_slave.health.condition < 90)>>
+		<<run improveCondition(_slave, 3)>>
 	<</if>>
-	<<if $slaves[$i].rules.living != "normal">>
-		<<set $slaves[$i].rules.living = "normal">>
+	<<if _slave.rules.living != "normal">>
+		<<set _slave.rules.living = "normal">>
 	<</if>>
 	/% Education done? Has to be here before we run the SA's or there will be double entries for slave %/
-	<<if $slaves[$i].fetish == "mindbroken">>
-		<<if $assignmentRecords[$slaves[$i].ID]>>
-			<<= assignJobSafely($slaves[$i], $assignmentRecords[$slaves[$i].ID])>>
+	<<if _slave.fetish == "mindbroken">>
+		<<if $assignmentRecords[_slave.ID]>>
+			<<= assignJobSafely(_slave, $assignmentRecords[_slave.ID])>>
 		<<else>>
-			<<= removeJob($slaves[$i], "learn in the schoolroom")>>
+			<<= removeJob(_slave, "learn in the schoolroom")>>
 		<</if>>
 		<<set _restedSlaves++, _dI--, _DL-->>
 		<<continue>>
 	<<else>>
-		<<if ($slaves[$i].intelligenceImplant >= 30 && $schoolroomRemodelBimbo != 1) || ($slaves[$i].intelligenceImplant <= -15 && $schoolroomRemodelBimbo == 1)>>
-		<<if ($slaves[$i].voice == 0) || ($slaves[$i].accent <= 1) || (($schoolroomUpgradeLanguage == 0) && ($slaves[$i].accent <= 2))>>
-		<<if ($slaves[$i].skill.oral > 30) || (($schoolroomUpgradeSkills == 0) && ($slaves[$i].skill.oral > 10))>>
-		<<if ($slaves[$i].skill.whoring > 30) || (($schoolroomUpgradeSkills == 0) && ($slaves[$i].skill.whoring > 10))>>
-		<<if ($slaves[$i].skill.entertainment > 30) || (($schoolroomUpgradeSkills == 0) && ($slaves[$i].skill.entertainment > 10))>>
-		<<if ($slaves[$i].skill.anal > 30) || (($schoolroomUpgradeSkills == 0) && ($slaves[$i].skill.anal > 10))>>
-		<<if ($slaves[$i].skill.vaginal > 30) || (($schoolroomUpgradeSkills == 0) && ($slaves[$i].skill.vaginal > 10)) || ($slaves[$i].vagina < 0)>>
+		<<if (_slave.intelligenceImplant >= 30 && $schoolroomRemodelBimbo != 1) || (_slave.intelligenceImplant <= -15 && $schoolroomRemodelBimbo == 1)>>
+		<<if (_slave.voice == 0) || (_slave.accent <= 1) || (($schoolroomUpgradeLanguage == 0) && (_slave.accent <= 2))>>
+		<<if (_slave.skill.oral > 30) || (($schoolroomUpgradeSkills == 0) && (_slave.skill.oral > 10))>>
+		<<if (_slave.skill.whoring > 30) || (($schoolroomUpgradeSkills == 0) && (_slave.skill.whoring > 10))>>
+		<<if (_slave.skill.entertainment > 30) || (($schoolroomUpgradeSkills == 0) && (_slave.skill.entertainment > 10))>>
+		<<if (_slave.skill.anal > 30) || (($schoolroomUpgradeSkills == 0) && (_slave.skill.anal > 10))>>
+		<<if (_slave.skill.vaginal > 30) || (($schoolroomUpgradeSkills == 0) && (_slave.skill.vaginal > 10)) || (_slave.vagina < 0)>>
 			<p>
-				<span class="slave-name">$slaves[$i].slaveName</span> can learn little from further classes,
+				<span class="slave-name">_slave.slaveName</span> can learn little from further classes,
 				<span class="noteworthy">
-					<<if $assignmentRecords[$slaves[$i].ID]>>
-						<<set _oldJob = $assignmentRecords[$slaves[$i].ID]>>
-						<<= assignJobSafely($slaves[$i], _oldJob)>>
-						<<if $slaves[$i].choosesOwnAssignment === 1>>
+					<<if $assignmentRecords[_slave.ID]>>
+						<<set _oldJob = $assignmentRecords[_slave.ID]>>
+						<<= assignJobSafely(_slave, _oldJob)>>
+						<<if _slave.choosesOwnAssignment === 1>>
 							and $he is resting before choosing another task.
-						<<elseif $slaves[$i].assignment === "rest">>
+						<<elseif _slave.assignment === "rest">>
 							<<if _oldJob != "rest">>
 								and since $he was unable to return to $his old task to <<print _oldJob>>, $his assignment has defaulted to rest.
 							<<else>>
 								so $he has returned to rest.
 							<</if>>
 						<<else>>
-							so $he goes back to <<print $slaves[$i].assignment>>.
+							so $he goes back to <<print _slave.assignment>>.
 						<</if>>
 					<<else>>
 						so _his2 assignment has defaulted to rest.
-						<<= removeJob($slaves[$i], "learn in the schoolroom")>>
+						<<= removeJob(_slave, "learn in the schoolroom")>>
 					<</if>>
 				</span>
 			</p>
@@ -214,36 +214,36 @@
 		/* 000-250-006 */
 		<<if $seeImages && $seeReportImages>>
 			<div class="imageRef tinyImg">
-				<<= SlaveArt($slaves[$i], 0, 0)>>
+				<<= SlaveArt(_slave, 0, 0)>>
 			</div>
 		<</if>>
 		/* 000-250-006 */
-		<<setLocalPronouns $slaves[$i]>>
-		<span class='slave-name'>$slaves[$i].slaveName</span>
-		<<if $slaves[$i].choosesOwnAssignment == 2>>
+		<<setLocalPronouns _slave>>
+		<span class='slave-name'>_slave.slaveName</span>
+		<<if _slave.choosesOwnAssignment == 2>>
 			<<include "SA chooses own job">>
 		<<else>>
 			is studying in $schoolroomName.
 		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.takeClasses($slaves[$i])>>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.takeClasses(_slave)>>
 		<br>&nbsp;&nbsp;&nbsp;
-		<<= App.SlaveAssignment.choosesOwnClothes($slaves[$i])>>
+		<<= App.SlaveAssignment.choosesOwnClothes(_slave)>>
 		<<include "SA rules">>
 		<<include "SA diet">>
 		<<include "SA long term effects">>
-		<<= App.SlaveAssignment.drugs($slaves[$i])>>
+		<<= App.SlaveAssignment.drugs(_slave)>>
 		<<include "SA relationships">>
 		<<include "SA rivalries">>
 		<br><<include "SA devotion">>
 	<<else>>
 		<<silently>>
 		<<include "SA chooses own job">>
-		<<run App.SlaveAssignment.takeClasses($slaves[$i])>>
-		<<run App.SlaveAssignment.choosesOwnClothes($slaves[$i])>>
+		<<run App.SlaveAssignment.takeClasses(_slave)>>
+		<<run App.SlaveAssignment.choosesOwnClothes(_slave)>>
 		<<include "SA rules">>
 		<<include "SA diet">>
 		<<include "SA long term effects">>
-		<<run App.SlaveAssignment.drugs($slaves[$i])>>
+		<<run App.SlaveAssignment.drugs(_slave)>>
 		<<include "SA relationships">>
 		<<include "SA rivalries">>
 		<<include "SA devotion">>
diff --git a/src/uncategorized/servantsQuarters.tw b/src/uncategorized/servantsQuarters.tw
index b49d6d0fb490008c0f0b4719eb242a95b6450663..66ec26328a0cee9575d2d7469821fc42d8cf4b16 100644
--- a/src/uncategorized/servantsQuarters.tw
+++ b/src/uncategorized/servantsQuarters.tw
@@ -1,6 +1,6 @@
 :: Servants' Quarters [nobr]
 
-<<set $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Servants' Quarters", $showEncyclopedia = 1, $encyclopedia = "Servants' Quarters">>
+<<set _DL = App.Entity.facilities.servantsQuarters.employeesIDs().size, $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Servants' Quarters", $showEncyclopedia = 1, $encyclopedia = "Servants' Quarters">>
 
 <<if $servantsQuartersName != "the Servants' Quarters">>
 	<<set $servantsQuartersNameCaps = $servantsQuartersName.replace("the ", "The ")>>
@@ -68,9 +68,9 @@
 			are comfortable. Servants sleep together in a dormitory, eat together in a little kitchen, bathe together in a communal shower, and then head out into the penthouse to serve.
 	<</switch>>
 
-	<<if $ServQiIDs.length > 2>>
+	<<if _DL > 2>>
 		$servantsQuartersNameCaps are busy with hurrying slaves. One shift of servants is eating, cleaning the quarters, and bathing. The second is sleeping, and the third is out in the penthouse cleaning and serving.
-	<<elseif $ServQiIDs.length > 0>>
+	<<elseif _DL > 0>>
 		A few slaves are working out of the servants' quarters. They must split their scant time between looking after their own needs and the superior needs of everyone else.
 	<<elseif $Stewardess != 0>>
 		$Stewardess.slaveName is alone, and seems rather bereft without anyone to order around.
@@ -86,7 +86,7 @@
 <div>
 	<<set _Tmult0 = Math.trunc($servantsQuarters*1000*$upgradeMultiplierArcology)>>
 	$servantsQuartersNameCaps has room to keep $servantsQuarters slaves while they serve.
-	There <<if $ServQiIDs.length == 1>>is<<else>>are<</if>> currently $ServQiIDs.length slave<<if $ServQiIDs.length != 1>>s<</if>> serving in $servantsQuartersName.
+	There <<if _DL == 1>>is<<else>>are<</if>> currently _DL slave<<if _DL != 1>>s<</if>> serving in $servantsQuartersName.
 	<div class="choices">
 		[[Expand the Servants' Quarters|Servants' Quarters][cashX(forceNeg(_Tmult0), "capEx"), $servantsQuarters += 5, $PC.skill.engineering += .1]]
 		<span class="note">
@@ -95,7 +95,7 @@
 	</div>
 
 	<div class="choices">
-		<<if $ServQiIDs.length > 0>>
+		<<if _DL > 0>>
 			<<removeFacilityWorkers "servantsQuarters" "rest" "be a servant">>
 		<</if>>
 	</div>
diff --git a/src/uncategorized/servantsQuartersReport.tw b/src/uncategorized/servantsQuartersReport.tw
index 3c1a565c48d862d00ae31f86bd56966a74ddf5de..28abb38eff176e710cc78d5426016ef73962b9ad 100644
--- a/src/uncategorized/servantsQuartersReport.tw
+++ b/src/uncategorized/servantsQuartersReport.tw
@@ -1,7 +1,7 @@
 :: Servants' Quarters Report [nobr]
 
-<<SlaveIDSort $ServQiIDs>>
-<<set _DL = $ServQiIDs.length, _SL = $slaves.length, _FLsFetish = 0, $stewardessBonus = 0>>
+<<set _slaves = App.Utils.sortedEmployees(App.Entity.facilities.servantsQuarters)>>
+<<set _DL = _slaves.length, _SL = $slaves.length, _FLsFetish = 0, $stewardessBonus = 0>>
 
 <<if $servantsQuartersDecoration != "standard">>
 	<<set _devBonus = 1>>
@@ -47,14 +47,13 @@
 	&nbsp;&nbsp;&nbsp;&nbsp;<<= SlaveFullName($Stewardess)>> is serving as your Stewardess.<<if $Stewardess.relationship == -3 && $Stewardess.devotion > 50>> $He does $his best to be your perfect lovely house<<= $wife>>.<</if>>
 	<<if ($stewardessImpregnates == 1) && (_DL > 0) && (canPenetrate($Stewardess)) && $Stewardess.pubertyXY == 1>>
 		<<set _stewardessImpregnated = 0>>
-		<<for _dI = 0; _dI < _DL; _dI++>>
-			<<set $i = $slaveIndices[$ServQiIDs[_dI]]>>
-			<<if (canImpreg($slaves[$i], $Stewardess))>>
-				<<= knockMeUp($slaves[$i], 100, 2, $Stewardess.ID)>>
-				<<set $slaves[$i].preg = 1, $slaves[$i].pregKnown = 1, $slaves[$i].pregWeek = 1, $slaves[$i].pregSource = $Stewardess.ID>><<set $slaves[$i].pregType = setPregType($slaves[$i])>>
-				<<set WombImpregnate($slaves[$i], $slaves[$i].pregType, $slaves[$i].pregSource, 1)>>
-				<<set $slaves[$i].vagina = Math.clamp($slaves[$i].vagina,1,10), _stewardessImpregnated++, $slaves[$i].counter.vaginal += 10, $vaginalTotal += 10>>
-				<<set $slaves[$i].need = 0>>
+		<<for _slave range _slaves>>
+			<<if (canImpreg(_slave, $Stewardess))>>
+				<<= knockMeUp(_slave, 100, 2, $Stewardess.ID)>>
+				<<set _slave.preg = 1, _slave.pregKnown = 1, _slave.pregWeek = 1, _slave.pregSource = $Stewardess.ID>><<set _slave.pregType = setPregType(_slave)>>
+				<<set WombImpregnate(_slave, _slave.pregType, _slave.pregSource, 1)>>
+				<<set _slave.vagina = Math.clamp(_slave.vagina,1,10), _stewardessImpregnated++, _slave.counter.vaginal += 10, $vaginalTotal += 10>>
+				<<set _slave.need = 0>>
 			<</if>>
 		<</for>>
 		<<if _stewardessImpregnated > 0>>
@@ -110,50 +109,49 @@
 	<<else>>
 		<<set _BonusToggle = 0>>
 	<</if>>
-	<<for _dI = 0; _dI < _DL; _dI++>>
-		<<set $i = $slaveIndices[$ServQiIDs[_dI]]>>
-		<<setLocalPronouns $slaves[$i] 2>>
-		<<if $Stewardess.rivalryTarget == $slaves[$i].ID>>
-			$He bears down on $his <<print rivalryTerm($Stewardess)>>, $slaves[$i].slaveName, forcing _him2 to work extra hard or suffer punishment.
-			<<set $slaves[$i].devotion--, $slaves[$i].trust-->>
+	<<for _slave range _slaves>>
+		<<setLocalPronouns _slave 2>>
+		<<if $Stewardess.rivalryTarget == _slave.ID>>
+			$He bears down on $his <<print rivalryTerm($Stewardess)>>, _slave.slaveName, forcing _him2 to work extra hard or suffer punishment.
+			<<set _slave.devotion--, _slave.trust-->>
 			<<if random(1,100) > 65>>
-				<<set $Stewardess.rivalry++, $slaves[_FLs].rivalry++, $slaves[$i].rivalry++>>
+				<<set $Stewardess.rivalry++, $slaves[_FLs].rivalry++, _slave.rivalry++>>
 			<</if>>
-		<<elseif $Stewardess.relationshipTarget == $slaves[$i].ID>>
-			$He dotes over $his <<print relationshipTerm($Stewardess)>>, $slaves[$i].slaveName, making sure _he2 knows how to do a good job and keeping _him2 well stocked with everything _he2 needs.
-			<<set $slaves[$i].devotion++>>
-		<<elseif areRelated($Stewardess, $slaves[$i])>>
-			$He pays special attention to $his <<print relativeTerm($Stewardess,$slaves[$i])>>, $slaves[$i].slaveName, making sure _he2 doesn't slack off just because they are related.
-			<<set $slaves[$i].trust++>>
+		<<elseif $Stewardess.relationshipTarget == _slave.ID>>
+			$He dotes over $his <<print relationshipTerm($Stewardess)>>, _slave.slaveName, making sure _he2 knows how to do a good job and keeping _him2 well stocked with everything _he2 needs.
+			<<set _slave.devotion++>>
+		<<elseif areRelated($Stewardess, _slave)>>
+			$He pays special attention to $his <<print relativeTerm($Stewardess,_slave)>>, _slave.slaveName, making sure _he2 doesn't slack off just because they are related.
+			<<set _slave.trust++>>
 		<</if>>
-		<<switch $slaves[$i].prestigeDesc>>
+		<<switch _slave.prestigeDesc>>
 		<<case "$He is a famed Free Cities whore, and commands top prices.">>
-			$He does $his best to motivate the famous whore, $slaves[$i].slaveName, though $he is uncertain why _he2 is here.
+			$He does $his best to motivate the famous whore, _slave.slaveName, though $he is uncertain why _he2 is here.
 		<<case "$He is a famed Free Cities slut, and can please anyone.">>
-			$He ignores $his duties in order the fawn over the famous entertainer, $slaves[$i].slaveName.
+			$He ignores $his duties in order the fawn over the famous entertainer, _slave.slaveName.
 		<<case "$He is remembered for winning best in show as a cockmilker.">>
-			<<if ($slaves[$i].dick != 0) && ($slaves[$i].balls != 0) && ($slaves[$i].prostate > 1)>>
-				$slaves[$i].slaveName leaves a trail of cum wherever _he2 goes and frequently stops to masturbate, greatly annoying $Stewardess.slaveName.
-				<<if random(1,100) > 90 && $Stewardess.rivalry == 0 && $slaves[$i].rivalry == 0>>
-					<<set $Stewardess.rivalryTarget = $slaves[$i].ID, $Stewardess.rivalry++, $slaves[_FLs].rivalryTarget = $slaves[$i].ID, $slaves[_FLs].rivalry++>>
-					<<set $slaves[$i].rivalryTarget = $Stewardess.ID, $slaves[$i].rivalry++>>
+			<<if (_slave.dick != 0) && (_slave.balls != 0) && (_slave.prostate > 1)>>
+				_slave.slaveName leaves a trail of cum wherever _he2 goes and frequently stops to masturbate, greatly annoying $Stewardess.slaveName.
+				<<if random(1,100) > 90 && $Stewardess.rivalry == 0 && _slave.rivalry == 0>>
+					<<set $Stewardess.rivalryTarget = _slave.ID, $Stewardess.rivalry++, $slaves[_FLs].rivalryTarget = _slave.ID, $slaves[_FLs].rivalry++>>
+					<<set _slave.rivalryTarget = $Stewardess.ID, _slave.rivalry++>>
 				<</if>>
 			<</if>>
 		<<case "$He is remembered for winning best in show as a dairy cow.">>
-			<<if ($slaves[$i].lactation > 0) && (($slaves[$i].boobs-$slaves[$i].boobsImplant) > 6000)>>
-				$slaves[$i].slaveName's huge breasts frequently get in the way of _his2 work and _he2 leaks milk everywhere, greatly annoying $Stewardess.slaveName.
-				<<if random(1,100) > 90 && $Stewardess.rivalry == 0 && $slaves[$i].rivalry == 0>>
-					<<set $Stewardess.rivalryTarget = $slaves[$i].ID, $Stewardess.rivalry++, $slaves[_FLs].rivalryTarget = $slaves[$i].ID, $slaves[_FLs].rivalry++>>
-					<<set $slaves[$i].rivalryTarget = $Stewardess.ID, $slaves[$i].rivalry++>>
+			<<if (_slave.lactation > 0) && ((_slave.boobs-_slave.boobsImplant) > 6000)>>
+				_slave.slaveName's huge breasts frequently get in the way of _his2 work and _he2 leaks milk everywhere, greatly annoying $Stewardess.slaveName.
+				<<if random(1,100) > 90 && $Stewardess.rivalry == 0 && _slave.rivalry == 0>>
+					<<set $Stewardess.rivalryTarget = _slave.ID, $Stewardess.rivalry++, $slaves[_FLs].rivalryTarget = _slave.ID, $slaves[_FLs].rivalry++>>
+					<<set _slave.rivalryTarget = $Stewardess.ID, _slave.rivalry++>>
 				<</if>>
 			<</if>>
 		<<case "$He is remembered for winning best in show as a breeder.">>
-			<<if $slaves[$i].bellyPreg >= 10000>>
-				$slaves[$i].slaveName's big pregnant belly frequently gets in the way of _his2 work. However, $Stewardess.slaveName is willing to overlook it, as well as allow _him2 easy jobs, due to how valuable _his2 womb is.
+			<<if _slave.bellyPreg >= 10000>>
+				_slave.slaveName's big pregnant belly frequently gets in the way of _his2 work. However, $Stewardess.slaveName is willing to overlook it, as well as allow _him2 easy jobs, due to how valuable _his2 womb is.
 			<</if>>
 		<</switch>>
-		<<if (_BonusToggle == 1) && ($slaves[$i].devotion < 45)>>
-			<<set $slaves[$i].devotion += 5>>
+		<<if (_BonusToggle == 1) && (_slave.devotion < 45)>>
+			<<set _slave.devotion += 5>>
 		<</if>>
 	<</for>>
 	<<if (_DL > 0)>>
@@ -173,7 +171,7 @@
 	<<set $failedElite += 10>>
 <</if>>
 <<if (_DL > 0)>>
-	<<setLocalPronouns $slaves[$slaveIndices[$ServQiIDs[0]]]>>
+	<<setLocalPronouns _slaves[0]>>
 	&nbsp;&nbsp;&nbsp;&nbsp;<<if (_DL != 1)>>''There are _DL slaves working out of the servants' quarters.'' They work to<<else>>''There is one slave working out of the servants' quarters.'' $He works to<</if>> @@.yellowgreen;reduce@@ your household expenses; having a well-staffed house slightly @@.green;increases@@ your reputation.
 <</if>>
 
@@ -217,98 +215,99 @@
 
 <<set $servantMilkersMultiplier = 0.5, _SQMilk = 0, _SQMilkSale = 0>>
 
-<<for _dI = 0; _dI < _DL; _dI++>>
-	<<set $i = $slaveIndices[$ServQiIDs[_dI]], $slaves[$i].devotion += _devBonus>>
-	<<setLocalPronouns $slaves[$i] 2>>
-	<<if ($slaves[$i].devotion <= 20) && ($slaves[$i].trust >= -20)>>
-		<<set $slaves[$i].devotion -= 5, $slaves[$i].trust -= 5>>
-	<<elseif ($slaves[$i].devotion <= 10)>>
-		<<set $slaves[$i].devotion += 2>>
-	<<elseif ($slaves[$i].devotion >= 80)>>
-		<<set $slaves[$i].devotion -= 2>>
+<<for _slave range _slaves>>
+	<<set $i = $slaveIndices[_slave.ID]>>
+	<<set _slave.devotion += _devBonus>>
+	<<setLocalPronouns _slave 2>>
+	<<if (_slave.devotion <= 20) && (_slave.trust >= -20)>>
+		<<set _slave.devotion -= 5, _slave.trust -= 5>>
+	<<elseif (_slave.devotion <= 10)>>
+		<<set _slave.devotion += 2>>
+	<<elseif (_slave.devotion >= 80)>>
+		<<set _slave.devotion -= 2>>
 	<</if>>
-	<<if ($slaves[$i].devotion < -20)>>
-		<<set $slaves[$i].trust += 3>>
-	<<elseif ($slaves[$i].trust < -50)>>
-		<<set $slaves[$i].trust += 2>>
-	<<elseif ($slaves[$i].trust < -30)>>
-		<<set $slaves[$i].trust += 1>>
+	<<if (_slave.devotion < -20)>>
+		<<set _slave.trust += 3>>
+	<<elseif (_slave.trust < -50)>>
+		<<set _slave.trust += 2>>
+	<<elseif (_slave.trust < -30)>>
+		<<set _slave.trust += 1>>
 	<</if>>
-	<<if ($slaves[$i].health.condition < -80)>>
-		<<run improveCondition($slaves[$i], 20)>>
-	<<elseif ($slaves[$i].health.condition < -40)>>
-		<<run improveCondition($slaves[$i], 10)>>
-	<<elseif ($slaves[$i].health.condition < 0)>>
-		<<run improveCondition($slaves[$i], 7)>>
-	<<elseif ($slaves[$i].health.condition < 90)>>
-		<<run improveCondition($slaves[$i], 3)>>
+	<<if (_slave.health.condition < -80)>>
+		<<run improveCondition(_slave, 20)>>
+	<<elseif (_slave.health.condition < -40)>>
+		<<run improveCondition(_slave, 10)>>
+	<<elseif (_slave.health.condition < 0)>>
+		<<run improveCondition(_slave, 7)>>
+	<<elseif (_slave.health.condition < 90)>>
+		<<run improveCondition(_slave, 3)>>
 	<</if>>
 	<<switch $servantsQuartersDecoration>>
 	<<case "Arabian Revivalist" "Aztec Revivalist" "Chattel Religionist" "Chinese Revivalist" "Degradationist" "Edo Revivalist" "Egyptian Revivalist" "Roman Revivalist" "Subjugationist" "Supremacist">>
-		<<set $slaves[$i].rules.living = "spare">>
+		<<set _slave.rules.living = "spare">>
 	<<case "Slave Professionalism">>
-		<<if $slaves[$i].intelligence+$slaves[$i].intelligenceImplant > 15>>
-			<<set $slaves[$i].rules.living = "normal">>
+		<<if _slave.intelligence+_slave.intelligenceImplant > 15>>
+			<<set _slave.rules.living = "normal">>
 		<<else>>
-			<<set $slaves[$i].rules.living = "spare">>
+			<<set _slave.rules.living = "spare">>
 		<</if>>
 	<<case "Petite Admiration">>
-		<<if heightPass($slaves[$i])>>
-			<<set $slaves[$i].rules.living = "normal">>
+		<<if heightPass(_slave)>>
+			<<set _slave.rules.living = "normal">>
 		<<else>>
-			<<set $slaves[$i].rules.living = "spare">>
+			<<set _slave.rules.living = "spare">>
 		<</if>>
 	<<case "Statuesque Glorification">>
-		<<if heightPass($slaves[$i])>>
-			<<set $slaves[$i].rules.living = "normal">>
+		<<if heightPass(_slave)>>
+			<<set _slave.rules.living = "normal">>
 		<<else>>
-			<<set $slaves[$i].rules.living = "spare">>
+			<<set _slave.rules.living = "spare">>
 		<</if>>
 	<<default>>
-		<<set $slaves[$i].rules.living = "normal">>
+		<<set _slave.rules.living = "normal">>
 	<</switch>>
 	<<if $showEWD != 0>>
 		<br><br>
 		/* 000-250-006 */
 		<<if $seeImages && $seeReportImages>>
 		<div class="imageRef tinyImg">
-			<<= SlaveArt($slaves[$i], 0, 0)>>
+			<<= SlaveArt(_slave, 0, 0)>>
 		</div>
 		<</if>>
 		/* 000-250-006 */
-		<span class='slave-name'><<= SlaveFullName($slaves[$i])>></span>
-		<<if $slaves[$i].choosesOwnAssignment == 2>>
+		<span class='slave-name'><<= SlaveFullName(_slave)>></span>
+		<<if _slave.choosesOwnAssignment == 2>>
 			<<include "SA chooses own job">>
 		<<else>>
 			is working out of $servantsQuartersName.
 		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;_He2 <<= App.SlaveAssignment.servant($slaves[$i])>>
-		<<if ($servantMilkers == 1) && ($slaves[$i].lactation > 0)>>
-			<br>&nbsp;&nbsp;&nbsp;&nbsp;_He2 <<= App.SlaveAssignment.getMilked($slaves[$i])>>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;_He2 <<= App.SlaveAssignment.servant(_slave)>>
+		<<if ($servantMilkers == 1) && (_slave.lactation > 0)>>
+			<br>&nbsp;&nbsp;&nbsp;&nbsp;_He2 <<= App.SlaveAssignment.getMilked(_slave)>>
 			<<set _SQMilk += $milk, _SQMilkSale += $milkSale>>
 		<</if>>
 		<br>&nbsp;&nbsp;&nbsp;
-		<<= App.SlaveAssignment.choosesOwnClothes($slaves[$i])>>
+		<<= App.SlaveAssignment.choosesOwnClothes(_slave)>>
 		<<include "SA rules">>
 		<<include "SA diet">>
 		<<include "SA long term effects">>
-		<<= App.SlaveAssignment.drugs($slaves[$i])>>
+		<<= App.SlaveAssignment.drugs(_slave)>>
 		<<include "SA relationships">>
 		<<include "SA rivalries">>
 		<br><<include "SA devotion">>
 	<<else>>
 		<<silently>>
 		<<include "SA chooses own job">>
-		<<run App.SlaveAssignment.servant($slaves[$i])>>
-		<<if ($servantMilkers == 1) && ($slaves[$i].lactation > 0)>>
-			<<run App.SlaveAssignment.getMilked($slaves[$i])>>
+		<<run App.SlaveAssignment.servant(_slave)>>
+		<<if ($servantMilkers == 1) && (_slave.lactation > 0)>>
+			<<run App.SlaveAssignment.getMilked(_slave)>>
 			<<set _SQMilk += $milk, _SQMilkSale += $milkSale>>
 		<</if>>
-		<<run App.SlaveAssignment.choosesOwnClothes($slaves[$i])>>
+		<<run App.SlaveAssignment.choosesOwnClothes(_slave)>>
 		<<include "SA rules">>
 		<<include "SA diet">>
 		<<include "SA long term effects">>
-		<<run App.SlaveAssignment.drugs($slaves[$i])>>
+		<<run App.SlaveAssignment.drugs(_slave)>>
 		<<include "SA relationships">>
 		<<include "SA rivalries">>
 		<<include "SA devotion">>
diff --git a/src/uncategorized/slaveAssignmentsReport.tw b/src/uncategorized/slaveAssignmentsReport.tw
index 103c5fabf0ad67f5323b3f71ee669a02af97efa8..c020c8ce15fa00d24d8a6c5f2f7e385fd5dfe737 100644
--- a/src/uncategorized/slaveAssignmentsReport.tw
+++ b/src/uncategorized/slaveAssignmentsReport.tw
@@ -1,1125 +1,9 @@
 :: Slave Assignments Report [nobr]
 
-<<set $nextLink = "Economics", $nextButton = "Continue", _SL = $slaves.length>>
+<<set $nextLink = "Economics", $nextButton = "Continue">>
 
 <h1> $arcologies[0].name Weekly Slave Report - Week $week</h1>
 
-/*Spa room*/
-<<if $spa > 0>>
-	<<set $spaSpots = ($spa - $SpaiIDs.length) * 20>>
-	<<if _S.Attendant>>
-		<<set $spaSpots = Math.trunc($spaSpots * (1 + (_S.Attendant.skill.attendant / 400)))>> /*A skilled attendant improves available space by 25%*/
-	<</if>>
-<</if>>
-
-/** silent pass for any reassignments before generating reports */
-<<for $i = 0; $i < _SL; $i++>>
-	<<set $slaves[$i].health.illness = 0, $slaves[$i].health.tired = 0>> /* temp */
-	<<if $slaves[$i].choosesOwnAssignment == 1>>
-		<<silently>>
-			<<include "SA chooses own job">>
-		<</silently>>
-	<</if>>
-<</for>>
-
-/*Sexual services demand per class*/
-/*We can add milk etc. to this as well, though this is a good that can be traded beyond the arcology and also needs its own market much like the slavemarket. TODO*/
-/*In the default scenario these numbers indicate the amount of money each individual citizen of a particular class is looking to spend on sex (and milk) every week
-Depending on the conditions they may derive more or less 'utility' out of their credits spent
-i.e. a highly paternalist arcology with little choice for its lower class but Fuckdolls may still put money into them but not get the same satisfaction out of it*/
-/*Low rent increases demand/available money for sexual services, high rent decreases it*/
-<<if $brothelBoost.selected > 0 && $rep < $brothelBoost.selected * 500 + 2000>>
-	<<set $brothelBoost.eligible = Math.trunc((rep - 2000) / 500)>>
-	<<if $brothelBoost.eligible < 0>>
-		<<set $brothelBoost.eligible = 0>>
-	<</if>>
-<<else>>
-	<<set $brothelBoost.eligible = $brothelBoost.selected>>
-<</if>>
-<<run repX(forceNeg(50 * $brothelBoost.eligible), "brothel")>>
-
-<<set _lowerClassSexDemand = Math.trunc($lowerClass * $whoreBudget.lowerClass) * 2,
-_lowerClassSexDemandRef = Math.max(_lowerClassSexDemand, 1),
-_visitorsSexDemand = Math.trunc($visitors) * 40,
-_middleClassSexDemand = Math.trunc($middleClass * $whoreBudget.middleClass + _visitorsSexDemand * 0.5) * 2,
-_middleClassSexDemandRef = Math.max(_middleClassSexDemand, 1),
-_upperClassSexDemand = Math.trunc($upperClass * $whoreBudget.upperClass + _visitorsSexDemand * 0.5) * 2,
-_upperClassSexDemandRef = Math.max(_upperClassSexDemand, 1),
-_topClassSexDemand = Math.trunc($topClass * $whoreBudget.topClass) * 2,
-_topClassSexDemandRef = Math.max(_topClassSexDemand, 1),
-_arcadeSupply = {lowerClass: 0, middleClass: 0, upperClass: 0},
-_clubSupply = {lowerClass: 0, middleClass: 0},
-$whorePriceAdjustment = {lowerClass: 0, middleClass: 0, upperClass: 0, topClass: 0},
-$NPCMarketShare = {lowerClass: 0, middleClass: 0, upperClass: 0, topClass: 0},
-$sexDemandResult = {lowerClass: 0, middleClass: 0, upperClass: 0, topClass: 0},
-$slaveJobValues = slaveJobValues(_lowerClassSexDemandRef, _middleClassSexDemandRef, _upperClassSexDemandRef, _topClassSexDemandRef)>>
-
-/*Arcade Specific Demand for Degradationists to give it higher priority*/
-<<if $arcologies[0].FSDegradationist != "unset">>
-	<<set _lowerClassArcadeSexDemand = Math.trunc(_lowerClassSexDemand * $arcologies[0].FSDegradationist * 0.0015),
-	_middleClassArcadeSexDemand = Math.trunc(_middleClassSexDemand * $arcologies[0].FSDegradationist * 0.0002),
-	_upperClassArcadeSexDemand = Math.trunc(_upperClassSexDemand * $arcologies[0].FSDegradationist * 0.000025),
-	_arcadeDemandDeg = _lowerClassArcadeSexDemand + _middleClassArcadeSexDemand + _upperClassArcadeSexDemand>>
-	<<if $arcologies[0].FSDegradationistLaw == 1>>
-		<<set _arcadeDemandDeg += $ASlaves * 3>>
-	<</if>>
-	<<if $slaveJobValues.arcade < _arcadeDemandDeg>>
-		<<if _arcadeDemandDeg > 20000 || $arcologies[0].FSDegradationist > 50>>
-			<<set _degradationistPenalty = ((_arcadeDemandDeg - $slaveJobValues.arcade) / _arcadeDemandDeg),
-			$arcologies[0].FSDegradationist -= Math.trunc(5 * _degradationistPenalty)>>
-			<<run repX(forceNeg(100 * _degradationistPenalty), "futureSocieties")>>
-			<<if _degradationistPenalty > 0.5>>
-				<<set $arcadeDemandDegResult = 1>>
-			<<else>>
-				<<set $arcadeDemandDegResult = 2>>
-			<</if>>
-		<<else>>
-			<<set $arcadeDemandDegResult = 3>>
-		<</if>>
-		<<set _arcadeSupply.lowerClass += Math.trunc(1.15 * $slaveJobValues.arcade * (_lowerClassArcadeSexDemand / _arcadeDemandDeg)),
-		_lowerClassSexDemand -= _arcadeSupply.lowerClass,
-		_arcadeSupply.middleClass += Math.trunc(1.15 * $slaveJobValues.arcade * (_middleClassArcadeSexDemand / _arcadeDemandDeg)),
-		_middleClassSexDemand -= _arcadeSupply.middleClass,
-		_arcadeSupply.upperClass += Math.trunc(1.15 * $slaveJobValues.arcade * (_upperClassArcadeSexDemand / _arcadeDemandDeg)),
-		_upperClassSexDemand -= _arcadeSupply.upperClass>> /*There's a 15% satisfaction bonus from getting release in a societally approved way*/
-	<<else>>
-		<<if $slaveJobValues.arcade >= _arcadeDemandDeg * 1.5>>
-			<<set $arcologies[0].FSDegradationist += 2,
-			$arcadeDemandDegResult = 4>>
-			<<run repX(500, "futureSocieties")>>
-		<<else>>
-			<<set $arcadeDemandDegResult = 5>>
-		<</if>>
-		<<set _arcadeSupply.lowerClass += Math.trunc(1.15 * _lowerClassArcadeSexDemand),
-		_lowerClassSexDemand -= _arcadeSupply.lowerClass,
-		_arcadeSupply.middleClass += Math.trunc(1.15 * _middleClassArcadeSexDemand),
-		_middleClassSexDemand -= _arcadeSupply.middleClass,
-		_arcadeSupply.upperClass += Math.trunc(1.15 * _upperClassArcadeSexDemand),
-		_upperClassSexDemand -= _arcadeSupply.upperClass>>
-	<</if>>
-<<else>>
-	<<set _arcadeDemandDeg = 0>>
-<</if>>
-
-/*Public slut sex supply. Top and upper class won't partake*/
-<<set _clubDemand = _lowerClassSexDemand + _middleClassSexDemand,
-_lowerClassClubRatio = _lowerClassSexDemand / _clubDemand,
-_middleClassClubRatio = _middleClassSexDemand / _clubDemand>>
-<<if $slaveJobValues.club * $slaveJobValues.clubSP < _clubDemand>>
-	<<set _lowerClassSexDemand -= Math.trunc($slaveJobValues.club * $slaveJobValues.clubSP * _lowerClassClubRatio),
-	_middleClassSexDemand -= Math.trunc($slaveJobValues.club * $slaveJobValues.clubSP * _middleClassClubRatio)>>
-<<else>>
-	<<set _lowerClassSexDemand = 0,
-	_middleClassSexDemand = 0>>
-<</if>>
-<<set _clubSupply.lowerClass = Math.trunc($slaveJobValues.club * $slaveJobValues.clubSP * _lowerClassClubRatio),
-_clubSupply.middleClass = Math.trunc($slaveJobValues.club * $slaveJobValues.clubSP * _middleClassClubRatio)>>
-
-/* Brothel or street whore sex supply */
-<<if _lowerClassSexDemand < $slaveJobValues.brothel.lowerClass>>
-	<<set $whorePriceAdjustment.lowerClass = Math.max(Math.pow(_lowerClassSexDemand / ($slaveJobValues.brothel.lowerClass + $NPCSexSupply.lowerClass), 1.513), 0.3),
-	_lowerClassSexDemand = 0>> /*This accounts for people having too much choice and getting more picky how they spend their money*/
-<<else>>
-	<<set $whorePriceAdjustment.lowerClass = Math.pow(_lowerClassSexDemand / ($slaveJobValues.brothel.lowerClass + $NPCSexSupply.lowerClass), 0.5),
-	_lowerClassSexDemand -= $slaveJobValues.brothel.lowerClass>> /* People are willing to pay more for a scarce good, but within reason */
-<</if>>
-<<if _middleClassSexDemand < $slaveJobValues.brothel.middleClass>>
-	<<set $whorePriceAdjustment.middleClass = Math.max(Math.pow((_middleClassSexDemand * 1.1) / ($slaveJobValues.brothel.middleClass + $NPCSexSupply.middleClass), 1.513), 0.33),
-	_middleClassSexDemand = 0>>
-<<else>>
-	<<set $whorePriceAdjustment.middleClass = Math.pow((_middleClassSexDemand * 1.1) / ($slaveJobValues.brothel.middleClass + $NPCSexSupply.middleClass), 0.5),
-	_middleClassSexDemand -= $slaveJobValues.brothel.middleClass>>
-<</if>>
-<<if _upperClassSexDemand < $slaveJobValues.brothel.upperClass>>
-	<<set $whorePriceAdjustment.upperClass = Math.max(Math.pow((_upperClassSexDemand * 1.21) / ($slaveJobValues.brothel.upperClass + $NPCSexSupply.upperClass), 1.513), 0.363),
-	_upperClassSexDemand = 0>>
-<<else>>
-	<<set $whorePriceAdjustment.upperClass = Math.pow((_upperClassSexDemand * 1.21) / ($slaveJobValues.brothel.upperClass + $NPCSexSupply.upperClass), 0.5),
-	_upperClassSexDemand -= $slaveJobValues.brothel.upperClass>>
-<</if>>
-<<if _topClassSexDemand < $slaveJobValues.brothel.topClass>>
-	<<set $whorePriceAdjustment.topClass = Math.max(Math.pow((_topClassSexDemand * 1.331) / ($slaveJobValues.brothel.topClass + $NPCSexSupply.topClass), 1.513), 0.3993),
-	_topClassSexDemand = 0>>
-<<else>>
-	<<set $whorePriceAdjustment.topClass = Math.pow((_topClassSexDemand * 1.331) / ($slaveJobValues.brothel.topClass + $NPCSexSupply.topClass), 0.5),
-	_topClassSexDemand -= $slaveJobValues.brothel.topClass>>
-<</if>>
-
-/*Price for sex in the arcade or at a glory hole*/
-<<if $arcologies[0].FSPaternalist != "unset">>
-	<<set _arcadeDemand = Math.max((_arcadeDemandDeg + _lowerClassSexDemand) * (1 - $arcologies[0].FSPaternalist / 50), 0)>> /*Paternalists sap demand for the arcade*/
-<<else>>
-	<<set _arcadeDemand = _arcadeDemandDeg + _lowerClassSexDemand>>
-<</if>>
-<<if $slaveJobValues.arcade + $NPCSexSupply.lowerClass > 0>>
-	<<set $arcadePrice = Math.clamp(Math.pow((_arcadeDemand / ($slaveJobValues.arcade + $NPCSexSupply.lowerClass)), 0.5), 0.5, 3)>> /*This calculates the price charged per fuck*/
-<<else>>
-	<<set $arcadePrice = 0.5>> /*minimum price no matter what*/
-<</if>>
-
-/*Arcade usage beyond degradationist demand*/
-<<if $arcologies[0].FSDegradationist != "unset">>
-	<<if $slaveJobValues.arcade > _arcadeDemandDeg>>
-		<<set $slaveJobValues.arcade -= _arcadeDemandDeg>>
-	<<else>>
-		<<set $slaveJobValues.arcade = 0>>
-	<</if>>
-<</if>>
-<<if $slaveJobValues.arcade > _lowerClassSexDemand>>
-	<<set _lowerClassSexDemand = 0>>
-<<else>>
-	<<set _lowerClassSexDemand -= $slaveJobValues.arcade>>
-<</if>>
-<<set _arcadeSupply.lowerClass += $slaveJobValues.arcade>>
-
-/*NPC sex supply*/
-<<set $NPCSexSupply = NPCSexSupply(_lowerClassSexDemand, _lowerClassSexDemandRef, _middleClassSexDemand, _middleClassSexDemandRef, _upperClassSexDemand, _upperClassSexDemandRef, _topClassSexDemand, _topClassSexDemandRef),
-$NPCMarketShare.lowerClass = Math.trunc(($NPCSexSupply.lowerClass * 1000) / _lowerClassSexDemandRef),
-$NPCMarketShare.middleClass = Math.trunc(($NPCSexSupply.middleClass * 1000) / _middleClassSexDemandRef),
-$NPCMarketShare.upperClass = Math.trunc(($NPCSexSupply.upperClass * 1000) / _upperClassSexDemandRef),
-$NPCMarketShare.topClass = Math.trunc(($NPCSexSupply.topClass * 1000) / _topClassSexDemandRef)>>
-<<if _lowerClassSexDemand < $NPCSexSupply.lowerClass>>
-	<<set _lowerClassSexDemand = 0>>
-<<else>>
-	<<set _lowerClassSexDemand -= $NPCSexSupply.lowerClass>>
-<</if>>
-
-<<if _middleClassSexDemand < $NPCSexSupply.middleClass>>
-	<<set _middleClassSexDemand = 0>>
-<<else>>
-	<<set _middleClassSexDemand -= $NPCSexSupply.middleClass>>
-<</if>>
-
-<<if _upperClassSexDemand < $NPCSexSupply.upperClass>>
-	<<set _upperClassSexDemand = 0>>
-<<else>>
-	<<set _upperClassSexDemand -= $NPCSexSupply.upperClass>>
-<</if>>
-
-<<if _topClassSexDemand < $NPCSexSupply.topClass>>
-	<<set _topClassSexDemand = 0>>
-<<else>>
-	<<set _topClassSexDemand -= $NPCSexSupply.topClass>>
-<</if>>
-
-<<if ($cheatMode == 1) || ($debugMode == 1)>>
-
-	<br>Slave services supply and demand this week:
-
-	<table class="finance" border ="1">
-		<tr align="center"> /*title row */
-			<th align="right">Client's class</th>
-			<th>Lower</th>
-			<th>Middle</th>
-			<th>Upper</th>
-			<th>Top</th>
-		</tr>
-
-		<tr align="right">
-			<td>
-				Demand
-			</td>
-			<td>
-				<<print commaNum(_lowerClassSexDemandRef)>>
-			</td>
-			<td>
-				<<print commaNum(_middleClassSexDemandRef)>>
-			</td>
-			<td>
-				<<print commaNum(_upperClassSexDemandRef)>>
-			</td>
-			<td>
-				<<print commaNum(_topClassSexDemandRef)>>
-			</td>
-		</tr>
-
-		<tr align="right">
-			<td>
-				Brothel Supply
-			</td>
-			<td>
-				<<print commaNum($slaveJobValues.brothel.lowerClass)>>
-			</td>
-			<td>
-				<<print commaNum($slaveJobValues.brothel.middleClass)>>
-			</td>
-			<td>
-				<<print commaNum($slaveJobValues.brothel.upperClass)>>
-			</td>
-			<td>
-				<<print commaNum($slaveJobValues.brothel.topClass)>>
-			</td>
-		</tr>
-
-		<<if (_clubSupply.lowerClass || _clubSupply.middleClass)>>
-			<tr align="right">
-				<td>
-					Club Supply
-				</td>
-				<td>
-					<<print commaNum(_clubSupply.lowerClass)>>
-				</td>
-				<td>
-					<<print commaNum(_clubSupply.middleClass)>>
-				</td>
-				<td>
-					N/A
-				</td>
-				<td>
-					N/A
-				</td>
-			</tr>
-		<</if>>
-
-		<<if (_arcadeSupply.lowerClass || _arcadeSupply.middleClass || _arcadeSupply.upperClass)>>
-			<tr align="right">
-				<td>
-					Arcade Supply
-				</td>
-				<td>
-					<<print commaNum(_arcadeSupply.lowerClass)>>
-				</td>
-				<td>
-					<<print commaNum(_arcadeSupply.middleClass)>>
-				</td>
-				<td>
-					<<print commaNum(_arcadeSupply.upperClass)>>
-				</td>
-				<td>
-					N/A
-				</td>
-			</tr>
-		<</if>>
-
-		<<if ($cheatMode == 1) || ($debugMode == 1)>>
-			<tr align="right">
-				<td>
-					NPC Supply
-				</td>
-				<td>
-					<<print commaNum($NPCSexSupply.lowerClass)>>
-				</td>
-				<td>
-					<<print commaNum($NPCSexSupply.middleClass)>>
-				</td>
-				<td>
-					<<print commaNum($NPCSexSupply.upperClass)>>
-				</td>
-				<td>
-					<<print commaNum($NPCSexSupply.topClass)>>
-				</td>
-			</tr>
-		<</if>>
-
-		<tr align="right">
-			<td>
-				Unsatisfied
-			</td>
-			<td>
-				<<print commaNum(_lowerClassSexDemand)>>
-			</td>
-			<td>
-				<<print commaNum(_middleClassSexDemand)>>
-			</td>
-			<td>
-				<<print commaNum(_upperClassSexDemand)>>
-			</td>
-			<td>
-				<<print commaNum(_topClassSexDemand)>>
-			</td>
-		</tr>
-	</table>
-<</if>>
-
-/*Sexual satisfaction effects*/
-<<set $sexDemandResult.lowerClass = Math.trunc((($NPCSexSupply.lowerClass + $slaveJobValues.brothel.lowerClass + _clubSupply.lowerClass + _arcadeSupply.lowerClass) * 1000) / _lowerClassSexDemandRef),
-$sexDemandResult.middleClass = Math.trunc((($NPCSexSupply.middleClass + $slaveJobValues.brothel.middleClass + _clubSupply.middleClass + _arcadeSupply.middleClass) * 1000) / _middleClassSexDemandRef),
-$sexDemandResult.upperClass = Math.trunc((($NPCSexSupply.upperClass + $slaveJobValues.brothel.upperClass + _arcadeSupply.upperClass) * 1000) / _upperClassSexDemandRef),
-$sexDemandResult.topClass = Math.trunc((($NPCSexSupply.topClass + $slaveJobValues.brothel.topClass) * 1000) / _topClassSexDemandRef)>>
-<<if $sexDemandResult.lowerClass < 400>> /*You are providing < 40% of their desired amount of sex*/
-	<<if $week <= 30>>
-		<<set $classSatisfied.lowerClass = 0>>
-	<<else>>
-		<<set $classSatisfied.lowerClass = -1>>
-	<</if>>
-<<elseif $sexDemandResult.lowerClass < 600>> /*You are providing between 40 and 60% of their desired amount of sex*/
-	<<if $week <= 40>>
-		<<set $classSatisfied.lowerClass = 1>>
-	<<elseif $week <= 60>>
-		<<set $classSatisfied.lowerClass = 0>>
-	<<else>>
-		<<set $classSatisfied.lowerClass = -1>>
-	<</if>>
-<<elseif $sexDemandResult.lowerClass < 800>> /*You are providing between 60 and 80% of their desired amount of sex*/
-	<<if $week <= 50>>
-		<<set $classSatisfied.lowerClass = 1>>
-	<<else>>
-		<<set $classSatisfied.lowerClass = 0>>
-	<</if>>
-<<elseif $sexDemandResult.lowerClass == 1000>> /*You are providing 100% or more of their desired amount of sex*/
-	<<set $classSatisfied.lowerClass = 2>>
-<<else>> /*You are providing > 80% of their desired amount of sex*/
-	<<set $classSatisfied.lowerClass = 1>>
-<</if>>
-
-<<if $sexDemandResult.middleClass < 400>> /*You are providing < 40% of their desired amount of sex*/
-	<<if $week <= 30>>
-		<<set $classSatisfied.middleClass = 0>>
-	<<else>>
-		<<set $classSatisfied.middleClass = -1>>
-	<</if>>
-<<elseif $sexDemandResult.middleClass < 600>> /*You are providing between 40 and 60% of their desired amount of sex*/
-	<<if $week <= 40>>
-		<<set $classSatisfied.middleClass = 1>>
-	<<elseif $week <= 60>>
-		<<set $classSatisfied.middleClass = 0>>
-	<<else>>
-		<<set $classSatisfied.middleClass = -1>>
-	<</if>>
-<<elseif $sexDemandResult.middleClass < 800>> /*You are providing between 60 and 80% of their desired amount of sex*/
-	<<if $week <= 50>>
-		<<set $classSatisfied.middleClass = 1>>
-	<<else>>
-		<<set $classSatisfied.middleClass = 0>>
-	<</if>>
-<<elseif $sexDemandResult.middleClass == 1000>> /*You are providing 100% or more of their desired amount of sex*/
-	<<set $classSatisfied.middleClass = 2>>
-<<else>> /*You are providing > 80% of their desired amount of sex*/
-	<<set $classSatisfied.middleClass = 1>>
-<</if>>
-
-<<if $sexDemandResult.upperClass < 400>> /*You are providing < 40% of their desired amount of sex*/
-	<<if $week <= 30>>
-		<<set $classSatisfied.upperClass = 0>>
-	<<else>>
-		<<set $classSatisfied.upperClass = -1>>
-	<</if>>
-<<elseif $sexDemandResult.upperClass < 600>> /*You are providing between 40 and 60% of their desired amount of sex*/
-	<<if $week <= 40>>
-		<<set $classSatisfied.upperClass = 1>>
-	<<elseif $week <= 60>>
-		<<set $classSatisfied.upperClass = 0>>
-	<<else>>
-		<<set $classSatisfied.upperClass = -1>>
-	<</if>>
-<<elseif $sexDemandResult.upperClass < 800>> /*You are providing between 60 and 80% of their desired amount of sex*/
-	<<if $week <= 50>>
-		<<set $classSatisfied.upperClass = 1>>
-	<<else>>
-		<<set $classSatisfied.upperClass = 0>>
-	<</if>>
-<<elseif $sexDemandResult.upperClass == 1000>> /*You are providing 100% or more of their desired amount of sex*/
-	<<set $classSatisfied.upperClass = 2>>
-<<else>> /*You are providing > 80% of their desired amount of sex*/
-	<<set $classSatisfied.upperClass = 1>>
-<</if>>
-
-<<if $sexDemandResult.topClass < 400>> /*You are providing < 40% of their desired amount of sex*/
-	<<if $week <= 30>>
-		<<set $classSatisfied.topClass = 0>>
-	<<else>>
-		<<set $classSatisfied.topClass = -1>>
-	<</if>>
-<<elseif $sexDemandResult.topClass < 600>> /*You are providing between 40 and 60% of their desired amount of sex*/
-	<<if $week <= 40>>
-		<<set $classSatisfied.topClass = 1>>
-	<<elseif $week <= 60>>
-		<<set $classSatisfied.topClass = 0>>
-	<<else>>
-		<<set $classSatisfied.topClass = -1>>
-	<</if>>
-<<elseif $sexDemandResult.topClass < 800>> /*You are providing between 60 and 80% of their desired amount of sex*/
-	<<if $week <= 50>>
-		<<set $classSatisfied.topClass = 1>>
-	<<else>>
-		<<set $classSatisfied.topClass = 0>>
-	<</if>>
-<<elseif $sexDemandResult.topClass == 1000>> /*You are providing 100% or more of their desired amount of sex*/
-	<<set $classSatisfied.topClass = 2>>
-<<else>> /*You are providing > 80% of their desired amount of sex*/
-	<<set $classSatisfied.topClass = 1>>
-<</if>>
-
-<br><br>
-
-<<for $i = 0; $i < _SL; $i++>>
-
-<<if ndef $slaves[$i].skill.whoring>>
-	@@.yellow;Reset bad whore skill for $slaves[$i].slaveName.@@ Report this as a bug if it reoccurs.<br>
-	<<set $slaves[$i].skill.whoring = 0>>
-<</if>>
-<<if ndef $slaves[$i].skill.entertainment>>
-	@@.yellow;Reset bad entertain skill for $slaves[$i].slaveName.@@ Report this as a bug if it reoccurs.<br>
-	<<set $slaves[$i].skill.entertainment = 0>>
-<</if>>
-<<if ndef $slaves[$i].skill.vaginal>>
-	@@.yellow;Reset bad vaginal skill for $slaves[$i].slaveName.@@ Report this as a bug if it reoccurs.<br>
-	<<set $slaves[$i].skill.vaginal = 0>>
-<</if>>
-<<if ndef $slaves[$i].skill.anal>>
-	@@.yellow;Reset bad anal skill for $slaves[$i].slaveName.@@ Report this as a bug if it reoccurs.<br>
-	<<set $slaves[$i].skill.anal = 0>>
-<</if>>
-<<if ndef $slaves[$i].skill.oral>>
-	@@.yellow;Reset bad skill for $slaves[$i].slaveName.@@ Report this as a bug if it reoccurs.<br>
-	<<set $slaves[$i].skill.oral = 0>>
-<</if>>
-
-<<if ($seeDicks > 0) && canPenetrate($slaves[$i]) && App.Utils.hasNonassignmentSex($slaves[$i])>>
-	<<set $averageDick += $slaves[$i].dick, $slavesWithWorkingDicks++>>
-<</if>>
-
-<<if ($slaves[$i].lactation == 1)>>
-	<<set $slaves[$i].lactationDuration-->>
-<</if>>
-
-<<switch $slaves[$i].assignment>>
-<<case "be your Head Girl">>
-	<<set $HeadGirl = $slaves[$i]>>
-	<<if $HeadGirl.fetish == "mindbroken">>
-		<span class='slave-name'>$HeadGirl.slaveName</span> is mindbroken @@.yellow;and cannot serve as your Head Girl any more.@@<br>
-		<<set $HeadGirl = 0>>
-	<<elseif !canTalk($HeadGirl)>>
-		<span class='slave-name'>$HeadGirl.slaveName</span> can't give slaves verbal orders @@.yellow;and cannot serve as your Head Girl any more.@@<br>
-		<<set $HeadGirl = 0>>
-	<<elseif !canWalk($HeadGirl)>>
-		<span class='slave-name'>$HeadGirl.slaveName</span> is no longer independently mobile @@.yellow;and cannot serve as your Head Girl any more.@@<br>
-		<<set $HeadGirl = 0>>
-	<<elseif !canHold($HeadGirl)>>
-		<span class='slave-name'>$HeadGirl.slaveName</span> is no longer able to handle your slaves @@.yellow;and cannot serve as your Head Girl any more.@@<br>
-		<<set $HeadGirl = 0>>
-	<<elseif !canSee($HeadGirl)>>
-		<span class='slave-name'>$HeadGirl.slaveName</span> can no longer see @@.yellow;and cannot serve as your Head Girl any more.@@<br>
-		<<set $HeadGirl = 0>>
-	<<elseif !canHear($HeadGirl)>>
-		<span class='slave-name'>$HeadGirl.slaveName</span> can no longer hear @@.yellow;and cannot serve as your Head Girl any more.@@<br>
-		<<set $HeadGirl = 0>>
-	<<elseif $HeadGirl.preg > 37 && $HeadGirl.broodmother == 2>>
-		<span class='slave-name'>$HeadGirl.slaveName</span> spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your Head Girl any longer.@@
-		<<set $HeadGirl = 0>>
-	<<elseif $HeadGirl.devotion <= 20>>
-		<span class='slave-name'>$HeadGirl.slaveName</span> is no longer even accepting of you, @@.yellow;and cannot serve as your Head Girl any more.@@<br>
-		<<set $HeadGirl = 0>>
-	<</if>>
-	<<if $HeadGirl != 0>>
-		<<set $HGEnergy++>>
-		<<if $personalAttention == "HG">>
-			<<set $HGEnergy++>>
-			<<if $HeadGirl.trust > 95>>
-				<<set $HGEnergy++>>
-			<</if>>
-		<</if>>
-		<<if $arcologies[0].FSChineseRevivalistLaw == 1>>
-			<<set $HGEnergy++>>
-		<</if>>
-		<<if $HeadGirl.health.tired > 90>>
-			<<set $HGEnergy-->>
-		<</if>>
-		<<if canAchieveErection($HeadGirl)>>
-			<<set $HGCum = 2+Math.trunc(($HeadGirl.balls/5)+($HeadGirl.energy/95)+($HeadGirl.health.condition/95)+($HeadGirl.devotion/95)+($reproductionFormula*5))>>
-		<</if>>
-	<<else>>
-		<<= removeJob($slaves[$i], "be your Head Girl")>>
-	<</if>>
-<<case "live with your Head Girl">>
-	<<if $slaves[$i].devotion >= random(-30,20)>>
-		<<set $HGSlaveSuccess++, $HGEnergy++>>
-	<<else>>
-		<<set $HGSlaveSuccess-->>
-	<</if>>
-<<case "recruit girls">>
-	<<set $Recruiter = $slaves[$i]>>
-	<<if $Recruiter.fetish == "mindbroken">>
-		<span class='slave-name'>$Recruiter.slaveName</span> is mindbroken @@.yellow;and cannot serve as your recruiter any more.@@<br>
-		<<set $Recruiter = 0>>
-	<<elseif !canTalk($Recruiter)>>
-		<span class='slave-name'>$Recruiter.slaveName</span> can't verbally entice marks @@.yellow;and cannot serve as your recruiter any more.@@<br>
-		<<set $Recruiter = 0>>
-	<<elseif $Recruiter.preg > 37 && $Recruiter.broodmother == 2>>
-		<span class='slave-name'>$Recruiter.slaveName</span> spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your recruiter any longer.@@
-		<<set $Recruiter = 0>>
-	<<elseif !canWalk($Recruiter)>>
-		<span class='slave-name'>$Recruiter.slaveName</span> is no longer independently mobile @@.yellow;and cannot serve as your recruiter any more.@@<br>
-		<<set $Recruiter = 0>>
-	<<elseif !canSee($Recruiter)>>
-		<span class='slave-name'>$Recruiter.slaveName</span> can no longer see @@.yellow;and cannot serve as your recruiter any more.@@<br>
-		<<set $Recruiter = 0>>
-	<<elseif !canHear($Recruiter)>>
-		<span class='slave-name'>$Recruiter.slaveName</span> can no longer hear @@.yellow;and cannot serve as your Recruiter any more.@@<br>
-		<<set $Recruiter = 0>>
-	<</if>>
-	<<if $Recruiter == 0>>
-		<<= removeJob($slaves[$i], "recruit girls")>>
-	<</if>>
-<<case "be the Madam">>
-	<<if $unMadam == 1>>
-		<span class='slave-name'>$Madam.slaveName</span> can't give whores verbal orders @@.yellow;and cannot serve as your Madam any more.@@<br>
-	<<elseif $unMadam == 2>>
-		<span class='slave-name'>$Madam.slaveName</span> spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your Madam any longer.@@
-	<<elseif $unMadam == 3>>
-		<span class='slave-name'>$Madam.slaveName</span> is mindbroken @@.yellow;and cannot serve as your Madam any more.@@<br>
-	<<elseif $unMadam == 4>>
-		<span class='slave-name'>$Madam.slaveName</span> is no longer independently mobile @@.yellow;and cannot serve as your Madam any more.@@<br>
-	<<elseif $unMadam == 5>>
-		<span class='slave-name'>$Madam.slaveName</span> can no longer see @@.yellow;and cannot serve as your Madam any more.@@<br>
-	<<elseif $unMadam == 6>>
-		<span class='slave-name'>$Madam.slaveName</span> can no longer hear @@.yellow;and cannot serve as your Madam any more.@@<br>
-	<<elseif $unMadam == 7>>
-		<span class='slave-name'>$Madam.slaveName</span> can no longer handle $his underlings @@.yellow;and cannot serve as your Madam any more.@@<br>
-	<</if>>
-	<<if $Madam == 0>>
-		<<= removeJob($slaves[$i], "be the Madam")>>
-	<</if>>
-<<case "be the DJ">>
-	<<if $unDJ == 1>>
-		<span class='slave-name'>$slaves[$i].slaveName</span> can't speak @@.yellow;and cannot serve as your DJ any more.@@<br>
-	<<elseif $unDJ == 2>>
-		<span class='slave-name'>$slaves[$i].slaveName</span> spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your DJ any longer@@.<br>
-	<<elseif $unDJ == 3>>
-		<span class='slave-name'>$slaves[$i].slaveName</span> is mindbroken @@.yellow;and cannot serve as your DJ any more.@@<br>
-	<<elseif $unDJ == 4>>
-		<span class='slave-name'>$slaves[$i].slaveName</span> is no longer independently mobile @@.yellow;and cannot serve as your DJ any more.@@<br>
-	<<elseif $unDJ == 5>>
-		<span class='slave-name'>$slaves[$i].slaveName</span> can no longer hear @@.yellow;and cannot serve as your DJ any more.@@<br>
-	<</if>>
-	<<if $DJ == 0>>
-		<<= removeJob($slaves[$i], "be the DJ")>>
-	<</if>>
-<<case "be the Milkmaid">>
-	<<set $Milkmaid = $slaves[$i]>>
-	<<if $Milkmaid.fetish == "mindbroken">>
-		<span class='slave-name'>$Milkmaid.slaveName</span> is mindbroken @@.yellow;and cannot serve as your Milkmaid any more.@@<br>
-		<<set $Milkmaid = 0>>
-	<<elseif $Milkmaid.preg > 37 && $Milkmaid.broodmother == 2>>
-		<span class='slave-name'>$Milkmaid.slaveName</span> spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your Milkmaid any longer.@@
-		<<set $Milkmaid = 0>>
-	<<elseif !canWalk($Milkmaid)>>
-		<span class='slave-name'>$Milkmaid.slaveName</span> is no longer independently mobile @@.yellow;and cannot serve as your Milkmaid any more.@@<br>
-		<<set $Milkmaid = 0>>
-	<<elseif !canHold($Milkmaid)>>
-		<span class='slave-name'>$Milkmaid.slaveName</span> can no longer handle nor milk your slaves @@.yellow;and cannot serve as your Milkmaid any more.@@<br>
-		<<set $Milkmaid = 0>>
-	<<elseif !canSee($Milkmaid)>>
-		<span class='slave-name'>$Milkmaid.slaveName</span> can no longer see @@.yellow;and cannot serve as your Milkmaid any more.@@<br>
-		<<set $Milkmaid = 0>>
-	<<elseif !canHear($Milkmaid)>>
-		<span class='slave-name'>$Milkmaid.slaveName</span> can no longer hear @@.yellow;and cannot serve as your Milkmaid any more.@@<br>
-		<<set $Milkmaid = 0>>
-	<</if>>
-	<<if $Milkmaid == 0>>
-		<<= removeJob($slaves[$i], "be the Milkmaid")>>
-	<</if>>
-<<case "be the Farmer">>
-	<<set $Farmer = $slaves[$i]>>
-	<<if $Farmer.fetish == "mindbroken">>
-		<span class='slave-name'>$Farmer.slaveName</span> is mindbroken @@.yellow;and cannot serve as your Farmer any more.@@<br>
-		<<set $Farmer = 0>>
-	<<elseif $Farmer.preg > 37 && $Farmer.broodmother == 2>>
-		<span class='slave-name'>$Farmer.slaveName</span> spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your Farmer any longer.@@
-		<<set $Farmer = 0>>
-	<<elseif !canWalk($Farmer)>>
-		<span class='slave-name'>$Farmer.slaveName</span> is no longer independently mobile @@.yellow;and cannot serve as your Farmer any more.@@<br>
-		<<set $Farmer = 0>>
-	<<elseif !canHold($Farmer)>>
-		<span class='slave-name'>$Farmer.slaveName</span> can no longer grip things @@.yellow;and cannot serve as your Farmer any more.@@<br>
-		<<set $Farmer = 0>>
-	<<elseif !canSee($Farmer)>>
-		<span class='slave-name'>$Farmer.slaveName</span> can no longer see @@.yellow;and cannot serve as your Farmer any more.@@<br>
-		<<set $Farmer = 0>>
-	<<elseif !canHear($Farmer)>>
-		<span class='slave-name'>$Farmer.slaveName</span> can no longer hear @@.yellow;and cannot serve as your Farmer any more.@@<br>
-		<<set $Farmer = 0>>
-	<</if>>
-	<<if $Farmer == 0>>
-		<<= removeJob($slaves[$i], "be the Farmer")>>
-	<</if>>
-<<case "be the Stewardess">>
-	<<set $Stewardess = $slaves[$i]>>
-	<<if !canTalk($Stewardess)>>
-		<span class='slave-name'>$Stewardess.slaveName</span> can't give servants verbal orders @@.yellow;and cannot serve as your Stewardess any more.@@<br>
-		<<set $Stewardess = 0>>
-	<<elseif $Stewardess.preg > 37 && $Stewardess.broodmother == 2>>
-		<span class='slave-name'>$Stewardess.slaveName</span> spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your Stewardess any longer.@@
-		<<set $Stewardess = 0>>
-	<<elseif $Stewardess.fetish == "mindbroken">>
-		<span class='slave-name'>$Stewardess.slaveName</span> is mindbroken @@.yellow;and cannot serve as your Stewardess any more.@@<br>
-		<<set $Stewardess = 0>>
-	<<elseif !canWalk($Stewardess)>>
-		<span class='slave-name'>$Stewardess.slaveName</span> is no longer independently mobile @@.yellow;and cannot serve as your Stewardess any more.@@<br>
-		<<set $Stewardess = 0>>
-	<<elseif !canHold($Stewardess)>>
-		<span class='slave-name'>$Stewardess.slaveName</span> can no longer handle $his underlings nor effectively clean @@.yellow;and cannot serve as your Stewardess any more.@@<br>
-		<<set $Stewardess = 0>>
-	<<elseif !canSee($Stewardess)>>
-		<span class='slave-name'>$Stewardess.slaveName</span> can no longer see @@.yellow;and cannot serve as your Stewardess any more.@@<br>
-		<<set $Stewardess = 0>>
-	<<elseif !canHear($Stewardess)>>
-		<span class='slave-name'>$Stewardess.slaveName</span> can no longer hear @@.yellow;and cannot serve as your Stewardess any more.@@<br>
-		<<set $Stewardess = 0>>
-	<</if>>
-	<<if $Stewardess == 0>>
-		<<= removeJob($slaves[$i], "be the Stewardess")>>
-	<</if>>
-<<case "be the Schoolteacher">>
-	<<set $Schoolteacher = $slaves[$i]>>
-	<<if !canTalk($Schoolteacher)>>
-		<span class='slave-name'>$Schoolteacher.slaveName</span> can't give verbal instruction @@.yellow;and cannot serve as your Schoolteacher any more.@@<br>
-		<<set $Schoolteacher = 0>>
-	<<elseif $Schoolteacher.preg > 37 && $Schoolteacher.broodmother == 2>>
-		<span class='slave-name'>$Schoolteacher.slaveName</span> spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your Schoolteacher any longer.@@
-		<<set $Schoolteacher = 0>>
-	<<elseif $Schoolteacher.fetish == "mindbroken">>
-		<span class='slave-name'>$Schoolteacher.slaveName</span> is mindbroken @@.yellow;and cannot serve as your Schoolteacher any more.@@<br>
-		<<set $Schoolteacher = 0>>
-	<<elseif !canSee($Schoolteacher)>>
-		<span class='slave-name'>$Schoolteacher.slaveName</span> can no longer see @@.yellow;and cannot serve as your Schoolteacher any more.@@<br>
-		<<set $Schoolteacher = 0>>
-	<<elseif !canHear($Schoolteacher)>>
-		<span class='slave-name'>$Schoolteacher.slaveName</span> can no longer hear @@.yellow;and cannot serve as your Schoolteacher any more.@@<br>
-		<<set $Schoolteacher = 0>>
-	<</if>>
-	<<if $Schoolteacher == 0>>
-		<<= removeJob($slaves[$i], "be the Schoolteacher")>>
-	<</if>>
-<<case "be the Wardeness">>
-	<<set $Wardeness = $slaves[$i]>>
-	<<if !canWalk($Wardeness)>>
-		<span class='slave-name'>$Wardeness.slaveName</span> is no longer independently mobile @@.yellow;and cannot serve as your Wardeness any more.@@<br>
-		<<set $Wardeness = 0>>
-	<<elseif !canHold($Wardeness)>>
-		<span class='slave-name'>$Wardeness.slaveName</span> can no longer handle $his charges @@.yellow;and cannot serve as your Wardeness any more.@@<br>
-		<<set $Wardeness = 0>>
-	<<elseif $Wardeness.preg > 37 && $Wardeness.broodmother == 2>>
-		<span class='slave-name'>$Wardeness.slaveName</span> spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your Wardeness any longer.@@
-		<<set $Wardeness = 0>>
-	<<elseif !canSee($Wardeness)>>
-		<span class='slave-name'>$Wardeness.slaveName</span> can no longer see @@.yellow;and cannot serve as your Wardeness any more.@@<br>
-		<<set $Wardeness = 0>>
-	<<elseif !canHear($Wardeness)>>
-		<span class='slave-name'>$Wardeness.slaveName</span> can no longer hear @@.yellow;and cannot serve as your Wardeness any more.@@<br>
-		<<set $Wardeness = 0>>
-	<</if>>
-	<<if $Wardeness == 0>>
-		<<= removeJob($slaves[$i], "be the Wardeness")>>
-	<</if>>
-<<case "be the Attendant">>
-	<<if _S.Attendant.fetish == "mindbroken">>
-		<span class='slave-name'>_S.Attendant.slaveName</span> is mindbroken @@.yellow;and cannot serve as your Attendant any more.@@<br>
-		<<set $AttendantID = 0>>
-	<<elseif _S.Attendant.preg > 37 && _S.Attendant.broodmother == 2>>
-		<span class='slave-name'>_S.Attendant.slaveName</span> spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your Attendant any longer.@@
-		<<set $AttendantID = 0>>
-	<<elseif !canWalk(_S.Attendant)>>
-		<span class='slave-name'>_S.Attendant.slaveName</span> is no longer independently mobile @@.yellow;and cannot serve as your Attendant any more.@@<br>
-		<<set $AttendantID = 0>>
-	<<elseif !canHold(_S.Attendant)>>
-		<span class='slave-name'>_S.Attendant.slaveName</span> can no longer support $his charges @@.yellow;and cannot serve as your Attendant any more.@@<br>
-		<<set $AttendantID = 0>>
-	<<elseif !canHear(_S.Attendant)>>
-		<span class='slave-name'>_S.Attendant.slaveName</span> can no longer hear @@.yellow;and cannot serve as your Attendant any more.@@<br>
-		<<set $AttendantID = 0>>
-	<</if>>
-	<<if $AttendantID == 0>>
-		<<= removeJob($slaves[$i], "be the Attendant")>>
-	<</if>>
-<<case "be the Matron">>
-	<<set $Matron = $slaves[$i]>>
-	<<if $Matron.fetish == "mindbroken">>
-		<span class='slave-name'>$Matron.slaveName</span> is mindbroken @@.yellow;and cannot serve as your Matron any more.@@<br>
-		<<set $Matron = 0>>
-	<<elseif $Matron.preg > 37 && $Matron.broodmother == 2>>
-		<span class='slave-name'>$Matron.slaveName</span> spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your Matron any longer.@@
-		<<set $Matron = 0>>
-	<<elseif !canWalk($Matron)>>
-		<span class='slave-name'>$Matron.slaveName</span> is no longer independently mobile @@.yellow;and cannot serve as your Matron any more.@@<br>
-		<<set $Matron = 0>>
-	<<elseif !canHold($Matron)>>
-		<span class='slave-name'>$Matron.slaveName</span> can no longer hold infants @@.yellow;and cannot serve as your Matron any more.@@<br>
-		<<set $Matron = 0>>
-	<<elseif !canHear($Matron)>>
-		<span class='slave-name'>$Matron.slaveName</span> can no longer hear @@.yellow;and cannot serve as your Matron any more.@@<br>
-		<<set $Matron = 0>>
-	<<elseif !canSee($Matron)>>
-		<span class='slave-name'>$Matron.slaveName</span> can no longer see @@.yellow;and cannot serve as your Matron any more.@@<br>
-		<<set $Matron = 0>>
-	<</if>>
-	<<if $Matron == 0>>
-		<<= removeJob($slaves[$i], "be the Matron")>>
-	<</if>>
-<<case "be the Nurse">>
-	<<set $Nurse = $slaves[$i]>>
-	<<if $Nurse.fetish == "mindbroken">>
-		<span class='slave-name'>$Nurse.slaveName</span> is mindbroken @@.yellow;and cannot serve as your Nurse any more.@@<br>
-		<<set $Nurse = 0>>
-	<<elseif $Nurse.preg > 37 && $Nurse.broodmother == 2>>
-		<span class='slave-name'>$Nurse.slaveName</span> spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your Nurse any longer.@@
-		<<set $Nurse = 0>>
-	<<elseif !canWalk($Nurse)>>
-		<span class='slave-name'>$Nurse.slaveName</span> is no longer independently mobile @@.yellow;and cannot serve as your Nurse any more.@@<br>
-		<<set $Nurse = 0>>
-	<<elseif !canHold($Nurse)>>
-		<span class='slave-name'>$Nurse.slaveName</span> can no longer hold onto patients @@.yellow;and cannot serve as your Nurse any more.@@<br>
-		<<set $Nurse = 0>>
-	<<elseif !canSee($Nurse)>>
-		<span class='slave-name'>$Nurse.slaveName</span> can no longer see @@.yellow;and cannot serve as your Nurse any more.@@<br>
-		<<set $Nurse = 0>>
-	<<elseif !canHear($Nurse)>>
-		<span class='slave-name'>$Nurse.slaveName</span> can no longer hear @@.yellow;and cannot serve as your Nurse any more.@@<br>
-		<<set $Nurse = 0>>
-	<</if>>
-	<<if $Nurse == 0>>
-		<<= removeJob($slaves[$i], "be the Nurse")>>
-	<</if>>
-<<case "guard you">>
-	<<set $Bodyguard = $slaves[$i]>>
-	<<if $Bodyguard.fetish == "mindbroken">>
-		<span class='slave-name'>$Bodyguard.slaveName</span> is mindbroken @@.yellow;and cannot safely serve as your bodyguard any more.@@<br>
-		<<set $Bodyguard = 0>>
-	<<elseif !canWalk($Bodyguard)>>
-		<span class='slave-name'>$Bodyguard.slaveName</span> is no longer independently mobile @@.yellow;and cannot serve as your bodyguard any more.@@<br>
-		<<set $Bodyguard = 0>>
-	<<elseif !canHold($Bodyguard)>>
-		<span class='slave-name'>$Bodyguard.slaveName</span> is no longer able to hold a weapon @@.yellow;and cannot serve as your bodyguard any more.@@<br>
-		<<set $Bodyguard = 0>>
-	<<elseif $Bodyguard.preg > 37 && $Bodyguard.broodmother == 2>>
-		<span class='slave-name'>$Bodyguard.slaveName</span> spends so much time giving birth and laboring that @@.yellow;$he cannot effectively serve as your bodyguard any longer.@@
-		<<set $Bodyguard = 0>>
-	<<elseif !canSee($Bodyguard)>>
-		<span class='slave-name'>$Bodyguard.slaveName</span> can no longer see @@.yellow;and cannot serve as your Bodyguard any more.@@<br>
-		<<set $Bodyguard = 0>>
-	<<elseif !canHear($Bodyguard)>>
-		<span class='slave-name'>$Bodyguard.slaveName</span> can no longer hear @@.yellow;and cannot serve as your Bodyguard any more.@@<br>
-		<<set $Bodyguard = 0>>
-	<</if>>
-	<<if $Bodyguard == 0>>
-		<<= removeJob($slaves[$i], "guard you")>>
-	<</if>>
-<<case "be your Concubine">>
-	<<set $Concubine = $slaves[$i], $fuckSlaves++>>
-<<case "serve in the master suite" "please you">>
-	<<set $fuckSlaves++>>
-<<case "be a subordinate slave">>
-	<<if $slaves[$i].subTarget == -1>>
-		<<set $StudID = $slaves[$i].ID>>
-		<<set _Stud = slaveStateById($StudID)>>
-		<<if _Stud.balls == 0>>
-			<span class='slave-name'>_Stud.slaveName</span> no longer has sperm @@.yellow;and cannot serve as a Stud any more.@@<br>
-			<<set $StudID = 0>>
-		<<elseif _Stud.ballType == "sterile">>
-			<span class='slave-name'>_Stud.slaveName</span> no longer produces potent sperm @@.yellow;and cannot serve as a Stud any more.@@<br>
-			<<set $StudID = 0>>
-		<<elseif _Stud.pubertyXY != 1>>
-			<span class='slave-name'>_Stud.slaveName</span> no longer produces mature sperm @@.yellow;and cannot serve as a Stud any more.@@<br>
-			<<set $StudID = 0>>
-		<<elseif _Stud.vasectomy == 1>>
-			<span class='slave-name'>_Stud.slaveName</span> shoots blanks due to a vasectomy @@.yellow;and cannot serve as a Stud any more.@@<br>
-			<<set $StudID = 0>>
-		<<elseif $universalRulesImpregnation != "Stud">>
-			<span class='slave-name'>_Stud.slaveName</span> is @@.yellow;no longer needed as a Stud.@@
-		<</if>>
-		<<if $StudID == 0>>
-			<<set $slaves[$i].subTarget = 0>>
-		<<else>>
-			<<set $StudCum = 2+Math.trunc(((_Stud.balls/5)+(_Stud.energy/95)+(_Stud.health.condition/95)+(_Stud.devotion/95)+($reproductionFormula*5)-(_Stud.health.tired/25))*healthPenalty(_Stud))>>
-			<<if _Stud.drugs == "hyper testicle enhancement">>
-				<<set $StudCum += 3>>
-			<<elseif _Stud.drugs == "testicle enhancement">>
-				<<set $StudCum += 1>>
-			<</if>>
-			<<if _Stud.diet == "cum production">>
-				<<set $StudCum += 1>>
-			<</if>>
-		<</if>>
-	<</if>>
-<</switch>>
-
-<<if $slaves[$i].ID == $LurcherID>>
-	<<set _Lurcher = slaveStateById($LurcherID)>>
-	<<if !canWalk(_Lurcher)>>
-		<span class='slave-name'>_Lurcher.slaveName</span> is no longer able to run @@.yellow;and cannot course as a lurcher.@@<br>
-		<<set $LurcherID = 0>>
-	<<elseif !canHold(_Lurcher)>>
-		<span class='slave-name'>_Lurcher.slaveName</span> is no longer able to catch the hares @@.yellow;and cannot course as a lurcher.@@<br>
-		<<set $LurcherID = 0>>
-	<<elseif !canHear(_Lurcher) && !canSee(_Lurcher)>>
-		<span class='slave-name'>$Lurcher.slaveName</span> is no longer able to track the hares @@.yellow;and cannot course as a lurcher.@@<br>
-		<<set $LurcherID = 0>>
-	<<elseif _Lurcher.bellyPreg >= 60000>>
-		<span class='slave-name'>$Lurcher.slaveName</span> is too pregnant to run @@.yellow;and cannot course as a lurcher.@@
-		<<set $LurcherID = 0>>
-	<</if>>
-<</if>>
-
-<<if $fighterIDs.includes($slaves[$i])>>
-	<<if !canWalk($slaves[$i])>>
-		<span class='slave-name'>$slaves[$i].slaveName</span> is no longer independently mobile @@.yellow;and cannot fight any more.@@ $He has been removed from $pitName roster<br>.
-		<<set $fighterIDs.delete($slaves[$i].ID)>>
-	<<elseif !canHold($slaves[$i])>>
-		<span class='slave-name'>$slaves[$i].slaveName</span> is no longer able to strike @@.yellow;and cannot fight any more.@@ $He has been removed from $pitName roster<br>.
-		<<set $fighterIDs.delete($slaves[$i].ID)>>
-	<</if>>
-<</if>>
-
-<<if $slaves[$i].bellyPain != 0>>
-	<<set $slaves[$i].bellyPain = 0>>
-<</if>>
-
-/* preg speed and advance*/
-
-<<if $slaves[$i].preg > 0>>
-	<<set _pregSpeed = 1>> /*base speed is normal*/
-	<<if $slaves[$i].pregControl == "slow gestation">>
-		<<set _pregSpeed = 0.5>>
-	<<elseif $slaves[$i].pregControl == "speed up">>
-		<<set _pregSpeed = 2>>
-	<</if>>
-
-	<<if $slaves[$i].broodmother == 1 && $slaves[$i].broodmotherOnHold != 1>> /* broodmother advance block */
-		<<if ($week / $slaves[$i].broodmotherFetuses == Math.round($week / $slaves[$i].broodmotherFetuses)) && $slaves[$i].broodmotherFetuses < 1>>
-			/*one fetus in few week - selection and adding*/
-			<<set WombImpregnate($slaves[$i], 1, $slaves[$i].pregSource, 0)>>
-		<<else>>
-			/*one or more fetuses in one week*/
-			<<set WombImpregnate($slaves[$i], Math.floor($slaves[$i].broodmotherFetuses), $slaves[$i].pregSource, 0)>> /* really 0, it's will be advanced right few lines down.*/
-		<</if>>
-		<<if $slaves[$i].ovaryAge >= 47>>
-			<<set $slaves[$i].broodmotherOnHold = 1 >>
-			<<set $slaves[$i].broodmotherCountDown = 37 - WombMinPreg($slaves[$i])>>
-		<</if>>
-	<</if>>
-
-	<<set WombProgress($slaves[$i], _pregSpeed, 1)>> /* drugs can affect speed of gestation, but not a real time */
-
-	<<set $slaves[$i].pregKnown = 1>>
-	<<set $slaves[$i].pregWeek++>>
-<</if>>
-<<if $slaves[$i].pregWeek < 0 >> /*postpartum state*/
-	<<set $slaves[$i].pregWeek++>>
-<</if>>
-
-<<run SetBellySize($slaves[$i])>> /* here will be also set through WombGetVolume .bellyPreg, .pregType, to current values. */
-
-/* end of preg speed and advance*/
-
-/* set up sexual need */
-<<if $slaves[$i].devotion >= -50>>
-	<<if $slaves[$i].energy > 20>>
-		<<if $slaves[$i].physicalAge < $slaves[$i].pubertyAgeXY && $slaves[$i].genes == "XY" && $slaves[$i].energy <= 80>>
-			<<set $slaves[$i].need = $slaves[$i].energy/3>>
-		<<elseif $slaves[$i].physicalAge < $slaves[$i].pubertyAgeXX && $slaves[$i].genes == "XX" && $slaves[$i].energy <= 80>>
-			<<set $slaves[$i].need = $slaves[$i].energy/3>>
-		<<elseif $slaves[$i].physicalAge < 50>>
-			<<set $slaves[$i].need = $slaves[$i].energy>>
-		<<else>>
-			<<set $slaves[$i].need = $slaves[$i].energy/5>>
-		<</if>>
-		<<if $slaves[$i].balls > 0 && $slaves[$i].pubertyXY == 1 && $slaves[$i].physicalAge <= ($slaves[$i].pubertyAgeXY + 1) && ($slaves[$i].physicalAge > $slaves[$i].pubertyAgeXY) && $slaves[$i].physicalAge < 18>>
-			<<set $slaves[$i].need = ($slaves[$i].need*1.25)>>
-		<</if>>
-		<<if ($slaves[$i].ovaries == 1 || $slaves[$i].mpreg == 1) && $slaves[$i].pubertyXX == 1 && $slaves[$i].physicalAge <= ($slaves[$i].pubertyAgeXX + 1) && ($slaves[$i].physicalAge > $slaves[$i].pubertyAgeXX) && $slaves[$i].physicalAge < 18>>
-			<<set $slaves[$i].need = ($slaves[$i].need*1.25)>>
-		<</if>>
-		<<if $slaves[$i].diet == "fertility">>
-			<<set $slaves[$i].need += 10>>
-		<</if>>
-		<<if $slaves[$i].aphrodisiacs == -1>>
-			<<set $slaves[$i].need = ($slaves[$i].need*0.5)>>
-		<<elseif $slaves[$i].aphrodisiacs == 1>>
-			<<set $slaves[$i].need = ($slaves[$i].need*1.5)>>
-		<<elseif $slaves[$i].aphrodisiacs == 2>>
-			<<set $slaves[$i].need = ($slaves[$i].need*2)>>
-		<</if>>
-		<<run poorHealthNeedReduction($slaves[$i])>>
-		<<set $slaves[$i].need = Math.round($slaves[$i].need)>>
-		<<set $slaves[$i].needCap = $slaves[$i].need>>
-	<</if>>
-	/* Stud gets off based on impregnations, so we need to check and see if they actually do anyone */
-	<<if $StudID>>
-		<<set _studCumLimit = $StudCum>>
-		<<for _sar = 0; _sar < _SL; _sar++>>
-			<<if _studCumLimit == 0 || _Stud.need <= 0>>
-				<<break>>
-			<</if>>
-			<<if canGetPregnant($slaves[$i]) && canBreed(_Stud, $slaves[$i]) && $slaves[$i].ID != $StudID>>
-				<<set _Stud.need -= 20>>
-				<<if _Stud.fetish == "pregnancy">>
-					<<set _Stud.need -= 30>>
-				<</if>>
-			<</if>>
-		<</for>>
-	<</if>>
-<</if>>
-
-<<if $slaves[$i].fetish == "mindbroken" && $slaves[$i].relationship == -3>>
-	<<if (def $slaves[$i].kindness) && $slaves[$i].kindness > 0>>
-		<<set $slaves[$i].kindness-->>
-	<</if>>
-<</if>>
-
-<<if $slaves[$i].assignment == "be your agent" || $slaves[$i].assignment == "live with your agent">>
-	<<include "SA agent">>
-<</if>>
-
-<</for>>
-
-<<if $averageDick > 0>><<set $averageDick = $averageDick/$slavesWithWorkingDicks>><</if>>
-<<set $freeSexualEnergy = $PC.sexualEnergy-$fuckSlaves>>
-<<set _penthouseSlaves = App.Entity.facilities.penthouse.employees().length>>
-<<if $freeSexualEnergy > 0>>
-	<<if $freeSexualEnergy > _penthouseSlaves/2>>
-		<<set $freeSexualEnergy = 3>>
-	<<elseif $freeSexualEnergy > _penthouseSlaves/4>>
-		<<set $freeSexualEnergy = 2>>
-	<<else>>
-		<<set $freeSexualEnergy = 1>>
-	<</if>>
-<</if>>
-
-<<if $HeadGirl>>
-	<<set _HGPossibleSlaves = [[], [], [], [], [], []]>>
-	<<for $i = 0; $i < _SL; $i++>>
-		<<set _Slave = $slaves[$i]>>
-		<<if !assignmentVisible(_Slave) || _Slave.fuckdoll == 1 || _Slave.ID == $Bodyguard.ID || _Slave.ID == $HeadGirl.ID || _Slave.fetish == "mindbroken">>
-			<<continue>>
-		<<elseif Array.isArray($personalAttention) && $personalAttention.findIndex(function(s) { return s.ID == _Slave.ID; }) != -1>>
-			<<continue>>
-		<</if>>
-
-		<<if ($headGirlTrainsHealth && _Slave.health.condition < -20)>>
-			<<set _HGPossibleSlaves[0].push({ID: _Slave.ID, training: "health"})>>
-			<<continue>>
-		<</if>>
-
-		<<if _Slave.health.tired < 50>>
-			<<set _hasParaphilia = (["abusive", "anal addict", "attention whore", "breast growth", "breeder", "cum addict", "malicious", "neglectful", "self hating"].includes(_Slave.sexualFlaw))>>
-			<<if ($headGirlTrainsParaphilias && _hasParaphilia)>>
-				<<set _HGPossibleSlaves[1].push({ID: _Slave.ID, training: "paraphilia"})>>
-				<<continue>>
-			<</if>>
-
-			<<if $headGirlTrainsFlaws || $headGirlSoftensFlaws>>
-				<<if _Slave.behavioralFlaw != "none" || (_Slave.sexualFlaw != "none" && !_hasParaphilia)>>
-					<<if $headGirlSoftensFlaws>>
-						<<if _Slave.devotion > 20>>
-							<<if (_Slave.behavioralFlaw != "none" && _Slave.behavioralQuirk == "none") || (_Slave.sexualFlaw != "none" && _Slave.sexualQuirk == "none" && !_hasParaphilia)>>
-								<<set _HGPossibleSlaves[3].push({ID: _Slave.ID, training: "soften"})>>
-							<<else>>
-								<<set _HGPossibleSlaves[3].push({ID: _Slave.ID, training: "flaw"})>>
-							<</if>>
-							<<continue>>
-						<</if>>
-					<<elseif $headGirlTrainsFlaws>>
-						<<set _HGPossibleSlaves[2].push({ID: _Slave.ID, training: "flaw"})>>
-						<<continue>>
-					<</if>>
-				<</if>>
-			<</if>>
-
-			<<if ($headGirlTrainsObedience && _Slave.devotion <= 20 && _Slave.trust >= -20)>>
-				<<set _HGPossibleSlaves[4].push({ID: _Slave.ID, training: "obedience"})>>
-				<<continue>>
-			<</if>>
-
-			<<if ($headGirlTrainsSkills)>>
-				<<if (_Slave.skill.oral < $HeadGirl.skill.oral)>>
-					<<set _HGPossibleSlaves[5].push({ID: _Slave.ID, training: "oral skill"})>>
-				<<elseif (_Slave.skill.vaginal < $HeadGirl.skill.vaginal) && (_Slave.vagina > 0) && (canDoVaginal(_Slave))>>
-					<<set _HGPossibleSlaves[5].push({ID: _Slave.ID, training: "fuck skill"})>>
-				<<elseif (_Slave.skill.anal < $HeadGirl.skill.anal) && (_Slave.anus > 0) && (canDoAnal(_Slave))>>
-					<<set _HGPossibleSlaves[5].push({ID: _Slave.ID, training: "anal skill"})>>
-				<<elseif (_Slave.skill.whoring < $HeadGirl.skill.whoring)>>
-					<<set _HGPossibleSlaves[5].push({ID: _Slave.ID, training: "whore skill"})>>
-				<<elseif (_Slave.skill.entertainment < $HeadGirl.skill.entertainment) && !isAmputee(_Slave)>>
-					<<set _HGPossibleSlaves[5].push({ID: _Slave.ID, training: "entertain skill"})>>
-				<</if>>
-			<</if>>
-		<</if>>
-	<</for>>
-	<<set $HGTrainSlavesIDs = _HGPossibleSlaves.flatten().slice(0, $HGEnergy)>>
-<<else>>
-	<<set $HGTrainSlavesIDs = []>>
-<</if>>
-
-/**
-* Accordion
-* @version 0.7RC
-* @author 000-250-006
-*
-* @param array _facListArr $args
-*	Multidimensional temporary array
-*	0: The passage name for the facility's report
-*	1: The facility name capitalized (@see todo)
-*	2: max number of slaves allowed in facility - > 0 implies open
-*	3: number of slaves assigned to facility
-*	4: ID of the slave assigned to run the facility ("Boss")
-*	5: Text title of the Boss
-*
-* @todo This is a proof of concept construct, if it works and cuts overhead, intended to create an object
-*	for deeper use in multiple locations, including streamlining reports/facilities code to one widget
-* @todo Figure out if this would be better as an object rather than an array for overhead
-*	StoryInit also?
-* @todo Figure out why we're not using ndef/-1 for a bunch of these story variables. Leaky conditionals
-* @todo Figure out why we're using variable space with capitalized facility names when we can parse it from true name
-*/
-
-<<set _penthouseReportLength = App.Entity.facilities.penthouse.employees().length + $HGSuiteiIDs.length>>
-<<set _facListArr = [
-	["Arcade Report", $arcadeNameCaps, $arcade, $ArcadeiIDs.length, -1, -1],
-	["Brothel Report", $brothelNameCaps, $brothel, $BrothiIDs.length, $Madam, "Madam"],
-	["Cellblock Report", $cellblockNameCaps, $cellblock, $CellBiIDs.length, $Wardeness, "Wardeness"],
-	["Clinic Report", $clinicNameCaps, $clinic, $CliniciIDs.length, $Nurse, "Nurse"],
-	["Club Report", $clubNameCaps, $club, $ClubiIDs.length, $DJ, "DJ"],
-	["Dairy Report", $dairyNameCaps, $dairy, $DairyiIDs.length, $Milkmaid, "Milkmaid"],
-	["Farmyard Report", $farmyardNameCaps, $farmyard, $FarmyardiIDs.length, $Farmer, "Farmer"],
-	["Schoolroom Report", $schoolroomNameCaps, $schoolroom, $SchlRiIDs.length, $Schoolteacher, "Schoolteacher"],
-	["Spa Report", $spaNameCaps, $spa, $SpaiIDs.length, $AttendantID, "Attendant"],
-	["Nursery Report", $nurseryNameCaps, $nurseryNannies, $NurseryiIDs.length, $Matron, "Matron"],
-	["Servants' Quarters Report", $servantsQuartersNameCaps, $servantsQuarters, $ServQiIDs.length, $Stewardess, "Stewardess"],
-	["Children Report", "Nursery Children", $nursery, $nurseryBabies, -1, -1],
-	["Incubator Report", $incubatorNameCaps, $incubator, $incubatorSlaves, -1, -1],
-	["Master Suite Report", $masterSuiteNameCaps, $masterSuite, $MastSiIDs.length, $Concubine, "Concubine"],
-	["Penthouse Report", "The Penthouse", 1, _penthouseReportLength, -1, -1],
-	["Rules Assistant Report", "Rules Assistant", $rulesAssistantAuto, 1, -1, -1] /** should be last — may reassign slaves **/
-]>>
-
-<<for _ii = 0; _ii < _facListArr.length; _ii++>>
-	<<set _facSubArr = _facListArr[_ii], _accText = "", _disTxt = " disabled='disabled'">> /** Chunk the row from our array we're working on to make reading code easier, null some text vars we'll need */
-	<<set _str = _facSubArr[0].replace(/\W+/g, '-').toLowerCase()>> /** Normalize the passage name to use as an element ID */
-	<<if _facSubArr[2] > 0>> /** Do we have one of these facilities? */
-		<<if $useAccordion > 0>> <<set _accText = " accordion", _disTxt = "">> <</if>> /** Is Accordion turned on? */
-		<<if (_facSubArr[3] == 0) && (_facSubArr[4] <= 0)>> /** Is there anyone inside the facility? */
-			''_facSubArr[1] Report''<hr style="margin:0"> /** No — it's empty, so we display the heading without a button and with a thinner bar under it */
-			@@.gray;_facSubArr[1] is currently empty.@@
-			<br><br>
-			/** Old code: <<= '<div id="button-' + _str + '" class="unStaffed">' + _facSubArr[1] + ' is currently unstaffed</div>'>> */
-		<<else>>
-			<<if _facSubArr[1] == "Rules Assistant">>
-				<<= '<button type="button"' + _disTxt + ' id="button-' + _str + '" class="buttonBar' + _accText + '" data-after="' + '">' + _facSubArr[1] + ' Report</button>'>> /** Yes, display the bar with information */
-			<<else>>
-				<<= '<button type="button"' + _disTxt + ' id="button-' + _str + '" class="buttonBar' + _accText + '" data-after="' + _facSubArr[3] + ' slaves in ' + _facSubArr[1] + '">' + _facSubArr[1] + ' Report</button>'>> /** Yes, display the bar with information */
-			<</if>>
-			<<if $useAccordion == 0>>
-				<br>
-				<<include `_facSubArr[0]`>> /** not using accordion — just include the report under the disabled button above */
-				<br>
-			<</if>>
-		<</if>>
-		<div class="accHidden">
-			<<if $useAccordion == 1>>
-				<<include `_facSubArr[0]`>> /** OK, we're done with the pretty stuff, go get the guts and collapse it into the accordion */
-			<</if>>
-		</div>
-	<</if>>
-	<<unset _facSubArr>>
-<</for>>
-
-/* IMPORTANT FOR REASONS!!! */
-<<unset _ii>>
-/** /Accordion */
-
-<<if ($researchLab.level > 0)>>
-	<<include "Lab Report">><br><br>
-<</if>>
-
+<<print App.UI.DOM.includeDOM(App.EndWeek.slaveAssignmentReport(), "weeklyReport", "div")>>
 /* release loading screen as soon as the event loop can run */
 <<run App.UI.EndWeekAnim.end()>>
diff --git a/src/uncategorized/spa.tw b/src/uncategorized/spa.tw
index 0b0c95cdaa65706a88657e2f1c43a48993b3d348..b303ae697776f895b4233c47e5cc6666b5d531fd 100644
--- a/src/uncategorized/spa.tw
+++ b/src/uncategorized/spa.tw
@@ -1,6 +1,6 @@
 :: Spa [nobr]
 
-<<set $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Spa", $showEncyclopedia = 1, $encyclopedia = "Spa">>
+<<set _DL = App.Entity.facilities.spa.employeesIDs().size, $nextButton = "Back to Main", $nextLink = "Main", $returnTo = "Spa", $showEncyclopedia = 1, $encyclopedia = "Spa">>
 
 <<if $spaName != "the Spa">>
 	<<set $spaNameCaps = $spaName.replace("the ", "The ")>>
@@ -75,9 +75,9 @@
 		It's busy in here. Slaves are relaxing in the warm water, splashing around or just floating. Here and there some of the more sex-starved are in the early stages of intercourse, but most prefer to take time off from it all.
 	<<elseif _spaUtilization > 0>>
 		It's sparsely populated; though the few slaves here have little company they like having the water to themselves.
-	<<elseif $SpaiIDs.length / $spa > 0.5>>
+	<<elseif _DL / $spa > 0.5>>
 		It's busy in here. Slaves are relaxing in the warm water, splashing around or just floating. Here and there some of the more sex-starved are in the early stages of intercourse, but most prefer to take time off from it all.
-	<<elseif $SpaiIDs.length > 0>>
+	<<elseif _DL > 0>>
 		It's sparsely populated; though the few slaves here have little company they like having the water to themselves.
 	<<elseif _S.Attendant>>
 		<<setLocalPronouns _S.Attendant>>
@@ -85,7 +85,7 @@
 	<<else>>
 		It's empty and quiet.
 	<</if>>
-	<<if $SpaiIDs.length == 0 && !_S.Attendant>>
+	<<if _DL == 0 && !_S.Attendant>>
 		<div class="choices" style="font-style:normal">
 			[[Decommission the Spa|Main][$spa = 0, $spaDecoration = "standard", $spaUpgrade = 0, $spaFix = 0]]
 		</div>
@@ -94,7 +94,7 @@
 
 <div>
 	<<set _Tmult0 = Math.trunc($spa*1000*$upgradeMultiplierArcology)>>
-	$spaNameCaps can house $spa slaves while they recuperate here. There <<if $SpaiIDs.length == 1>>is<<else>>are<</if>> currently $SpaiIDs.length slave<<if $SpaiIDs.length != 1>>s<</if>> recuperating in $spaName.
+	$spaNameCaps can house $spa slaves while they recuperate here. There <<if _DL == 1>>is<<else>>are<</if>> currently _DL slave<<if _DL != 1>>s<</if>> recuperating in $spaName.
 	<div class="choices">
 		[[Expand the spa|Spa][cashX(forceNeg(_Tmult0), "capEx"), $spa += 5]]
 		<span class="note">
@@ -102,7 +102,7 @@
 		</span>
 	</div>
 	<div class="choices">
-		<<if $SpaiIDs.length > 0>>
+		<<if _DL > 0>>
 			<<removeFacilityWorkers "spa" "rest" "rest">>
 		<</if>>
 	</div>
diff --git a/src/uncategorized/spaReport.tw b/src/uncategorized/spaReport.tw
index c5f0677838c68800983cd2131351736086b88596..6f249933801e47e74112daf37445a59ecc6acbab 100644
--- a/src/uncategorized/spaReport.tw
+++ b/src/uncategorized/spaReport.tw
@@ -1,7 +1,7 @@
 :: Spa Report [nobr]
 
-<<SlaveIDSort $SpaiIDs>>
-<<set _DL = $SpaiIDs.length, _SL = $slaves.length, _bonusToggle = 0, _healthBonus = 0, _idleBonus = 0, _restedSlaves = 0, _trustBonus = 0>>
+<<set _slaves = App.Utils.sortedEmployees(App.Entity.facilities.spa)>>
+<<set _DL = _slaves.length, _SL = $slaves.length, _bonusToggle = 0, _healthBonus = 0, _idleBonus = 0, _restedSlaves = 0, _trustBonus = 0>>
 
 <<if $spaDecoration != "standard">>
 	<<set _devBonus = 1>>
@@ -80,120 +80,120 @@
 		<<set _idleBonus++, _healthBonus++>>
 	<</if>>
 	<<set _attendantUsedCure = 0>>
-	<<for _dI = 0; _dI < _DL; _dI++>>
-		<<set $i = $slaveIndices[$SpaiIDs[_dI]]>>
-		<<setLocalPronouns $slaves[$i] 2>>
-		<<if ($slaves[$i].fetish == "mindbroken") && ($slaves[$i].health.condition > 20) && (_attendantUsedCure == 0) && ($spaFix != 2)>>
+	<<for _slave range _slaves>>
+		<<set $i = $slaveIndices[_slave.ID]>>
+		<<setLocalPronouns _slave 2>>
+		<<if (_slave.fetish == "mindbroken") && (_slave.health.condition > 20) && (_attendantUsedCure == 0) && ($spaFix != 2)>>
 			<<set _attendantUsedCure = 1>>
 			<<if (random(1,100) > 90-_S.Attendant.devotion)>>
-				<br>&nbsp;&nbsp;&nbsp;&nbsp;@@.green;Something almost miraculous has happened.@@ _S.Attendant.slaveName has always refused to believe that $slaves[$i].slaveName could not be reached, and has lavished patient tenderness on _him2 in $spaName. $slaves[$i].slaveName has begun to respond, and is stirring from _his2 mental torpor.
-				<<set $slaves[$i].devotion = -3, $slaves[$i].sexualFlaw = "apathetic", $slaves[$i].behavioralFlaw = either("hates men", "odd"), $slaves[$i].fetish = "none", $slaves[$i].fetishKnown = 1>>
-				<<set _spr = $genePool.findIndex(function(s) { return s.ID == $slaves[$i].ID; })>>
+				<br>&nbsp;&nbsp;&nbsp;&nbsp;@@.green;Something almost miraculous has happened.@@ _S.Attendant.slaveName has always refused to believe that _slave.slaveName could not be reached, and has lavished patient tenderness on _him2 in $spaName. _slave.slaveName has begun to respond, and is stirring from _his2 mental torpor.
+				<<set _slave.devotion = -3, _slave.sexualFlaw = "apathetic", _slave.behavioralFlaw = either("hates men", "odd"), _slave.fetish = "none", _slave.fetishKnown = 1>>
+				<<set _spr = $genePool.findIndex(function(s) { return s.ID == _slave.ID; })>>
 				<<if $genePool[_spr].intelligence >= -95>>
-					<<set $slaves[$i].intelligence = $genePool[_spr].intelligence-30>>
+					<<set _slave.intelligence = $genePool[_spr].intelligence-30>>
 				<</if>>
 				<<if ($arcologies[0].FSPaternalist > 0)>>
-					Society @@.green;strongly approves@@ of $slaves[$i].slaveName being restored to sanity, which advances ideals about enlightened slaveownership.
+					Society @@.green;strongly approves@@ of _slave.slaveName being restored to sanity, which advances ideals about enlightened slaveownership.
 					<<set $arcologies[0].FSPaternalist += 0.01*$FSSingleSlaveRep>>
-					<<run repX(2*$FSSingleSlaveRep*($arcologies[0].FSPaternalist/$FSLockinLevel), "spa", $slaves[$i])>>
+					<<run repX(2*$FSSingleSlaveRep*($arcologies[0].FSPaternalist/$FSLockinLevel), "spa", _slave)>>
 				<</if>>
 			<</if>>
 		<</if>>
 		<<set _seed = _bonusToggle * 10>>
-		<<if _bonusToggle == 1 && $slaves[$i].trust < 60>>
-			<<set $slaves[$i].trust++>>
+		<<if _bonusToggle == 1 && _slave.trust < 60>>
+			<<set _slave.trust++>>
 		<</if>>
-		<<if _S.Attendant.rivalryTarget == $slaves[$i].ID>>
-			$He constantly harasses $his <<print rivalryTerm(_S.Attendant)>>, $slaves[$i].slaveName, preventing _him2 from getting comfortable and forcing _him2 to keep _his2 guard up.
-			<<set $slaves[$i].devotion -= 4, $slaves[$i].trust -= 4>>
+		<<if _S.Attendant.rivalryTarget == _slave.ID>>
+			$He constantly harasses $his <<print rivalryTerm(_S.Attendant)>>, _slave.slaveName, preventing _him2 from getting comfortable and forcing _him2 to keep _his2 guard up.
+			<<set _slave.devotion -= 4, _slave.trust -= 4>>
 			<<if random(1,100) > 35>>
-				<<set _S.Attendant.rivalry++, _S.Attendant.rivalry++, $slaves[$i].rivalry++>>
+				<<set _S.Attendant.rivalry++, _S.Attendant.rivalry++, _slave.rivalry++>>
 			<</if>>
-		<<elseif _S.Attendant.relationshipTarget == $slaves[$i].ID>>
-			$He dedicates most of $his attention to $his <<print relationshipTerm(_S.Attendant)>>, $slaves[$i].slaveName, making _his2 stress, both physical and mental, wash away.
-			<<set $slaves[$i].devotion += 3, $slaves[$i].trust += 3>>
-		<<elseif areRelated(_S.Attendant, $slaves[$i])>>
-			$He makes sure to spend extra time caring for $his <<print relativeTerm(_S.Attendant,$slaves[$i])>>, $slaves[$i].slaveName.
-			<<set $slaves[$i].trust++>>
-			<<run improveCondition($slaves[$i], 1)>>
+		<<elseif _S.Attendant.relationshipTarget == _slave.ID>>
+			$He dedicates most of $his attention to $his <<print relationshipTerm(_S.Attendant)>>, _slave.slaveName, making _his2 stress, both physical and mental, wash away.
+			<<set _slave.devotion += 3, _slave.trust += 3>>
+		<<elseif areRelated(_S.Attendant, _slave)>>
+			$He makes sure to spend extra time caring for $his <<print relativeTerm(_S.Attendant,_slave)>>, _slave.slaveName.
+			<<set _slave.trust++>>
+			<<run improveCondition(_slave, 1)>>
 		<</if>>
-		<<switch $slaves[$i].prestigeDesc>>
+		<<switch _slave.prestigeDesc>>
 		<<case "$He is a famed Free Cities whore, and commands top prices.">>
-			$He does $his best to relax the famous whore, $slaves[$i].slaveName, making sure to
-			<<if $slaves[$i].vagina > 2 || $slaves[$i].anus > 2>>
+			$He does $his best to relax the famous whore, _slave.slaveName, making sure to
+			<<if _slave.vagina > 2 || _slave.anus > 2>>
 				pay special attention to _his2 worn holes.
 			<<else>>
 				get _him2 clean and relaxed for _his2 next usage.
 			<</if>>
-			<<set $slaves[$i].devotion += 3, $slaves[$i].trust += 3>>
+			<<set _slave.devotion += 3, _slave.trust += 3>>
 		<<case "$He is a famed Free Cities slut, and can please anyone.">>
-			$He does $his best to soothe the famous entertainer, $slaves[$i].slaveName, letting _him2 relax in blissful peace.
-			<<set $slaves[$i].devotion += 3, $slaves[$i].trust += 3>>
+			$He does $his best to soothe the famous entertainer, _slave.slaveName, letting _him2 relax in blissful peace.
+			<<set _slave.devotion += 3, _slave.trust += 3>>
 		<<case "$He is remembered for winning best in show as a cockmilker.">>
-			<<if ($slaves[$i].balls > 6) && ($slaves[$i].dick != 0)>>
+			<<if (_slave.balls > 6) && (_slave.dick != 0)>>
 				<<if _S.Attendant.fetish == "cumslut">>
-					$He can't keep $his hand<<if hasBothArms(_S.Attendant)>>s<</if>> off $slaves[$i].slaveName's cock and balls, but _he2 doesn't mind being milked constantly. Before long, strands of cum can be found floating all throughout the bath.
+					$He can't keep $his hand<<if hasBothArms(_S.Attendant)>>s<</if>> off _slave.slaveName's cock and balls, but _he2 doesn't mind being milked constantly. Before long, strands of cum can be found floating all throughout the bath.
 					<<set _S.Attendant.fetishStrength += 4>>
 				<<else>>
-					$He does $his best to accommodate $slaves[$i].slaveName's massive genitals and tends to _him2 whenever _he2 feels a need for release.
+					$He does $his best to accommodate _slave.slaveName's massive genitals and tends to _him2 whenever _he2 feels a need for release.
 					<<if random(1,100) > 65 && _S.Attendant.fetish == "none">>
 						After taking several massive loads to the face, _S.Attendant.slaveName begins to find satisfaction in being coated in cum.
 						<<set _S.Attendant.fetish = "cumslut">>
 					<</if>>
 				<</if>>
 			<</if>>
-			<<set $slaves[$i].devotion += 3, $slaves[$i].trust += 3>>
+			<<set _slave.devotion += 3, _slave.trust += 3>>
 		<<case "$He is remembered for winning best in show as a dairy cow.">>
-			<<if ($slaves[$i].lactation > 0) && (($slaves[$i].boobs-$slaves[$i].boobsImplant) > 6000)>>
+			<<if (_slave.lactation > 0) && ((_slave.boobs-_slave.boobsImplant) > 6000)>>
 				<<if _S.Attendant.fetish == "boobs">>
-					$He can't keep $his hand<<if hasBothArms(_S.Attendant)>>s<</if>> off $slaves[$i].slaveName's huge breasts, but _he2 doesn't mind being milked constantly. Before long the bath gains a white tint.
+					$He can't keep $his hand<<if hasBothArms(_S.Attendant)>>s<</if>> off _slave.slaveName's huge breasts, but _he2 doesn't mind being milked constantly. Before long the bath gains a white tint.
 					<<set _S.Attendant.fetishStrength += 4, _S.Attendant.fetishStrength += 4>>
 				<<else>>
-					$He does $his best to accommodate $slaves[$i].slaveName's massive breasts and tends to _him2 whenever _he2 feels a need for release.
+					$He does $his best to accommodate _slave.slaveName's massive breasts and tends to _him2 whenever _he2 feels a need for release.
 					<<if random(1,100) > 65 && _S.Attendant.fetish == "none">>
 						After multiple milking sessions, _S.Attendant.slaveName begins to find $himself fantasizing about having giant milky breasts too.
 						<<set _S.Attendant.fetish = "boobs">>
 					<</if>>
 				<</if>>
-				<<set $slaves[$i].devotion += 3, $slaves[$i].trust += 3, $slaves[$i].lactationDuration = 2, $slaves[$i].boobs -= $slaves[$i].boobsMilk, $slaves[$i].boobsMilk = 0>>
+				<<set _slave.devotion += 3, _slave.trust += 3, _slave.lactationDuration = 2, _slave.boobs -= _slave.boobsMilk, _slave.boobsMilk = 0>>
 			<</if>>
 		<<case "$He is remembered for winning best in show as a breeder.">>
-			<<if $slaves[$i].bellyPreg >= 5000>>
+			<<if _slave.bellyPreg >= 5000>>
 				<<if _S.Attendant.fetish == "pregnancy">>
-					$He can't keep $his hand<<if hasBothArms(_S.Attendant)>>s<</if>> off $slaves[$i].slaveName's pregnancy, but _he2 doesn't mind _his2 full belly being fondled.
+					$He can't keep $his hand<<if hasBothArms(_S.Attendant)>>s<</if>> off _slave.slaveName's pregnancy, but _he2 doesn't mind _his2 full belly being fondled.
 					<<set _S.Attendant.fetishStrength += 4, _S.Attendant.fetishStrength += 4>>
 				<<else>>
-					$He does $his best to accommodate $slaves[$i].slaveName's pregnancy and to make sure the mother-to-be is happy and comfortable.
+					$He does $his best to accommodate _slave.slaveName's pregnancy and to make sure the mother-to-be is happy and comfortable.
 					<<if random(1,100) > 65 && _S.Attendant.fetish == "none">>
-						After massaging $slaves[$i].slaveName's growing belly multiple times, _S.Attendant.slaveName begins to find $himself fantasizing about being swollen with life too.
+						After massaging _slave.slaveName's growing belly multiple times, _S.Attendant.slaveName begins to find $himself fantasizing about being swollen with life too.
 						<<set _S.Attendant.fetish = "pregnancy">>
 					<</if>>
 				<</if>>
-				<<set $slaves[$i].devotion += 3, $slaves[$i].trust += 3>>
+				<<set _slave.devotion += 3, _slave.trust += 3>>
 			<<else>>
 				<<if _S.Attendant.fetish == "pregnancy">>
-					$He can't help but pester $slaves[$i].slaveName with questions about _his2 famous pregnancy, limiting _his2 ability to truly relax.
-					<<set $slaves[$i].devotion += 1, $slaves[$i].trust += 1>>
-				<<elseif canGetPregnant($slaves[$i])>>
-					$He does $his best to encourage $slaves[$i].slaveName's fertilization by performing any fertility boosting actions $he can.
-					<<set $slaves[$i].devotion += 3, $slaves[$i].trust += 3>>
+					$He can't help but pester _slave.slaveName with questions about _his2 famous pregnancy, limiting _his2 ability to truly relax.
+					<<set _slave.devotion += 1, _slave.trust += 1>>
+				<<elseif canGetPregnant(_slave)>>
+					$He does $his best to encourage _slave.slaveName's fertilization by performing any fertility boosting actions $he can.
+					<<set _slave.devotion += 3, _slave.trust += 3>>
 				<</if>>
 			<</if>>
 		<</switch>>
 		<<if (_S.Attendant.intelligence+_S.Attendant.intelligenceImplant > 15) && (_attendantUsedCure == 0) && ((_S.Attendant.intelligence+_S.Attendant.intelligenceImplant)+_seed) > random(1,200) && ($spaFix == 0)>>
-			<<if $slaves[$i].behavioralFlaw != "none">>
-				<<run SoftenBehavioralFlaw($slaves[$i])>>
+			<<if _slave.behavioralFlaw != "none">>
+				<<run SoftenBehavioralFlaw(_slave)>>
 				<<set _attendantUsedCure += 1>>
-				<br>&nbsp;&nbsp;&nbsp;&nbsp;_S.Attendant.slaveName works carefully with $slaves[$i].slaveName, and successfully @@.green;softens _his2 behavioral flaw@@ into an appealing quirk.
-			<<elseif $slaves[$i].sexualFlaw != "none">>
-				<<run SoftenSexualFlaw($slaves[$i])>>
+				<br>&nbsp;&nbsp;&nbsp;&nbsp;_S.Attendant.slaveName works carefully with _slave.slaveName, and successfully @@.green;softens _his2 behavioral flaw@@ into an appealing quirk.
+			<<elseif _slave.sexualFlaw != "none">>
+				<<run SoftenSexualFlaw(_slave)>>
 				<<set _attendantUsedCure += 1>>
-				<br>&nbsp;&nbsp;&nbsp;&nbsp;_S.Attendant.slaveName works carefully with $slaves[$i].slaveName, and successfully @@.green;softens _his2 sexual flaw@@ into an appealing quirk.
+				<br>&nbsp;&nbsp;&nbsp;&nbsp;_S.Attendant.slaveName works carefully with _slave.slaveName, and successfully @@.green;softens _his2 sexual flaw@@ into an appealing quirk.
 			<</if>>
 		<</if>>
-		<<if $slaves[$i].lactation > 0>>
-			_S.Attendant.slaveName takes care to keep $slaves[$i].slaveName's breasts comfortably drained.
-			<<set $slaves[$i].lactationDuration = 2, $slaves[$i].boobs -= $slaves[$i].boobsMilk, $slaves[$i].boobsMilk = 0>>
+		<<if _slave.lactation > 0>>
+			_S.Attendant.slaveName takes care to keep _slave.slaveName's breasts comfortably drained.
+			<<set _slave.lactationDuration = 2, _slave.boobs -= _slave.boobsMilk, _slave.boobsMilk = 0>>
 		<</if>>
 	<</for>>
 	<<if (_DL < $spa)>>
@@ -227,25 +227,25 @@
 		</div>
 		<</if>>
 		/* 000-250-006 */
-		<span class='slave-name'><<= SlaveFullName($slaves[$i])>></span> is serving as the Attendant in $spaName.
+		<span class='slave-name'><<= SlaveFullName(_S.Attendant)>></span> is serving as the Attendant in $spaName.
 		<br>&nbsp;&nbsp;&nbsp;
-		<<= App.SlaveAssignment.choosesOwnClothes($slaves[$i])>>
-		<<run tired($slaves[$i])>>
+		<<= App.SlaveAssignment.choosesOwnClothes(_S.Attendant)>>
+		<<run tired(_S.Attendant)>>
 		<<include "SA rules">>
 		<<include "SA diet">>
 		<<include "SA long term effects">>
-		<<= App.SlaveAssignment.drugs($slaves[$i])>>
+		<<= App.SlaveAssignment.drugs(_S.Attendant)>>
 		<<include "SA relationships">>
 		<<include "SA rivalries">>
 		<br><<include "SA devotion">>
 	<<else>>
 		<<silently>>
-		<<run App.SlaveAssignment.choosesOwnClothes($slaves[$i])>>
-		<<run tired($slaves[$i])>>
+		<<run App.SlaveAssignment.choosesOwnClothes(_S.Attendant)>>
+		<<run tired(_S.Attendant)>>
 		<<include "SA rules">>
 		<<include "SA diet">>
 		<<include "SA long term effects">>
-		<<run App.SlaveAssignment.drugs($slaves[$i])>>
+		<<run App.SlaveAssignment.drugs(_S.Attendant)>>
 		<<include "SA relationships">>
 		<<include "SA rivalries">>
 		<<include "SA devotion">>
@@ -253,57 +253,57 @@
 	<</if>>
 <</if>>
 
-<<for _dI = 0; _dI < _DL; _dI++>>
-	<<set $i = $slaveIndices[$SpaiIDs[_dI]]>>
-	<<setLocalPronouns $slaves[$i]>>
-	<<set $slaves[$i].devotion += _devBonus, $slaves[$i].trust += _trustBonus>>
-	<<run improveCondition($slaves[$i], 5 + _healthBonus)>>
-	<<if ($slaves[$i].health.condition < -80)>>
-		<<run improveCondition($slaves[$i], 15)>>
-	<<elseif $slaves[$i].health.condition < -40>>
-		<<run improveCondition($slaves[$i], 10)>>
-	<<elseif $slaves[$i].health.condition < 0>>
-		<<run improveCondition($slaves[$i], 5)>>
+<<for _slave range _slaves>>
+	<<set $i = $slaveIndices[_slave.ID]>>
+	<<setLocalPronouns _slave>>
+	<<set _slave.devotion += _devBonus, _slave.trust += _trustBonus>>
+	<<run improveCondition(_slave, 5 + _healthBonus)>>
+	<<if (_slave.health.condition < -80)>>
+		<<run improveCondition(_slave, 15)>>
+	<<elseif _slave.health.condition < -40>>
+		<<run improveCondition(_slave, 10)>>
+	<<elseif _slave.health.condition < 0>>
+		<<run improveCondition(_slave, 5)>>
 	<</if>>
-	<<if ($spaUpgrade == 1) && ($slaves[$i].health.condition < 100)>>
-		<<run improveCondition($slaves[$i], normalRandInt(8))>>
+	<<if ($spaUpgrade == 1) && (_slave.health.condition < 100)>>
+		<<run improveCondition(_slave, normalRandInt(8))>>
 	<</if>>
-	<<if ($slaves[$i].devotion < 60) && ($slaves[$i].trust < 60)>>
-		<<set $slaves[$i].devotion++, $slaves[$i].trust++>>
-	<<elseif ($slaves[$i].trust < 40)>>
-		<<set $slaves[$i].trust += 10>>
-	<<elseif ($slaves[$i].devotion < 40)>>
-		<<set $slaves[$i].devotion += 10>>
+	<<if (_slave.devotion < 60) && (_slave.trust < 60)>>
+		<<set _slave.devotion++, _slave.trust++>>
+	<<elseif (_slave.trust < 40)>>
+		<<set _slave.trust += 10>>
+	<<elseif (_slave.devotion < 40)>>
+		<<set _slave.devotion += 10>>
 	<</if>>
 	<<switch $spaDecoration>>
 	<<case "Chattel Religionist" "Chinese Revivalist">>
-		<<set $slaves[$i].rules.living = "normal">>
+		<<set _slave.rules.living = "normal">>
 	<<case "Degradationist">>
-		<<set $slaves[$i].rules.living = "spare">>
+		<<set _slave.rules.living = "spare">>
 	<<default>>
-		<<set $slaves[$i].rules.living = "luxurious">>
+		<<set _slave.rules.living = "luxurious">>
 	<</switch>>
-	<<if ($slaves[$i].health.condition >= 20) && ($slaves[$i].health.tired < 20) && ($slaves[$i].trust > 60) && ($slaves[$i].devotion > 60) && ($slaves[$i].fetish != "mindbroken") && ($slaves[$i].sexualFlaw == "none") && ($slaves[$i].behavioralFlaw == "none")>>
+	<<if (_slave.health.condition >= 20) && (_slave.health.tired < 20) && (_slave.trust > 60) && (_slave.devotion > 60) && (_slave.fetish != "mindbroken") && (_slave.sexualFlaw == "none") && (_slave.behavioralFlaw == "none")>>
 		<p>
-			<span class="slave-name">$slaves[$i].slaveName</span> is feeling well enough to leave $spaName,
+			<span class="slave-name">_slave.slaveName</span> is feeling well enough to leave $spaName,
 			<span class="noteworthy">
-				<<if $assignmentRecords[$slaves[$i].ID]>>
-					<<set _oldJob = $assignmentRecords[$slaves[$i].ID]>>
-					<<= assignJobSafely($slaves[$i], _oldJob)>>
-					<<if $slaves[$i].choosesOwnAssignment === 1>>
+				<<if $assignmentRecords[_slave.ID]>>
+					<<set _oldJob = $assignmentRecords[_slave.ID]>>
+					<<= assignJobSafely(_slave, _oldJob)>>
+					<<if _slave.choosesOwnAssignment === 1>>
 						and $he is resting before choosing another task.
-					<<elseif $slaves[$i].assignment === "rest">>
+					<<elseif _slave.assignment === "rest">>
 						<<if _oldJob != "rest">>
 							and since $he was unable to return to $his old task to <<print _oldJob>>, $his assignment has defaulted to rest.
 						<<else>>
 							so $he has returned to rest.
 						<</if>>
 					<<else>>
-						so $he goes back to <<print $slaves[$i].assignment>>.
+						so $he goes back to <<print _slave.assignment>>.
 					<</if>>
 				<<else>>
 					so $his assignment has defaulted to rest.
-					<<= removeJob($slaves[$i], "rest in the spa")>>
+					<<= removeJob(_slave, "rest in the spa")>>
 				<</if>>
 			</span>
 		</p>
@@ -315,44 +315,44 @@
 		/* 000-250-006 */
 		<<if $seeImages && $seeReportImages>>
 		<div class="imageRef smlImg">
-			<<= SlaveArt($slaves[$i], 0, 0)>>
+			<<= SlaveArt(_slave, 0, 0)>>
 		</div>
 		<</if>>
 		/* 000-250-006 */
-		<span class='slave-name'><<= SlaveFullName($slaves[$i])>></span>
-		<<if $slaves[$i].choosesOwnAssignment == 2>>
+		<span class='slave-name'><<= SlaveFullName(_slave)>></span>
+		<<if _slave.choosesOwnAssignment == 2>>
 			<<include "SA chooses own job">>
 		<<else>>
 			is resting in $spaName.
 		<</if>>
-		<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.rest($slaves[$i])>>
-		<<if ($slaves[$i].fetish == "mindbroken")>>
+		<br>&nbsp;&nbsp;&nbsp;&nbsp;$He <<= App.SlaveAssignment.rest(_slave)>>
+		<<if (_slave.fetish == "mindbroken")>>
 			$He remains in the Spa, completely mindbroken.
-		<<elseif($slaves[$i].sexualFlaw != "none") || ($slaves[$i].behavioralFlaw != "none")>>
+		<<elseif(_slave.sexualFlaw != "none") || (_slave.behavioralFlaw != "none")>>
 			$He remains in the Spa, stubborn in $his flaw.
-		<<elseif ($slaves[$i].trust < 60) || ($slaves[$i].devotion < 60)>>
+		<<elseif (_slave.trust < 60) || (_slave.devotion < 60)>>
 			$He remains in the Spa, as $he is still learning to accept life as a slave.
-		<<elseif ($slaves[$i].health.condition < 20)>>
+		<<elseif (_slave.health.condition < 20)>>
 			$He remains in the Spa, as $he is benefiting from its healing properties.
 		<</if>>
 		<br>&nbsp;&nbsp;&nbsp;
-		<<= App.SlaveAssignment.choosesOwnClothes($slaves[$i])>>
+		<<= App.SlaveAssignment.choosesOwnClothes(_slave)>>
 		<<include "SA rules">>
 		<<include "SA diet">>
 		<<include "SA long term effects">>
-		<<= App.SlaveAssignment.drugs($slaves[$i])>>
+		<<= App.SlaveAssignment.drugs(_slave)>>
 		<<include "SA relationships">>
 		<<include "SA rivalries">>
 		<br><<include "SA devotion">>
 	<<else>>
 		<<silently>>
 		<<include "SA chooses own job">>
-		<<run App.SlaveAssignment.choosesOwnClothes($slaves[$i])>>
-		<<run App.SlaveAssignment.rest($slaves[$i])>>
+		<<run App.SlaveAssignment.choosesOwnClothes(_slave)>>
+		<<run App.SlaveAssignment.rest(_slave)>>
 		<<include "SA rules">>
 		<<include "SA diet">>
 		<<include "SA long term effects">>
-		<<run App.SlaveAssignment.drugs($slaves[$i])>>
+		<<run App.SlaveAssignment.drugs(_slave)>>
 		<<include "SA relationships">>
 		<<include "SA rivalries">>
 		<<include "SA devotion">>
diff --git a/src/uncategorized/summaryOptions.tw b/src/uncategorized/summaryOptions.tw
index 4999d533ca7683a578afd6ba0dce66ce2b074a02..74411f44be29f280123bfec197c36ffec5970c28 100644
--- a/src/uncategorized/summaryOptions.tw
+++ b/src/uncategorized/summaryOptions.tw
@@ -35,7 +35,7 @@
 	.addValueList([["Ascending", "ascending"], ["Descending", "descending"]])>>
 
 	<<run _options.addOption("Slaves are sorted by", "sortSlavesBy")
-	.addValueList([["Devotion", "devotion"], ["Name", "name"], ["Date purchased", "seniority"], ["Age", "actualAge"], 
+	.addValueList([["Devotion", "devotion"], ["Name", "name"], ["Date purchased", "seniority"], ["Age", "actualAge"],
 	["How old they look", "visualAge"], ["Age of their body", "physicalAge"], ["Assignment", "assignment"], ["Weekly Income", "weeklyIncome"]])>>
 <</if>>
 
@@ -44,7 +44,7 @@
 <h2>Individual panels</h2>
 Sample summary:
 <<= App.UI.SlaveList.render.listMarkup(
-	[App.Utils.slaveIndexForId($activeSlave.ID)],
+	[$activeSlave.ID],
 	[],
 	App.UI.SlaveList.SlaveInteract.stdInteract
 )>>
diff --git a/src/uncategorized/underperformingSlaves.tw b/src/uncategorized/underperformingSlaves.tw
index ee7a8cf6587305d964cd62bab48a434dcfb57caa..0646e3bc07008725760592264fbd7c1b126d283d 100644
--- a/src/uncategorized/underperformingSlaves.tw
+++ b/src/uncategorized/underperformingSlaves.tw
@@ -30,7 +30,7 @@
 			Take the rough value of a slave and divide it by how much they made overall last week. This will tell you how many weeks it might take them to earn the same amount you'd get for selling them right now.
 		</div>
 		<<print App.UI.SlaveList.render.listMarkup(
-			getBestSlavesIndices(
+			getBestSlavesIDs(
 				{
 					part:(slave) => {
 						const ratio = slaveCost(slave) / (slave.lastWeeksCashIncome - getSlaveCost(slave));
@@ -59,7 +59,7 @@
 			This list looks for moochers by weighing their weekly income against the weekly cost of providing for them.
 		</div>
 		<<print App.UI.SlaveList.render.listMarkup(
-			getBestSlavesIndices(
+			getBestSlavesIDs(
 				{
 					part:(slave) => (slave.lastWeeksCashIncome - getSlaveCost(slave)),
 					largest: false,
diff --git a/src/utility/birthWidgets.tw b/src/utility/birthWidgets.tw
index f25fefd6d25b6bb3577b6fdbed8131f8bff8f058..89bc38f44955ea95687a2a3729863d13a8db4e71 100644
--- a/src/utility/birthWidgets.tw
+++ b/src/utility/birthWidgets.tw
@@ -378,7 +378,7 @@
 	$He waddles to $his maternity ward and strips before laying on an open bed. $He makes $himself comfortable and begins working on birthing $his bab<<if $slaves[$i].pregType > 1>>ies<<else>>y<</if>> as $his assistants watch. $His child<<if $slaves[$i].pregType > 1>>ren are<<else>> is<</if>> promptly taken and $he is helped to the recovery ward until $he recovers enough to take over $clinicName again.
 
 <<case "be your Head Girl">>
-<<set _HGL = $HGSuiteiIDs.length>>
+<<set _HGL = App.Entity.facilities.headGirlSuite.hostedSlaves>>
 	$He returns to <<if $HGSuite == 1>>$his room's bed<<else>>$his bed<</if>> and strips before slipping into it. $He makes $himself comfortable<<if _HGL != 0>> as $his slave rushes to $his side,<</if>> and begins working on birthing $his bab<<if $slaves[$i].pregType > 1>>ies<<else>>y<</if>>. $His child<<if $slaves[$i].pregType > 1>>ren are<<else>> is<</if>> promptly taken<<if _HGL != 0>> by $his roommate<</if>> and $he rests awhile before returning to managing your slaves.
 
 <<case "guard you">>