diff --git a/src/debugging/debugJS.js b/src/debugging/debugJS.js
index e58085d898de4c1bfd67c8c06f808772c8ab439e..7f1a9650c8aa8a80997420bc6d522bd6068ad8c4 100644
--- a/src/debugging/debugJS.js
+++ b/src/debugging/debugJS.js
@@ -75,7 +75,7 @@ window.findNaN = function findNan() {
 	var result = [];
 	for (var key in flatV) {
 		if (Number.isNaN(flatV[key])) {
-			result.push('$'+key);
+			result.push('$$'+key); /* double dollar signs to escape sugarcube markup */
 		}
 	}
 	return result;
diff --git a/src/js/datatypeCleanupJS.js b/src/js/datatypeCleanupJS.js
index 30211386f3b9950f1bc18c0bdc5702402c146c11..5722f37fdd9e3a47bee1cc4ec463fb16c2ecc094 100644
--- a/src/js/datatypeCleanupJS.js
+++ b/src/js/datatypeCleanupJS.js
@@ -25,586 +25,591 @@
 		If you want slave.value to be a string, there's no easy tricks to make sure it's already an accepted value. The simplest way is the following
 			if (typeof slave.value !== "string") slave.value = default;
 */
-window.SlaveDatatypeCleanup = function SlaveDatatypeCleanup (slave) {
-	slaveAgeDatatypeCleanup(slave);
-	slavePhysicalDatatypeCleanup(slave);
-	slaveFaceDatatypeCleanup(slave);
-	slaveHairDatatypeCleanup(slave);
-	slaveBoobsDatatypeCleanup(slave);
-	slaveButtDatatypeCleanup(slave);
-	slavePregnancyDatatypeCleanup(slave);
-	slaveBellyDatatypeCleanup(slave);
-	slaveGenitaliaDatatypeCleanup(slave);
-	slaveImplantsDatatypeCleanup(slave);
-	slavePiercingsDatatypeCleanup(slave);
-	slaveTattooDatatypeCleanup(slave);
-	slaveCosmeticsDatatypeCleanup(slave);
-	slaveDietDatatypeCleanup(slave);
-	slavePornDatatypeCleanup(slave);
-	slaveRelationDatatypeCleanup(slave);
-	slaveSkillsDatatypeCleanup(slave);
-	slaveStatCountDatatypeCleanup(slave);
-	slavePreferencesDatatypeCleanup(slave);
-	slaveRulesDatatypeCleanup(slave);
-	slaveCustomStatsDatatypeCleanup(slave);
-	slaveMiscellaneousDatatypeCleanup(slave);
-	generatePronouns(slave);
-};
-
-window.slaveAgeDatatypeCleanup = function slaveAgeDatatypeCleanup(slave) {
-	const V = State.variables;
-
-	slave.birthWeek = Math.clamp(+slave.birthWeek, 0, 51) || 0;
-	if (slave.age > 0) {
-		slave.actualAge = Math.clamp(+slave.actualAge, V.minimumSlaveAge, Infinity) || slave.age; /* if undefined, this sets to slave.age */
-	} else {
-		slave.actualAge = Math.clamp(+slave.actualAge, V.minimumSlaveAge, Infinity) || 18;
-		slave.age = slave.actualAge;
-	}
-	slave.visualAge = Math.max(+slave.visualAge, 0) || slave.actualAge;
-	slave.physicalAge = Math.max(+slave.physicalAge, 0) || slave.actualAge;
-	slave.ovaryAge = Math.max(+slave.ovaryAge, 0) || slave.physicalAge;
-	slave.pubertyAgeXX = Math.max(+slave.pubertyAgeXX, 0) || V.fertilityAge;
-	slave.pubertyAgeXY = Math.max(+slave.pubertyAgeXY, 0) || V.potencyAge;
-	slave.ageAdjust = Math.clamp(+slave.ageAdjust, -40, 40) || 0;
-	slave.NCSyouthening = Math.max(+slave.NCSyouthening, 0) || 0;
-};
-
-window.slavePhysicalDatatypeCleanup = function slavePhysicalDatatypeCleanup(slave) {
-	if (typeof slave.nationality !== "string") {
-		slave.nationality = "slave";
-	}
-	if (typeof slave.race !== "string") {
-		nationalityToRace(slave);
-	}
-	if (typeof slave.origRace !== "string") {
-		slave.origRace = slave.race;
-	}
-	if (typeof slave.skin !== "string") {
-		slave.skin = "light";
-	}
-	if (typeof slave.origSkin !== "string") {
-		slave.origSkin = slave.skin;
-	}
-	if (typeof slave.minorInjury !== "string") {
-		slave.minorInjury = 0;
-	}
-	slave.health = Math.clamp(+slave.health, -100, 100) || 0;
-	slave.muscles = Math.clamp(+slave.muscles, -100, 100) || 0;
-	slave.weight = Math.clamp(+slave.weight, -100, 200) || 0;
-	slave.waist = Math.clamp(+slave.waist, -100, 100) || 0;
-	slave.height = Math.round(Math.max(+slave.height, 0)) || Math.round(Height.mean(slave));
-	slave.shoulders = Math.clamp(+slave.shoulders, -2, 2) || 0;
-	slave.hips = Math.clamp(+slave.hips, -2, 3) || 0;
-};
-
-window.slaveFaceDatatypeCleanup = function slaveFaceDatatypeCleanup(slave) {
-	slave.face = Math.clamp(+slave.face, -100, 100) || 0;
-	if (typeof slave.faceShape !== "string") {
-		slave.faceShape = "normal";
-	}
-	slave.eyes = Math.clamp(+slave.eyes, -3, 1) || 1; /* if 0 or undefined, this sets to 1 */
-	if (typeof slave.eyeColor !== "string") {
-		slave.eyeColor = "brown";
-	}
-	if (typeof slave.origEye !== "string") {
-		slave.origEye = slave.eyeColor;
-	}
-	if (typeof slave.pupil !== "string") {
-		slave.pupil = "circular";
-	}
-	if (typeof slave.sclerae !== "string") {
-		slave.sclerae = "white";
-	}
-	if (slave.lips !== 0) {
-		slave.lips = Math.clamp(+slave.lips, 0, 100) || 15;
-	}
-};
-
-window.slaveHairDatatypeCleanup = function slaveHairDatatypeCleanup(slave) {
-	if (typeof slave.hColor !== "string") {
-		slave.hColor = "brown";
-	}
-	if (typeof slave.origHColor !== "string") {
-		slave.origHColor = slave.hColor;
-	}
-	if (slave.hLength !== 0) {
-		slave.hLength = Math.clamp(+slave.hLength, 0, 300) || 60;
-	}
-	if (typeof slave.hStyle !== "string") {
-		slave.hStyle = "long";
-	}
-	slave.haircuts = Math.clamp(+slave.haircuts, 0, 1) || 0;
-	slave.bald = Math.clamp(+slave.bald, 0, 1) || 0;
-	if (typeof slave.pubicHColor !== "string") {
-		slave.pubicHColor = slave.hColor;
-	}
-	if (typeof slave.pubicHStyle !== "string") {
-		slave.pubicHStyle = "neat";
-	}
-	if (typeof slave.underArmHColor !== "string") {
-		slave.underArmHColor = "slave.hColor";
-	}
-	if (typeof slave.underArmHStyle !== "string") {
-		slave.underArmHStyle = "waxed";
-	}
-	if (typeof slave.eyebrowHColor !== "string") {
-		slave.eyebrowHColor = "slave.hColor";
-	}
-	if (typeof slave.eyebrowHStyle !== "string") {
-		slave.eyebrowHStyle = "natural";
-	}
-	if (typeof slave.eyebrowFullness !== "string") {
-		slave.eyebrowFullness = "natural";
-	}
-};
-
-window.slaveBoobsDatatypeCleanup = function slaveBoobsDatatypeCleanup(slave) {
-	slave.boobs = Math.max(+slave.boobs, 100) || 200;
-	if (typeof slave.boobShape !== "string") {
-		slave.boobShape = "normal";
-	}
-	if (typeof slave.nipples !== "string") {
-		slave.nipples = "cute";
-	}
-	if (typeof slave.nipplesAccessory !== "string") {
-		slave.nipplesAccessory = "none";
-	}
-	slave.areolae = Math.clamp(+slave.areolae, 0, 3) || 0;
-	if (typeof slave.areolaeShape !== "string") {
-		slave.areolaeShape = "circle";
-	}
-	slave.lactation = Math.clamp(+slave.lactation, 0, 2) || 0;
-	slave.boobsMilk = Math.max(+slave.boobsMilk, 0) || 0;
-	slave.lactationAdaptation = Math.clamp(+slave.lactationAdaptation, 0, 100) || 0;
-};
-
-window.slaveButtDatatypeCleanup = function slaveButtDatatypeCleanup(slave) {
-	if (slave.butt !== 0) {
-		slave.butt = Math.clamp(+slave.butt, 0, 20) || 1;
-	}
-	slave.anus = Math.clamp(+slave.anus, 0, 4) || 0;
-	slave.analArea = Math.max(+slave.analArea, 0) || 0;
-};
-
-window.slavePregnancyDatatypeCleanup = function slavePregnancyDatatypeCleanup(slave) {
-	slave.induce = Math.clamp(+slave.induce, 0, 1) || 0;
-	slave.labor = Math.clamp(+slave.labor, 0, 1) || 0;
-	slave.cSec = Math.clamp(+slave.cSec, 0, 1) || 0;
-	slave.prematureBirth = Math.clamp(+slave.prematureBirth, 0, 1) || 0;
-	slave.ovaries = Math.clamp(+slave.ovaries, 0, 1) || 0;
-	slave.vasectomy = Math.clamp(+slave.vasectomy, 0, 1) || 0;
-	slave.mpreg = Math.clamp(+slave.mpreg, 0, 1) || 0;
-	if (slave.pregAdaptation !== 0) {
-		slave.pregAdaptation = Math.max(+slave.pregAdaptation, 0) || 50;
-	}
-	slave.ovaImplant = Math.clamp(+slave.ovaImplant, -1, 2) || 0;
-	slave.broodmother = Math.clamp(+slave.broodmother, 0, 3) || 0;
-	slave.broodmotherFetuses = Math.max(+slave.broodmotherFetuses, 0) || 0;
-	slave.broodmotherOnHold = Math.clamp(+slave.broodmotherOnHold, 0, 1) || 0;
-	slave.pregSource = +slave.pregSource || 0;
-	if (typeof slave.pregControl !== "string") {
-		slave.pregControl = "none";
-	}
-	WombNormalizePreg(slave);
-};
-
-window.slaveBellyDatatypeCleanup = function slaveBellyDatatypeCleanup(slave) {
-	slave.inflation = Math.clamp(+slave.inflation, 0, 3) || 0;
-	if (typeof slave.inflationType !== "string") {
-		slave.inflationType = "none";
-	}
-	slave.inflationMethod = Math.clamp(+slave.inflationMethod, 0, 3) || 0;
-	slave.milkSource = Math.max(+slave.milkSource, 0) || 0;
-	slave.cumSource = Math.max(+slave.cumSource, 0) || 0;
-	slave.burst = Math.clamp(+slave.burst, 0, 1) || 0;
-	if (slave.bellyImplant !== 0) {
-		slave.bellyImplant = Math.max(+slave.bellyImplant, -1) || -1;
-	}
-	slave.cervixImplant = Math.clamp(+slave.cervixImplant, 0, 3) || 0;
-	slave.bellySag = Math.max(+slave.bellySag, 0) || 0;
-	slave.bellySagPreg = Math.max(+slave.bellySagPreg, 0) || slave.bellySag;
-	slave.bellyPain = Math.clamp(+slave.bellyPain, 0, 2) || 0;
-	SetBellySize(slave);
-};
-
-window.slaveGenitaliaDatatypeCleanup = function slaveGenitaliaDatatypeCleanup(slave) {
-	slave.vagina = Math.clamp(+slave.vagina, -1, 10) || 0;
-	slave.vaginaLube = Math.clamp(+slave.vaginaLube, 0, 2) || 0;
-	slave.labia = Math.clamp(+slave.labia, 0, 3) || 0;
-	slave.clit = Math.clamp(+slave.clit, 0, 5) || 0;
-	slave.foreskin = Math.max(+slave.foreskin, 0) || 0;
-	slave.dick = Math.max(+slave.dick, 0) || 0;
-	if (slave.dick && slave.prostate !== 0) {
-		slave.prostate = Math.clamp(+slave.prostate, 0, 3) || 1;
-	} else {
-		slave.prostate = Math.clamp(+slave.prostate, 0, 3) || 0;
-	}
-	slave.balls = Math.max(+slave.balls, 0) || 0;
-	if (slave.scrotum !== 0) {
-		slave.scrotum = Math.max(+slave.scrotum, 0) || slave.balls;
-	}
-};
-
-window.slaveImplantsDatatypeCleanup = function slaveImplantsDatatypeCleanup(slave) {
-	slave.ageImplant = Math.clamp(+slave.ageImplant, 0, 1) || 0;
-	slave.faceImplant = Math.clamp(+slave.faceImplant, 0, 100) || 0;
-	slave.lipsImplant = Math.clamp(+slave.lipsImplant, 0, 100) || 0;
-	slave.voiceImplant = Math.clamp(+slave.voiceImplant, -1, 1) || 0;
-	slave.boobsImplant = Math.max(+slave.boobsImplant, 0) || 0;
-	slave.boobsImplantType = Math.clamp(+slave.boobsImplantType, 0, 1) || 0;
-	slave.breastMesh = Math.clamp(+slave.breastMesh, 0, 1) || 0;
-	slave.buttImplant = Math.clamp(+slave.buttImplant, 0, 3) || 0;
-	slave.buttImplantType = Math.clamp(+slave.buttImplantType, 0, 1) || 0;
-	slave.heightImplant = Math.clamp(+slave.heightImplant, -1, 1) || 0;
-	slave.earImplant = Math.clamp(+slave.earImplant, 0, 1) || 0;
-	slave.shouldersImplant = Math.clamp(+slave.shouldersImplant, -1, 1) || 0;
-	slave.hipsImplant = Math.clamp(+slave.hipsImplant, -1, 1) || 0;
-};
-
-window.slavePiercingsDatatypeCleanup = function slavePiercingsDatatypeCleanup(slave) {
-	slave.earPiercing = Math.clamp(+slave.earPiercing, 0, 2) || 0;
-	slave.nosePiercing = Math.clamp(+slave.nosePiercing, 0, 2) || 0;
-	slave.eyebrowPiercing = Math.clamp(+slave.eyebrowPiercing, 0, 2) || 0;
-	slave.lipsPiercing = Math.clamp(+slave.lipsPiercing, 0, 2) || 0;
-	slave.tonguePiercing = Math.clamp(+slave.tonguePiercing, 0, 2) || 0;
-	slave.nipplesPiercing = Math.clamp(+slave.nipplesPiercing, 0, 2) || 0;
-	slave.areolaePiercing = Math.clamp(+slave.areolaePiercing, 0, 2) || 0;
-	slave.corsetPiercing = Math.clamp(+slave.corsetPiercing, 0, 1) || 0;
-	slave.navelPiercing = Math.clamp(+slave.navelPiercing, 0, 2) || 0;
-	slave.clitPiercing = Math.clamp(+slave.clitPiercing, 0, 3) || 0;
-	slave.vaginaPiercing = Math.clamp(+slave.vaginaPiercing, 0, 2) || 0;
-	slave.dickPiercing = Math.clamp(+slave.dickPiercing, 0, 2) || 0;
-	slave.anusPiercing = Math.clamp(+slave.anusPiercing, 0, 2) || 0;
-};
-
-window.slaveTattooDatatypeCleanup = function slaveTattooDatatypeCleanup(slave) {
-	if (typeof slave.shouldersTat !== "string") {
-		slave.shouldersTat = 0;
-	}
-	if (typeof slave.lipsTat !== "string") {
-		slave.lipsTat = 0;
-	}
-	if (typeof slave.boobsTat !== "string") {
-		slave.boobsTat = 0;
-	}
-	if (typeof slave.armsTat !== "string") {
-		slave.armsTat = 0;
-	}
-	if (typeof slave.backTat !== "string") {
-		slave.backTat = 0;
-	}
-	if (typeof slave.stampTat !== "string") {
-		slave.stampTat = 0;
-	}
-	if (typeof slave.buttTat !== "string") {
-		slave.buttTat = 0;
-	}
-	if (typeof slave.vaginaTat !== "string") {
-		slave.vaginaTat = 0;
-	}
-	if (typeof slave.dickTat !== "string") {
-		slave.dickTat = 0;
-	}
-	if (typeof slave.anusTat !== "string") {
-		slave.anusTat = 0;
-	}
-	if (typeof slave.legsTat !== "string") {
-		slave.legsTat = 0;
-	}
-	if (typeof slave.bellyTat !== "string") {
-		slave.bellyTat = 0;
-	}
-	if (typeof slave.customTat !== "string") {
-		slave.customTat = "";
-	}
-};
-
-window.slaveCosmeticsDatatypeCleanup = function slaveCosmeticsDatatypeCleanup(slave) {
-	slave.makeup = Math.clamp(+slave.makeup, 0, 8) || 0;
-	slave.nails = Math.clamp(+slave.nails, 0, 9) || 0;
-	slave.scars = Math.clamp(+slave.scars, 0, 6) || 0;
-	slave.choosesOwnClothes = Math.clamp(+slave.choosesOwnClothes, 0, 1) || 0;
-	if (typeof slave.clothes !== "string") {
-		slave.clothes = "no clothing";
-	}
-	if (typeof slave.collar !== "string") {
-		slave.collar = "none";
-	}
-	if (typeof slave.shoes !== "string") {
-		slave.shoes = "none";
-	}
-	if (typeof slave.eyewear !== "string") {
-		slave.eyewear = "none";
-	}
-	slave.brand = Math.clamp(+slave.brand, 0, 1) || 0;
-	if (typeof slave.brandLocation !== "string") {
-		slave.brandLocation = 0;
-	}
-	if (typeof slave.markings !== "string") {
-		slave.markings = "none";
-	}
-	if (typeof slave.bellyAccessory !== "string") {
-		slave.bellyAccessory = "none";
-	}
-	if (typeof slave.vaginalAccessory !== "string") {
-		slave.vaginalAccessory = "none";
-	}
-	if (typeof slave.dickAccessory !== "string") {
-		slave.dickAccessory = "none";
-	}
-	if (typeof slave.legAccessory !== "string") {
-		slave.legAccessory = "none";
-	}
-	if (typeof slave.buttplug !== "string") {
-		slave.buttplug = "none";
-	}
-	if (typeof slave.buttplugAttachment !== "string") {
-		slave.buttplugAttachment = "none";
-	}
-	if (typeof slave.headAccessory !== "string") {
-		slave.headAccessory = "none";
-	}
-	if (typeof slave.rearAccessory !== "string") {
-		slave.rearAccessory = "none";
-	}
-	if (typeof slave.backAccessory !== "string") {
-		slave.backAccessory = "none";
-	}
-};
-
-window.slaveDietDatatypeCleanup = function slaveDietDatatypeCleanup(slave) {
-	if (typeof slave.diet !== "string") {
-		slave.diet = "healthy";
-	}
-	slave.dietCum = Math.clamp(+slave.dietCum, 0, 2) || 0;
-	slave.dietMilk = Math.clamp(+slave.dietMilk, 0, 2) || 0;
-	slave.onDiet = Math.clamp(+slave.onDiet, 0, 1) || 0;
-	slave.hormones = Math.clamp(+slave.hormones, -2, 2) || 0;
-	slave.hormoneBalance = Math.clamp(+slave.hormoneBalance, -400, 400) || 0;
-	if (typeof slave.drugs !== "string") {
-		slave.drugs = "no drugs";
-	}
-	slave.aphrodisiacs = Math.clamp(+slave.aphrodisiacs, 0, 2) || 0;
-	slave.curatives = Math.clamp(+slave.curatives, 0, 2) || 0;
-};
-
-window.slavePornDatatypeCleanup = function slavePornDatatypeCleanup(slave) {
-	slave.pornFeed = Math.clamp(+slave.pornFeed, 0, 1) || 0;
-	slave.pornFame = Math.max(+slave.pornFame, 0) || 0;
-	slave.pornFameSpending = Math.max(+slave.pornFameSpending, 0) || 0;
-	slave.pornPrestige = Math.clamp(+slave.pornPrestige, 0, 3) || 0;
-	if (typeof slave.pornPrestigeDesc !== "string") {
-		slave.pornPrestigeDesc = 0;
-	}
-	if (typeof slave.pornFameType !== "string") {
-		slave.pornFameType = "none";
-	}
-	if (typeof slave.pornFocus !== "string") {
-		slave.pornFocus = "none";
-	}
-	slave.pornTypeGeneral = Math.max(+slave.pornTypeGeneral, 0) || 0;
-	slave.pornTypeFuckdoll = Math.max(+slave.pornTypeFuckdoll, 0) || 0;
-	slave.pornTypeRape = Math.max(+slave.pornTypeRape, 0) || 0;
-	slave.pornTypePreggo = Math.max(+slave.pornTypePreggo, 0) || 0;
-	slave.pornTypeBBW = Math.max(+slave.pornTypeBBW, 0) || 0;
-	slave.pornTypeGainer = Math.max(+slave.pornTypeGainer, 0) || 0;
-	slave.pornTypeStud = Math.max(+slave.pornTypeStud, 0) || 0;
-	slave.pornTypeLoli = Math.max(+slave.pornTypeLoli, 0) || 0;
-	slave.pornTypeDeepThroat = Math.max(+slave.pornTypeDeepThroat, 0) || 0;
-	slave.pornTypeStruggleFuck = Math.max(+slave.pornTypeStruggleFuck, 0) || 0;
-	slave.pornTypePainal = Math.max(+slave.pornTypePainal, 0) || 0;
-	slave.pornTypeTease = Math.max(+slave.pornTypeTease, 0) || 0;
-	slave.pornTypeRomantic = Math.max(+slave.pornTypeRomantic, 0) || 0;
-	slave.pornTypePervert = Math.max(+slave.pornTypePervert, 0) || 0;
-	slave.pornTypeCaring = Math.max(+slave.pornTypeCaring, 0) || 0;
-	slave.pornTypeUnflinching = Math.max(+slave.pornTypeUnflinching, 0) || 0;
-	slave.pornTypeSizeQueen = Math.max(+slave.pornTypeSizeQueen, 0) || 0;
-	slave.pornTypeNeglectful = Math.max(+slave.pornTypeNeglectful, 0) || 0;
-	slave.pornTypeCumAddict = Math.max(+slave.pornTypeCumAddict, 0) || 0;
-	slave.pornTypeAnalAddict = Math.max(+slave.pornTypeAnalAddict, 0) || 0;
-	slave.pornTypeAttentionWhore = Math.max(+slave.pornTypeAttentionWhore, 0) || 0;
-	slave.pornTypeBreastGrowth = Math.max(+slave.pornTypeBreastGrowth, 0) || 0;
-	slave.pornTypeAbusive = Math.max(+slave.pornTypeAbusive, 0) || 0;
-	slave.pornTypeMalicious = Math.max(+slave.pornTypeMalicious, 0) || 0;
-	slave.pornTypeSelfHating = Math.max(+slave.pornTypeSelfHating, 0) || 0;
-	slave.pornTypeBreeder = Math.max(+slave.pornTypeBreeder, 0) || 0;
-	slave.pornTypeSub = Math.max(+slave.pornTypeSub, 0) || 0;
-	slave.pornTypeCumSlut = Math.max(+slave.pornTypeCumSlut, 0) || 0;
-	slave.pornTypeAnal = Math.max(+slave.pornTypeAnal, 0) || 0;
-	slave.pornTypeHumiliation = Math.max(+slave.pornTypeHumiliation, 0) || 0;
-	slave.pornTypeBoobs = Math.max(+slave.pornTypeBoobs, 0) || 0;
-	slave.pornTypeDom = Math.max(+slave.pornTypeDom, 0) || 0;
-	slave.pornTypeSadist = Math.max(+slave.pornTypeSadist, 0) || 0;
-	slave.pornTypeMasochist = Math.max(+slave.pornTypeMasochist, 0) || 0;
-	slave.pornTypePregnancy = Math.max(+slave.pornTypePregnancy, 0) || 0;
-};
-
-window.slaveRelationDatatypeCleanup = function slaveRelationDatatypeCleanup(slave) {
-	slave.mother = +slave.mother || 0;
-	slave.father = +slave.father || 0;
-	if (State.variables.familyTesting == 0) {
-		slave.relationTarget = Math.max(+slave.relationTarget, 0) || 0;
-	}
-	slave.canRecruit = Math.clamp(+slave.canRecruit, 0, 1) || 0;
-	slave.relationship = Math.clamp(+slave.relationship, -3, 5) || 0;
-	slave.relationshipTarget = Math.max(+slave.relationshipTarget, 0) || 0;
-	slave.rivalryTarget = Math.max(+slave.rivalryTarget, 0) || 0;
-	slave.rivalry = Math.clamp(+slave.rivalry, 0, 3) || 0;
-	slave.cloneID = +slave.cloneID || 0;
-};
-
-window.slaveSkillsDatatypeCleanup = function slaveSkillsDatatypeCleanup(slave) {
-	slave.oralSkill = Math.clamp(+slave.oralSkill, 0, 100) || 0;
-	slave.vaginalSkill = Math.clamp(+slave.vaginalSkill, 0, 100) || 0;
-	slave.analSkill = Math.clamp(+slave.analSkill, 0, 100) || 0;
-	slave.whoreSkill = Math.clamp(+slave.whoreSkill, 0, 100) || 0;
-	slave.entertainSkill = Math.clamp(+slave.entertainSkill, 0, 100) || 0;
-	slave.combatSkill = Math.clamp(+slave.combatSkill, 0, 1) || 0;
-	slave.skillHG = Math.clamp(+slave.skillHG, 0, 200) || 0;
-	slave.skillRC = Math.clamp(+slave.skillRC, 0, 200) || 0;
-	slave.skillBG = Math.clamp(+slave.skillBG, 0, 200) || 0;
-	slave.skillMD = Math.clamp(+slave.skillMD, 0, 200) || 0;
-	slave.skillDJ = Math.clamp(+slave.skillDJ, 0, 200) || 0;
-	slave.skillNU = Math.clamp(+slave.skillNU, 0, 200) || 0;
-	slave.skillTE = Math.clamp(+slave.skillTE, 0, 200) || 0;
-	slave.skillAT = Math.clamp(+slave.skillAT, 0, 200) || 0;
-	slave.skillMT = Math.clamp(+slave.skillMT, 0, 200) || 0;
-	slave.skillST = Math.clamp(+slave.skillST, 0, 200) || 0;
-	slave.skillMM = Math.clamp(+slave.skillMM, 0, 200) || 0;
-	slave.skillFA = Math.clamp(+slave.skillFA, 0, 200) || 0;
-	slave.skillWA = Math.clamp(+slave.skillWA, 0, 200) || 0;
-	slave.skillS = Math.clamp(+slave.skillS, 0, 200) || 0;
-	slave.skillE = Math.clamp(+slave.skillE, 0, 200) || 0;
-	slave.skillW = Math.clamp(+slave.skillW, 0, 200) || 0;
-};
-
-window.slaveStatCountDatatypeCleanup = function slaveStatCountDatatypeCleanup(slave) {
-	slave.oralCount = Math.max(+slave.oralCount, 0) || 0;
-	slave.vaginalCount = Math.max(+slave.vaginalCount, 0) || 0;
-	slave.analCount = Math.max(+slave.analCount, 0) || 0;
-	slave.publicCount = Math.max(+slave.publicCount, 0) || 0;
-	slave.mammaryCount = Math.max(+slave.mammaryCount, 0) || 0;
-	slave.penetrativeCount = Math.max(+slave.penetrativeCount, 0) || 0;
-	slave.pitKills = Math.max(+slave.pitKills, 0) || 0;
-	slave.milk = Math.max(+slave.milk, 0) || 0;
-	slave.cum = Math.max(+slave.cum, 0) || 0;
-	slave.births = Math.max(+slave.births, 0) || 0;
-	slave.birthsTotal = Math.max(+slave.birthsTotal, 0) || slave.births;
-	slave.laborCount = Math.max(+slave.laborCount, 0) || slave.birthsTotal;
-	slave.slavesFathered = Math.max(+slave.slavesFathered, 0) || 0;
-	slave.PCChildrenFathered = Math.max(+slave.PCChildrenFathered, 0) || 0;
-	slave.slavesKnockedUp = Math.max(+slave.slavesKnockedUp, 0) || 0;
-	slave.PCKnockedUp = Math.max(+slave.PCKnockedUp, 0) || 0;
-	slave.bodySwap = Math.max(+slave.bodySwap, 0) || 0;
-};
-
-window.slavePreferencesDatatypeCleanup = function slavePreferencesDatatypeCleanup(slave) {
-	slave.energy = Math.clamp(+slave.energy, 0, 100) || 0;
-	slave.need = Math.max(+slave.need, 0) || 0;
-	slave.attrXY = Math.clamp(+slave.attrXY, 0, 100) || 0;
-	slave.attrXX = Math.clamp(+slave.attrXX, 0, 100) || 0;
-	slave.attrKnown = Math.clamp(+slave.attrKnown, 0, 1) || 0;
-	slave.fetishStrength = Math.clamp(+slave.fetishStrength, 0, 100) || 0;
-	slave.fetishKnown = Math.clamp(+slave.fetishKnown, 0, 1) || 0;
-};
-
-window.slaveRulesDatatypeCleanup = function slaveRulesDatatypeCleanup(slave) {
-	if (typeof slave.standardPunishment !== "string") {
-		slave.standardPunishment = "situational";
-	}
-	if (typeof slave.standardReward !== "string") {
-		slave.standardReward = "situational";
-	}
-	if (slave.useRulesAssistant !== 0) {
-		slave.useRulesAssistant = 1;
-	}
-	slave.choosesOwnAssignment = Math.clamp(+slave.choosesOwnAssignment, 0) || 0;
-	slave.HGExclude = Math.clamp(+slave.HGExclude, 0, 1) || 0;
-	slave.choosesOwnChastity = Math.clamp(+slave.choosesOwnChastity, 0, 1) || 0;
-	slave.breedingMark = Math.clamp(+slave.breedingMark, 0, 1) || 0;
-	slave.rudeTitle = Math.clamp(+slave.rudeTitle, 0, 1) || 0;
-};
-
-window.slaveCustomStatsDatatypeCleanup = function slaveCustomStatsDatatypeCleanup(slave) {
-	if (typeof slave.customLabel !== "string") {
-		slave.customLabel = "";
-	}
-	if (typeof slave.customDesc !== "string") {
-		slave.customDesc = "";
-	}
-	if (typeof slave.customTitle !== "string") {
-		slave.customTitle = "";
-	}
-	if (typeof slave.customTitleLisp !== "string") {
-		slave.customTitleLisp = "";
-	}
-	if (typeof slave.customImage !== "string") {
-		slave.customImage = 0;
-	}
-};
-
-window.slaveMiscellaneousDatatypeCleanup = function slaveMiscellaneousDatatypeCleanup(slave) {
-	slave.weekAcquired = Math.max(+slave.weekAcquired, 0) || 0;
-	slave.newGamePlus = Math.clamp(+slave.newGamePlus, 0, 1) || 0;
-	slave.prestige = Math.clamp(+slave.prestige, 0, 3) || 0;
-	slave.devotion = Math.clamp(+slave.devotion, -100, 100) || 0;
-	slave.oldDevotion = Math.clamp(+slave.oldDevotion, -100, 100) || 0;
-	slave.trust = Math.clamp(+slave.trust, -100, 100) || 0;
-	slave.oldTrust = Math.clamp(+slave.oldTrust, -100, 100) || 0;
-	slave.fuckdoll = Math.clamp(+slave.fuckdoll, 0, 100) || 0;
-	slave.chem = Math.max(+slave.chem, 0) || 0;
-	slave.addict = Math.max(+slave.addict, 0) || 0;
-	slave.intelligence = Math.clamp(+slave.intelligence, -100, 100) || 0;
-	slave.intelligenceImplant = Math.clamp(+slave.intelligenceImplant, 0, 30) || 0;
-	slave.premature = Math.clamp(+slave.premature, 0, 1) || 0;
-	slave.tankBaby = Math.clamp(+slave.tankBaby, 0, 2) || 0;
-	slave.subTarget = Math.max(+slave.subTarget, 0) || 0;
-	slave.sentence = Math.max(+slave.sentence, 0) || 0;
-	slave.training = Math.clamp(+slave.training, 0, 150) || 0;
-	if (slave.indenture !== 0) {
-		slave.indenture = Math.max(+slave.indenture, -1) || -1;
-	}
-	slave.indentureRestrictions = Math.clamp(+slave.indentureRestriction, 0, 2) || 0;
-	slave.tired = Math.clamp(+slave.tired, 0, 1) || 0;
-	slave.hears = Math.clamp(+slave.hears, -2, 0) || 0;
-	if (typeof slave.earwear !== "string") {
-		slave.earwear = "none";
-	}
-	slave.heels = Math.clamp(+slave.heels, 0, 1) || 0;
-	slave.amp = Math.clamp(+slave.amp, -5, 1) || 0;
-	slave.PLimb = Math.clamp(+slave.PLimb, 0, 1) || 0;
-	if (slave.voice !== 0) {
-		slave.voice = Math.clamp(+slave.voice, 0, 3) || 1;
-	}
-	slave.electrolarynx = Math.clamp(+slave.electrolarynx, 0, 1) || 0;
-	slave.accent = Math.clamp(+slave.accent, 0, 3) || 0;
-	slave.missingEyes = Math.clamp(+slave.missingEyes, 0, 3) || 0;
-	slave.missingArms = Math.clamp(+slave.missingArms, 0, 3) || 0;
-	slave.missingLegs = Math.clamp(+slave.missingLegs, 0, 3) || 0;
-	if (typeof slave.ballType !== "string") {
-		slave.ballType = "human";
-	}
-	if (typeof slave.eggType !== "string") {
-		slave.eggType = "human";
-	}
-	if (typeof slave.origBodyOwner !== "string") {
-		slave.origBodyOwner = "";
-	}
-	slave.origBodyOwnerID = Math.max(+slave.origBodyOwnerID, 0) || 0;
-	if (typeof slave.death !== "string") {
-		slave.death = "";
-	}
-	if (slave.slaveCost !== 0) {
-		slave.slaveCost = Math.min(+slave.slaveCost, 1) || 1;
-	}
-	slave.lifetimeCashExpenses = Math.max(+slave.lifetimeCashExpenses, 0) || 0;
-	slave.lifetimeCashIncome = Math.max(+slave.lifetimeCashIncome, 0) || 0;
-	slave.lastWeeksCashIncome = Math.max(+slave.lifetimeCashIncome, 0) || 0;
-	slave.lifetimeRepExpenses = Math.max(+slave.lifetimeCashExpenses, 0) || 0;
-	slave.lifetimeRepIncome = Math.max(+slave.lifetimeCashIncome, 0) || 0;
-	slave.lastWeeksRepIncome = Math.max(+slave.lifetimeCashIncome, 0) || 0;
-};
+window.SlaveDatatypeCleanup = (function SlaveDatatypeCleanup() {
+	"use strict";
+	let V;
+	return SlaveDatatypeCleanup;
+
+	function SlaveDatatypeCleanup(slave) {
+		V = State.variables;
+		slaveAgeDatatypeCleanup(slave);
+		slavePhysicalDatatypeCleanup(slave);
+		slaveFaceDatatypeCleanup(slave);
+		slaveHairDatatypeCleanup(slave);
+		slaveBoobsDatatypeCleanup(slave);
+		slaveButtDatatypeCleanup(slave);
+		slavePregnancyDatatypeCleanup(slave);
+		slaveBellyDatatypeCleanup(slave);
+		slaveGenitaliaDatatypeCleanup(slave);
+		slaveImplantsDatatypeCleanup(slave);
+		slavePiercingsDatatypeCleanup(slave);
+		slaveTattooDatatypeCleanup(slave);
+		slaveCosmeticsDatatypeCleanup(slave);
+		slaveDietDatatypeCleanup(slave);
+		slavePornDatatypeCleanup(slave);
+		slaveRelationDatatypeCleanup(slave);
+		slaveSkillsDatatypeCleanup(slave);
+		slaveStatCountDatatypeCleanup(slave);
+		slavePreferencesDatatypeCleanup(slave);
+		slaveRulesDatatypeCleanup(slave);
+		slaveCustomStatsDatatypeCleanup(slave);
+		slaveMiscellaneousDatatypeCleanup(slave);
+		generatePronouns(slave);
+	}
+
+	function slaveAgeDatatypeCleanup(slave) {
+		slave.birthWeek = Math.clamp(+slave.birthWeek, 0, 51) || 0;
+		if (slave.age > 0) {
+			slave.actualAge = Math.clamp(+slave.actualAge, V.minimumSlaveAge, Infinity) || slave.age; /* if undefined, this sets to slave.age */
+		} else {
+			slave.actualAge = Math.clamp(+slave.actualAge, V.minimumSlaveAge, Infinity) || 18;
+			slave.age = slave.actualAge;
+		}
+		slave.visualAge = Math.max(+slave.visualAge, 0) || slave.actualAge;
+		slave.physicalAge = Math.max(+slave.physicalAge, 0) || slave.actualAge;
+		slave.ovaryAge = Math.max(+slave.ovaryAge, 0) || slave.physicalAge;
+		slave.pubertyAgeXX = Math.max(+slave.pubertyAgeXX, 0) || V.fertilityAge;
+		slave.pubertyAgeXY = Math.max(+slave.pubertyAgeXY, 0) || V.potencyAge;
+		slave.ageAdjust = Math.clamp(+slave.ageAdjust, -40, 40) || 0;
+		slave.NCSyouthening = Math.max(+slave.NCSyouthening, 0) || 0;
+	}
+
+	function slavePhysicalDatatypeCleanup(slave) {
+		if (typeof slave.nationality !== "string") {
+			slave.nationality = "slave";
+		}
+		if (typeof slave.race !== "string") {
+			nationalityToRace(slave);
+		}
+		if (typeof slave.origRace !== "string") {
+			slave.origRace = slave.race;
+		}
+		if (typeof slave.skin !== "string") {
+			slave.skin = "light";
+		}
+		if (typeof slave.origSkin !== "string") {
+			slave.origSkin = slave.skin;
+		}
+		if (typeof slave.minorInjury !== "string") {
+			slave.minorInjury = 0;
+		}
+		slave.health = Math.clamp(+slave.health, -100, 100) || 0;
+		slave.muscles = Math.clamp(+slave.muscles, -100, 100) || 0;
+		slave.weight = Math.clamp(+slave.weight, -100, 200) || 0;
+		slave.waist = Math.clamp(+slave.waist, -100, 100) || 0;
+		slave.height = Math.round(Math.max(+slave.height, 0)) || Math.round(Height.mean(slave));
+		slave.shoulders = Math.clamp(+slave.shoulders, -2, 2) || 0;
+		slave.hips = Math.clamp(+slave.hips, -2, 3) || 0;
+	}
+
+	function slaveFaceDatatypeCleanup(slave) {
+		slave.face = Math.clamp(+slave.face, -100, 100) || 0;
+		if (typeof slave.faceShape !== "string") {
+			slave.faceShape = "normal";
+		}
+		slave.eyes = Math.clamp(+slave.eyes, -3, 1) || 1; /* if 0 or undefined, this sets to 1 */
+		if (typeof slave.eyeColor !== "string") {
+			slave.eyeColor = "brown";
+		}
+		if (typeof slave.origEye !== "string") {
+			slave.origEye = slave.eyeColor;
+		}
+		if (typeof slave.pupil !== "string") {
+			slave.pupil = "circular";
+		}
+		if (typeof slave.sclerae !== "string") {
+			slave.sclerae = "white";
+		}
+		if (slave.lips !== 0) {
+			slave.lips = Math.clamp(+slave.lips, 0, 100) || 15;
+		}
+	}
+
+	function slaveHairDatatypeCleanup(slave) {
+		if (typeof slave.hColor !== "string") {
+			slave.hColor = "brown";
+		}
+		if (typeof slave.origHColor !== "string") {
+			slave.origHColor = slave.hColor;
+		}
+		if (slave.hLength !== 0) {
+			slave.hLength = Math.clamp(+slave.hLength, 0, 300) || 60;
+		}
+		if (typeof slave.hStyle !== "string") {
+			slave.hStyle = "long";
+		}
+		slave.haircuts = Math.clamp(+slave.haircuts, 0, 1) || 0;
+		slave.bald = Math.clamp(+slave.bald, 0, 1) || 0;
+		if (typeof slave.pubicHColor !== "string") {
+			slave.pubicHColor = slave.hColor;
+		}
+		if (typeof slave.pubicHStyle !== "string") {
+			slave.pubicHStyle = "neat";
+		}
+		if (typeof slave.underArmHColor !== "string") {
+			slave.underArmHColor = "slave.hColor";
+		}
+		if (typeof slave.underArmHStyle !== "string") {
+			slave.underArmHStyle = "waxed";
+		}
+		if (typeof slave.eyebrowHColor !== "string") {
+			slave.eyebrowHColor = "slave.hColor";
+		}
+		if (typeof slave.eyebrowHStyle !== "string") {
+			slave.eyebrowHStyle = "natural";
+		}
+		if (typeof slave.eyebrowFullness !== "string") {
+			slave.eyebrowFullness = "natural";
+		}
+	}
+
+	function slaveBoobsDatatypeCleanup(slave) {
+		slave.boobs = Math.max(+slave.boobs, 100) || 200;
+		if (typeof slave.boobShape !== "string") {
+			slave.boobShape = "normal";
+		}
+		if (typeof slave.nipples !== "string") {
+			slave.nipples = "cute";
+		}
+		if (typeof slave.nipplesAccessory !== "string") {
+			slave.nipplesAccessory = "none";
+		}
+		slave.areolae = Math.clamp(+slave.areolae, 0, 3) || 0;
+		if (typeof slave.areolaeShape !== "string") {
+			slave.areolaeShape = "circle";
+		}
+		slave.lactation = Math.clamp(+slave.lactation, 0, 2) || 0;
+		slave.boobsMilk = Math.max(+slave.boobsMilk, 0) || 0;
+		slave.lactationAdaptation = Math.clamp(+slave.lactationAdaptation, 0, 100) || 0;
+	}
+
+	function slaveButtDatatypeCleanup(slave) {
+		if (slave.butt !== 0) {
+			slave.butt = Math.clamp(+slave.butt, 0, 20) || 1;
+		}
+		slave.anus = Math.clamp(+slave.anus, 0, 4) || 0;
+		slave.analArea = Math.max(+slave.analArea, 0) || 0;
+	}
+
+	function slavePregnancyDatatypeCleanup(slave) {
+		slave.induce = Math.clamp(+slave.induce, 0, 1) || 0;
+		slave.labor = Math.clamp(+slave.labor, 0, 1) || 0;
+		slave.cSec = Math.clamp(+slave.cSec, 0, 1) || 0;
+		slave.prematureBirth = Math.clamp(+slave.prematureBirth, 0, 1) || 0;
+		slave.ovaries = Math.clamp(+slave.ovaries, 0, 1) || 0;
+		slave.vasectomy = Math.clamp(+slave.vasectomy, 0, 1) || 0;
+		slave.mpreg = Math.clamp(+slave.mpreg, 0, 1) || 0;
+		if (slave.pregAdaptation !== 0) {
+			slave.pregAdaptation = Math.max(+slave.pregAdaptation, 0) || 50;
+		}
+		slave.ovaImplant = Math.clamp(+slave.ovaImplant, -1, 2) || 0;
+		slave.broodmother = Math.clamp(+slave.broodmother, 0, 3) || 0;
+		slave.broodmotherFetuses = Math.max(+slave.broodmotherFetuses, 0) || 0;
+		slave.broodmotherOnHold = Math.clamp(+slave.broodmotherOnHold, 0, 1) || 0;
+		slave.pregSource = +slave.pregSource || 0;
+		if (typeof slave.pregControl !== "string") {
+			slave.pregControl = "none";
+		}
+		WombNormalizePreg(slave);
+	}
+
+	function slaveBellyDatatypeCleanup(slave) {
+		slave.inflation = Math.clamp(+slave.inflation, 0, 3) || 0;
+		if (typeof slave.inflationType !== "string") {
+			slave.inflationType = "none";
+		}
+		slave.inflationMethod = Math.clamp(+slave.inflationMethod, 0, 3) || 0;
+		slave.milkSource = Math.max(+slave.milkSource, 0) || 0;
+		slave.cumSource = Math.max(+slave.cumSource, 0) || 0;
+		slave.burst = Math.clamp(+slave.burst, 0, 1) || 0;
+		if (slave.bellyImplant !== 0) {
+			slave.bellyImplant = Math.max(+slave.bellyImplant, -1) || -1;
+		}
+		slave.cervixImplant = Math.clamp(+slave.cervixImplant, 0, 3) || 0;
+		slave.bellySag = Math.max(+slave.bellySag, 0) || 0;
+		slave.bellySagPreg = Math.max(+slave.bellySagPreg, 0) || slave.bellySag;
+		slave.bellyPain = Math.clamp(+slave.bellyPain, 0, 2) || 0;
+		SetBellySize(slave);
+	}
+
+	function slaveGenitaliaDatatypeCleanup(slave) {
+		slave.vagina = Math.clamp(+slave.vagina, -1, 10) || 0;
+		slave.vaginaLube = Math.clamp(+slave.vaginaLube, 0, 2) || 0;
+		slave.labia = Math.clamp(+slave.labia, 0, 3) || 0;
+		slave.clit = Math.clamp(+slave.clit, 0, 5) || 0;
+		slave.foreskin = Math.max(+slave.foreskin, 0) || 0;
+		slave.dick = Math.max(+slave.dick, 0) || 0;
+		if (slave.dick && slave.prostate !== 0) {
+			slave.prostate = Math.clamp(+slave.prostate, 0, 3) || 1;
+		} else {
+			slave.prostate = Math.clamp(+slave.prostate, 0, 3) || 0;
+		}
+		slave.balls = Math.max(+slave.balls, 0) || 0;
+		if (slave.scrotum !== 0) {
+			slave.scrotum = Math.max(+slave.scrotum, 0) || slave.balls;
+		}
+	}
+
+	function slaveImplantsDatatypeCleanup(slave) {
+		slave.ageImplant = Math.clamp(+slave.ageImplant, 0, 1) || 0;
+		slave.faceImplant = Math.clamp(+slave.faceImplant, 0, 100) || 0;
+		slave.lipsImplant = Math.clamp(+slave.lipsImplant, 0, 100) || 0;
+		slave.voiceImplant = Math.clamp(+slave.voiceImplant, -1, 1) || 0;
+		slave.boobsImplant = Math.max(+slave.boobsImplant, 0) || 0;
+		slave.boobsImplantType = Math.clamp(+slave.boobsImplantType, 0, 1) || 0;
+		slave.breastMesh = Math.clamp(+slave.breastMesh, 0, 1) || 0;
+		slave.buttImplant = Math.clamp(+slave.buttImplant, 0, 3) || 0;
+		slave.buttImplantType = Math.clamp(+slave.buttImplantType, 0, 1) || 0;
+		slave.heightImplant = Math.clamp(+slave.heightImplant, -1, 1) || 0;
+		slave.earImplant = Math.clamp(+slave.earImplant, 0, 1) || 0;
+		slave.shouldersImplant = Math.clamp(+slave.shouldersImplant, -1, 1) || 0;
+		slave.hipsImplant = Math.clamp(+slave.hipsImplant, -1, 1) || 0;
+	}
+
+	function slavePiercingsDatatypeCleanup(slave) {
+		slave.earPiercing = Math.clamp(+slave.earPiercing, 0, 2) || 0;
+		slave.nosePiercing = Math.clamp(+slave.nosePiercing, 0, 2) || 0;
+		slave.eyebrowPiercing = Math.clamp(+slave.eyebrowPiercing, 0, 2) || 0;
+		slave.lipsPiercing = Math.clamp(+slave.lipsPiercing, 0, 2) || 0;
+		slave.tonguePiercing = Math.clamp(+slave.tonguePiercing, 0, 2) || 0;
+		slave.nipplesPiercing = Math.clamp(+slave.nipplesPiercing, 0, 2) || 0;
+		slave.areolaePiercing = Math.clamp(+slave.areolaePiercing, 0, 2) || 0;
+		slave.corsetPiercing = Math.clamp(+slave.corsetPiercing, 0, 1) || 0;
+		slave.navelPiercing = Math.clamp(+slave.navelPiercing, 0, 2) || 0;
+		slave.clitPiercing = Math.clamp(+slave.clitPiercing, 0, 3) || 0;
+		slave.vaginaPiercing = Math.clamp(+slave.vaginaPiercing, 0, 2) || 0;
+		slave.dickPiercing = Math.clamp(+slave.dickPiercing, 0, 2) || 0;
+		slave.anusPiercing = Math.clamp(+slave.anusPiercing, 0, 2) || 0;
+	}
+
+	function slaveTattooDatatypeCleanup(slave) {
+		if (typeof slave.shouldersTat !== "string") {
+			slave.shouldersTat = 0;
+		}
+		if (typeof slave.lipsTat !== "string") {
+			slave.lipsTat = 0;
+		}
+		if (typeof slave.boobsTat !== "string") {
+			slave.boobsTat = 0;
+		}
+		if (typeof slave.armsTat !== "string") {
+			slave.armsTat = 0;
+		}
+		if (typeof slave.backTat !== "string") {
+			slave.backTat = 0;
+		}
+		if (typeof slave.stampTat !== "string") {
+			slave.stampTat = 0;
+		}
+		if (typeof slave.buttTat !== "string") {
+			slave.buttTat = 0;
+		}
+		if (typeof slave.vaginaTat !== "string") {
+			slave.vaginaTat = 0;
+		}
+		if (typeof slave.dickTat !== "string") {
+			slave.dickTat = 0;
+		}
+		if (typeof slave.anusTat !== "string") {
+			slave.anusTat = 0;
+		}
+		if (typeof slave.legsTat !== "string") {
+			slave.legsTat = 0;
+		}
+		if (typeof slave.bellyTat !== "string") {
+			slave.bellyTat = 0;
+		}
+		if (typeof slave.customTat !== "string") {
+			slave.customTat = "";
+		}
+	}
+
+	function slaveCosmeticsDatatypeCleanup(slave) {
+		slave.makeup = Math.clamp(+slave.makeup, 0, 8) || 0;
+		slave.nails = Math.clamp(+slave.nails, 0, 9) || 0;
+		slave.scars = Math.clamp(+slave.scars, 0, 6) || 0;
+		slave.choosesOwnClothes = Math.clamp(+slave.choosesOwnClothes, 0, 1) || 0;
+		if (typeof slave.clothes !== "string") {
+			slave.clothes = "no clothing";
+		}
+		if (typeof slave.collar !== "string") {
+			slave.collar = "none";
+		}
+		if (typeof slave.shoes !== "string") {
+			slave.shoes = "none";
+		}
+		if (typeof slave.eyewear !== "string") {
+			slave.eyewear = "none";
+		}
+		slave.brand = Math.clamp(+slave.brand, 0, 1) || 0;
+		if (typeof slave.brandLocation !== "string") {
+			slave.brandLocation = 0;
+		}
+		if (typeof slave.markings !== "string") {
+			slave.markings = "none";
+		}
+		if (typeof slave.bellyAccessory !== "string") {
+			slave.bellyAccessory = "none";
+		}
+		if (typeof slave.vaginalAccessory !== "string") {
+			slave.vaginalAccessory = "none";
+		}
+		if (typeof slave.dickAccessory !== "string") {
+			slave.dickAccessory = "none";
+		}
+		if (typeof slave.legAccessory !== "string") {
+			slave.legAccessory = "none";
+		}
+		if (typeof slave.buttplug !== "string") {
+			slave.buttplug = "none";
+		}
+		if (typeof slave.buttplugAttachment !== "string") {
+			slave.buttplugAttachment = "none";
+		}
+		if (typeof slave.headAccessory !== "string") {
+			slave.headAccessory = "none";
+		}
+		if (typeof slave.rearAccessory !== "string") {
+			slave.rearAccessory = "none";
+		}
+		if (typeof slave.backAccessory !== "string") {
+			slave.backAccessory = "none";
+		}
+	}
+
+	function slaveDietDatatypeCleanup(slave) {
+		if (typeof slave.diet !== "string") {
+			slave.diet = "healthy";
+		}
+		slave.dietCum = Math.clamp(+slave.dietCum, 0, 2) || 0;
+		slave.dietMilk = Math.clamp(+slave.dietMilk, 0, 2) || 0;
+		slave.onDiet = Math.clamp(+slave.onDiet, 0, 1) || 0;
+		slave.hormones = Math.clamp(+slave.hormones, -2, 2) || 0;
+		slave.hormoneBalance = Math.clamp(+slave.hormoneBalance, -400, 400) || 0;
+		if (typeof slave.drugs !== "string") {
+			slave.drugs = "no drugs";
+		}
+		slave.aphrodisiacs = Math.clamp(+slave.aphrodisiacs, 0, 2) || 0;
+		slave.curatives = Math.clamp(+slave.curatives, 0, 2) || 0;
+	}
+
+	function slavePornDatatypeCleanup(slave) {
+		slave.pornFeed = Math.clamp(+slave.pornFeed, 0, 1) || 0;
+		slave.pornFame = Math.max(+slave.pornFame, 0) || 0;
+		slave.pornFameSpending = Math.max(+slave.pornFameSpending, 0) || 0;
+		slave.pornPrestige = Math.clamp(+slave.pornPrestige, 0, 3) || 0;
+		if (typeof slave.pornPrestigeDesc !== "string") {
+			slave.pornPrestigeDesc = 0;
+		}
+		if (typeof slave.pornFameType !== "string") {
+			slave.pornFameType = "none";
+		}
+		if (typeof slave.pornFocus !== "string") {
+			slave.pornFocus = "none";
+		}
+		slave.pornTypeGeneral = Math.max(+slave.pornTypeGeneral, 0) || 0;
+		slave.pornTypeFuckdoll = Math.max(+slave.pornTypeFuckdoll, 0) || 0;
+		slave.pornTypeRape = Math.max(+slave.pornTypeRape, 0) || 0;
+		slave.pornTypePreggo = Math.max(+slave.pornTypePreggo, 0) || 0;
+		slave.pornTypeBBW = Math.max(+slave.pornTypeBBW, 0) || 0;
+		slave.pornTypeGainer = Math.max(+slave.pornTypeGainer, 0) || 0;
+		slave.pornTypeStud = Math.max(+slave.pornTypeStud, 0) || 0;
+		slave.pornTypeLoli = Math.max(+slave.pornTypeLoli, 0) || 0;
+		slave.pornTypeDeepThroat = Math.max(+slave.pornTypeDeepThroat, 0) || 0;
+		slave.pornTypeStruggleFuck = Math.max(+slave.pornTypeStruggleFuck, 0) || 0;
+		slave.pornTypePainal = Math.max(+slave.pornTypePainal, 0) || 0;
+		slave.pornTypeTease = Math.max(+slave.pornTypeTease, 0) || 0;
+		slave.pornTypeRomantic = Math.max(+slave.pornTypeRomantic, 0) || 0;
+		slave.pornTypePervert = Math.max(+slave.pornTypePervert, 0) || 0;
+		slave.pornTypeCaring = Math.max(+slave.pornTypeCaring, 0) || 0;
+		slave.pornTypeUnflinching = Math.max(+slave.pornTypeUnflinching, 0) || 0;
+		slave.pornTypeSizeQueen = Math.max(+slave.pornTypeSizeQueen, 0) || 0;
+		slave.pornTypeNeglectful = Math.max(+slave.pornTypeNeglectful, 0) || 0;
+		slave.pornTypeCumAddict = Math.max(+slave.pornTypeCumAddict, 0) || 0;
+		slave.pornTypeAnalAddict = Math.max(+slave.pornTypeAnalAddict, 0) || 0;
+		slave.pornTypeAttentionWhore = Math.max(+slave.pornTypeAttentionWhore, 0) || 0;
+		slave.pornTypeBreastGrowth = Math.max(+slave.pornTypeBreastGrowth, 0) || 0;
+		slave.pornTypeAbusive = Math.max(+slave.pornTypeAbusive, 0) || 0;
+		slave.pornTypeMalicious = Math.max(+slave.pornTypeMalicious, 0) || 0;
+		slave.pornTypeSelfHating = Math.max(+slave.pornTypeSelfHating, 0) || 0;
+		slave.pornTypeBreeder = Math.max(+slave.pornTypeBreeder, 0) || 0;
+		slave.pornTypeSub = Math.max(+slave.pornTypeSub, 0) || 0;
+		slave.pornTypeCumSlut = Math.max(+slave.pornTypeCumSlut, 0) || 0;
+		slave.pornTypeAnal = Math.max(+slave.pornTypeAnal, 0) || 0;
+		slave.pornTypeHumiliation = Math.max(+slave.pornTypeHumiliation, 0) || 0;
+		slave.pornTypeBoobs = Math.max(+slave.pornTypeBoobs, 0) || 0;
+		slave.pornTypeDom = Math.max(+slave.pornTypeDom, 0) || 0;
+		slave.pornTypeSadist = Math.max(+slave.pornTypeSadist, 0) || 0;
+		slave.pornTypeMasochist = Math.max(+slave.pornTypeMasochist, 0) || 0;
+		slave.pornTypePregnancy = Math.max(+slave.pornTypePregnancy, 0) || 0;
+	}
+
+	function slaveRelationDatatypeCleanup(slave) {
+		slave.mother = +slave.mother || 0;
+		slave.father = +slave.father || 0;
+		if (V.familyTesting == 0) {
+			slave.relationTarget = Math.max(+slave.relationTarget, 0) || 0;
+		}
+		slave.canRecruit = Math.clamp(+slave.canRecruit, 0, 1) || 0;
+		slave.relationship = Math.clamp(+slave.relationship, -3, 5) || 0;
+		slave.relationshipTarget = Math.max(+slave.relationshipTarget, 0) || 0;
+		slave.rivalryTarget = Math.max(+slave.rivalryTarget, 0) || 0;
+		slave.rivalry = Math.clamp(+slave.rivalry, 0, 3) || 0;
+		slave.cloneID = +slave.cloneID || 0;
+	}
+
+	function slaveSkillsDatatypeCleanup(slave) {
+		slave.oralSkill = Math.clamp(+slave.oralSkill, 0, 100) || 0;
+		slave.vaginalSkill = Math.clamp(+slave.vaginalSkill, 0, 100) || 0;
+		slave.analSkill = Math.clamp(+slave.analSkill, 0, 100) || 0;
+		slave.whoreSkill = Math.clamp(+slave.whoreSkill, 0, 100) || 0;
+		slave.entertainSkill = Math.clamp(+slave.entertainSkill, 0, 100) || 0;
+		slave.combatSkill = Math.clamp(+slave.combatSkill, 0, 1) || 0;
+		slave.skillHG = Math.clamp(+slave.skillHG, 0, 200) || 0;
+		slave.skillRC = Math.clamp(+slave.skillRC, 0, 200) || 0;
+		slave.skillBG = Math.clamp(+slave.skillBG, 0, 200) || 0;
+		slave.skillMD = Math.clamp(+slave.skillMD, 0, 200) || 0;
+		slave.skillDJ = Math.clamp(+slave.skillDJ, 0, 200) || 0;
+		slave.skillNU = Math.clamp(+slave.skillNU, 0, 200) || 0;
+		slave.skillTE = Math.clamp(+slave.skillTE, 0, 200) || 0;
+		slave.skillAT = Math.clamp(+slave.skillAT, 0, 200) || 0;
+		slave.skillMT = Math.clamp(+slave.skillMT, 0, 200) || 0;
+		slave.skillST = Math.clamp(+slave.skillST, 0, 200) || 0;
+		slave.skillMM = Math.clamp(+slave.skillMM, 0, 200) || 0;
+		slave.skillFA = Math.clamp(+slave.skillFA, 0, 200) || 0;
+		slave.skillWA = Math.clamp(+slave.skillWA, 0, 200) || 0;
+		slave.skillS = Math.clamp(+slave.skillS, 0, 200) || 0;
+		slave.skillE = Math.clamp(+slave.skillE, 0, 200) || 0;
+		slave.skillW = Math.clamp(+slave.skillW, 0, 200) || 0;
+	}
+
+	function slaveStatCountDatatypeCleanup(slave) {
+		slave.oralCount = Math.max(+slave.oralCount, 0) || 0;
+		slave.vaginalCount = Math.max(+slave.vaginalCount, 0) || 0;
+		slave.analCount = Math.max(+slave.analCount, 0) || 0;
+		slave.publicCount = Math.max(+slave.publicCount, 0) || 0;
+		slave.mammaryCount = Math.max(+slave.mammaryCount, 0) || 0;
+		slave.penetrativeCount = Math.max(+slave.penetrativeCount, 0) || 0;
+		slave.pitKills = Math.max(+slave.pitKills, 0) || 0;
+		slave.milk = Math.max(+slave.milk, 0) || 0;
+		slave.cum = Math.max(+slave.cum, 0) || 0;
+		slave.births = Math.max(+slave.births, 0) || 0;
+		slave.birthsTotal = Math.max(+slave.birthsTotal, 0) || slave.births;
+		slave.laborCount = Math.max(+slave.laborCount, 0) || slave.birthsTotal;
+		slave.slavesFathered = Math.max(+slave.slavesFathered, 0) || 0;
+		slave.PCChildrenFathered = Math.max(+slave.PCChildrenFathered, 0) || 0;
+		slave.slavesKnockedUp = Math.max(+slave.slavesKnockedUp, 0) || 0;
+		slave.PCKnockedUp = Math.max(+slave.PCKnockedUp, 0) || 0;
+		slave.bodySwap = Math.max(+slave.bodySwap, 0) || 0;
+	}
+
+	function slavePreferencesDatatypeCleanup(slave) {
+		slave.energy = Math.clamp(+slave.energy, 0, 100) || 0;
+		slave.need = Math.max(+slave.need, 0) || 0;
+		slave.attrXY = Math.clamp(+slave.attrXY, 0, 100) || 0;
+		slave.attrXX = Math.clamp(+slave.attrXX, 0, 100) || 0;
+		slave.attrKnown = Math.clamp(+slave.attrKnown, 0, 1) || 0;
+		slave.fetishStrength = Math.clamp(+slave.fetishStrength, 0, 100) || 0;
+		slave.fetishKnown = Math.clamp(+slave.fetishKnown, 0, 1) || 0;
+	}
+
+	function slaveRulesDatatypeCleanup(slave) {
+		if (typeof slave.standardPunishment !== "string") {
+			slave.standardPunishment = "situational";
+		}
+		if (typeof slave.standardReward !== "string") {
+			slave.standardReward = "situational";
+		}
+		if (slave.useRulesAssistant !== 0) {
+			slave.useRulesAssistant = 1;
+		}
+		slave.choosesOwnAssignment = Math.clamp(+slave.choosesOwnAssignment, 0) || 0;
+		slave.HGExclude = Math.clamp(+slave.HGExclude, 0, 1) || 0;
+		slave.choosesOwnChastity = Math.clamp(+slave.choosesOwnChastity, 0, 1) || 0;
+		slave.breedingMark = Math.clamp(+slave.breedingMark, 0, 1) || 0;
+		slave.rudeTitle = Math.clamp(+slave.rudeTitle, 0, 1) || 0;
+	}
+
+	function slaveCustomStatsDatatypeCleanup(slave) {
+		if (typeof slave.customLabel !== "string") {
+			slave.customLabel = "";
+		}
+		if (typeof slave.customDesc !== "string") {
+			slave.customDesc = "";
+		}
+		if (typeof slave.customTitle !== "string") {
+			slave.customTitle = "";
+		}
+		if (typeof slave.customTitleLisp !== "string") {
+			slave.customTitleLisp = "";
+		}
+		if (typeof slave.customImage !== "string") {
+			slave.customImage = 0;
+		}
+	}
+
+	function slaveMiscellaneousDatatypeCleanup(slave) {
+		slave.weekAcquired = Math.max(+slave.weekAcquired, 0) || 0;
+		slave.newGamePlus = Math.clamp(+slave.newGamePlus, 0, 1) || 0;
+		slave.prestige = Math.clamp(+slave.prestige, 0, 3) || 0;
+		slave.devotion = Math.clamp(+slave.devotion, -100, 100) || 0;
+		slave.oldDevotion = Math.clamp(+slave.oldDevotion, -100, 100) || 0;
+		slave.trust = Math.clamp(+slave.trust, -100, 100) || 0;
+		slave.oldTrust = Math.clamp(+slave.oldTrust, -100, 100) || 0;
+		slave.fuckdoll = Math.clamp(+slave.fuckdoll, 0, 100) || 0;
+		slave.chem = Math.max(+slave.chem, 0) || 0;
+		slave.addict = Math.max(+slave.addict, 0) || 0;
+		slave.intelligence = Math.clamp(+slave.intelligence, -100, 100) || 0;
+		slave.intelligenceImplant = Math.clamp(+slave.intelligenceImplant, 0, 30) || 0;
+		slave.premature = Math.clamp(+slave.premature, 0, 1) || 0;
+		slave.tankBaby = Math.clamp(+slave.tankBaby, 0, 2) || 0;
+		slave.subTarget = Math.max(+slave.subTarget, 0) || 0;
+		slave.sentence = Math.max(+slave.sentence, 0) || 0;
+		slave.training = Math.clamp(+slave.training, 0, 150) || 0;
+		if (slave.indenture !== 0) {
+			slave.indenture = Math.max(+slave.indenture, -1) || -1;
+		}
+		slave.indentureRestrictions = Math.clamp(+slave.indentureRestriction, 0, 2) || 0;
+		slave.tired = Math.clamp(+slave.tired, 0, 1) || 0;
+		slave.hears = Math.clamp(+slave.hears, -2, 0) || 0;
+		if (typeof slave.earwear !== "string") {
+			slave.earwear = "none";
+		}
+		slave.heels = Math.clamp(+slave.heels, 0, 1) || 0;
+		slave.amp = Math.clamp(+slave.amp, -5, 1) || 0;
+		slave.PLimb = Math.clamp(+slave.PLimb, 0, 1) || 0;
+		if (slave.voice !== 0) {
+			slave.voice = Math.clamp(+slave.voice, 0, 3) || 1;
+		}
+		slave.electrolarynx = Math.clamp(+slave.electrolarynx, 0, 1) || 0;
+		slave.accent = Math.clamp(+slave.accent, 0, 3) || 0;
+		slave.missingEyes = Math.clamp(+slave.missingEyes, 0, 3) || 0;
+		slave.missingArms = Math.clamp(+slave.missingArms, 0, 3) || 0;
+		slave.missingLegs = Math.clamp(+slave.missingLegs, 0, 3) || 0;
+		if (typeof slave.ballType !== "string") {
+			slave.ballType = "human";
+		}
+		if (typeof slave.eggType !== "string") {
+			slave.eggType = "human";
+		}
+		if (typeof slave.origBodyOwner !== "string") {
+			slave.origBodyOwner = "";
+		}
+		slave.origBodyOwnerID = Math.max(+slave.origBodyOwnerID, 0) || 0;
+		if (typeof slave.death !== "string") {
+			slave.death = "";
+		}
+		if (slave.slaveCost !== 0) {
+			slave.slaveCost = Math.min(+slave.slaveCost, 1) || 1;
+		}
+		slave.lifetimeCashExpenses = Math.max(+slave.lifetimeCashExpenses, 0) || 0;
+		slave.lifetimeCashIncome = Math.max(+slave.lifetimeCashIncome, 0) || 0;
+		slave.lastWeeksCashIncome = Math.max(+slave.lifetimeCashIncome, 0) || 0;
+		slave.lifetimeRepExpenses = Math.max(+slave.lifetimeCashExpenses, 0) || 0;
+		slave.lifetimeRepIncome = Math.max(+slave.lifetimeCashIncome, 0) || 0;
+		slave.lastWeeksRepIncome = Math.max(+slave.lifetimeCashIncome, 0) || 0;
+	}
+})();
 
 /* a lot of this may need to be removed */
 window.ChildDatatypeCleanup = function ChildDatatypeCleanup(child) {
@@ -1328,141 +1333,190 @@ window.ArcologyDatatypeCleanup = function ArcologyDatatypeCleanup() {
 	V.TFS.schoolProsperity = Math.clamp(+V.TFS.schoolProsperity, -10, 10) || 0;
 };
 
-window.FacilityDatatypeCleanup = function() {
-	FacilityIDArrayCleanup();
-	FacilityDecorationCleanup();
-	FacilityNameCleanup();
-};
-
-window.FacilityIDArrayCleanup = function() {
-	const V = State.variables;
-	if (!Array.isArray(V.BrothiIDs))
-		V.BrothiIDs = [];
-	else if (typeof V.BrothiIDs[0] === "object")
-		V.BrothiIDs = V.BrothiIDs.map(function(a) { return a.ID; });
-
-	if (!Array.isArray(V.DairyiIDs))
-		V.DairyiIDs = [];
-	else if (typeof V.DairyiIDs[0] === "object")
-		V.DairyiIDs = V.DairyiIDs.map(function(a) { return a.ID; });
-
-	if (!Array.isArray(V.ClubiIDs))
-		V.ClubiIDs = [];
-	else if (typeof V.ClubiIDs[0] === "object")
-		V.ClubiIDs = V.ClubiIDs.map(function(a) { return a.ID; });
-
-	if (!Array.isArray(V.ServQiIDs))
-		V.ServQiIDs = [];
-	else if (typeof V.ServQiIDs[0] === "object")
-		V.ServQiIDs = V.ServQiIDs.map(function(a) { return a.ID; });
-
-	if (!Array.isArray(V.SchlRiIDs))
-		V.SchlRiIDs = [];
-	else if (typeof V.SchlRiIDs[0] === "object")
-		V.SchlRiIDs = V.SchlRiIDs.map(function(a) { return a.ID; });
-
-	if (!Array.isArray(V.SpaiIDs))
-		V.SpaiIDs = [];
-	else if (typeof V.SpaiIDs[0] === "object")
-		V.SpaiIDs = V.SpaiIDs.map(function(a) { return a.ID; });
-
-	if (!Array.isArray(V.CliniciIDs))
-		V.CliniciIDs = [];
-	else if (typeof V.CliniciIDs[0] === "object")
-		V.CliniciIDs = V.CliniciIDs.map(function(a) { return a.ID; });
-
-	if (!Array.isArray(V.ArcadeiIDs))
-		V.ArcadeiIDs = [];
-	else if (typeof V.ArcadeiIDs[0] === "object")
-		V.ArcadeiIDs = V.ArcadeiIDs.map(function(a) { return a.ID; });
-
-	if (!Array.isArray(V.CellBiIDs))
-		V.CellBiIDs = [];
-	else if (typeof V.CellBiIDs[0] === "object")
-		V.CellBiIDs = V.CellBiIDs.map(function(a) { return a.ID; });
-
-	if (!Array.isArray(V.MastSiIDs))
-		V.MastSiIDs = [];
-	else if (typeof V.MastSiIDs[0] === "object")
-		V.MastSiIDs = V.MastSiIDs.map(function(a) { return a.ID; });
-
-	if (!Array.isArray(V.HGSuiteiIDs))
-		V.HGSuiteiIDs = [];
-	else if (typeof V.HGSuiteiIDs[0] === "object")
-		V.HGSuiteiIDs = V.HGSuiteiIDs.map(function(a) { return a.ID; });
-
-	if (!Array.isArray(V.NurseryiIDs))
-		V.NurseryiIDs = [];
-	else if (typeof V.NurseryiIDs[0] === "object")
-		V.NurseryiIDs = V.NurseryiIDs.map(function(a) { return a.ID; });
-
-	if (!Array.isArray(V.FarmyardiIDs))
-		V.FarmyardiIDs = [];
-	else if (typeof V.FarmyardiIDs[0] === "object")
-		V.FarmyardiIDs = V.FarmyardiIDs.map(function(a) { return a.ID; });
-};
-
-window.FacilityDecorationCleanup = function() {
-	const V = State.variables;
-	if (typeof V.brothelDecoration !== "string")
-		V.brothelDecoration = "standard";
-	if (typeof V.dairyDecoration !== "string")
-		V.dairyDecoration = "standard";
-	if (typeof V.clubDecoration !== "string")
-		V.clubDecoration = "standard";
-	if (typeof V.servantsQuartersDecoration !== "string")
-		V.servantsQuartersDecoration = "standard";
-	if (typeof V.schoolroomDecoration !== "string")
-		V.schoolroomDecoration = "standard";
-	if (typeof V.spaDecoration !== "string")
-		V.spaDecoration = "standard";
-	if (typeof V.clinicDecoration !== "string")
-		V.clinicDecoration = "standard";
-	if (typeof V.arcadeDecoration !== "string")
-		V.arcadeDecoration = "standard";
-	if (typeof V.cellblockDecoration !== "string")
-		V.cellblockDecoration = "standard";
-	if (typeof V.masterSuiteDecoration !== "string")
-		V.masterSuiteDecoration = "standard";
-	if (typeof V.nurseryDecoration !== "string")
-		V.nurseryDecoration = "standard";
-	if (typeof V.farmyardDecoration !== "string")
-		V.farmyardDecoration = "standard";
-	if (typeof V.brothelDecoration !== "string")
-		V.brothelDecoration = "standard";
-};
-
-window.FacilityNameCleanup = function FacilityNameCleanup() {
-	const V = State.variables;
-	V.arcologies[0].name = V.arcologies[0].name || "Arcology X-4";
-	V.brothelName = V.brothelName || "the Brothel";
-	V.brothelNameCaps = V.brothelNameCaps || "The Brothel";
-	V.dairyName = V.dairyName || "the Dairy";
-	V.dairyNameCaps = V.dairyNameCaps || "The Dairy";
-	V.clubName = V.clubName || "the Club";
-	V.clubNameCaps = V.clubNameCaps || "The Club";
-	V.servantsQuartersName = V.servantsQuartersName || "the Servants' Quarters";
-	V.servantsQuartersNameCaps = V.servantsQuartersNameCaps || "The Servants' Quarters";
-	V.schoolroomName = V.schoolroomName || "the Schoolroom";
-	V.schoolroomNameCaps = V.schoolroomNameCaps || "The Schoolroom";
-	V.spaName = V.spaName || "the Spa";
-	V.spaNameCaps = V.spaNameCaps || "The Spa";
-	V.nurseryName = V.nurseryName || "the Nursery";
-	V.nurseryNameCaps = V.nurseryNameCaps || "The Nursery";
-	V.clinicName = V.clinicName || "the Clinic";
-	V.clinicNameCaps = V.clinicNameCaps || "The Clinic";
-	V.arcadeName = V.arcadeName || "the Arcade";
-	V.arcadeNameCaps = V.arcadeNameCaps || "The Arcade";
-	V.cellblockName = V.cellblockName || "the Cellblock";
-	V.cellblockNameCaps = V.cellblockNameCaps || "The Cellblock";
-	V.masterSuiteName = V.masterSuiteName || "the Master Suite";
-	V.masterSuiteNameCaps = V.masterSuiteNameCaps || "The Master Suite";
-	V.HGSuiteName = V.HGSuiteName || "the Head Girl Suite";
-	V.HGSuiteNameCaps = V.HGSuiteNameCaps || "The Head Girl Suite";
-	V.pitName = V.pitName || "the Pit";
-	V.pitNameCaps = V.pitNameCaps || "The Pit";
-	V.incubatorName = V.incubatorName || "the Incubator";
-	V.incubatorNameCaps = V.incubatorNameCaps || "The Incubator";
-	V.farmyardName = V.farmyardName || "the Farmyard";
-	V.farmyardNameCaps = V.farmyardNameCaps || "The Farmyard";
-};
+window.FacilityDatatypeCleanup = (function() {
+	"use strict";
+	let V;
+	return FacilityDatatypeCleanup;
+
+	function FacilityDatatypeCleanup() {
+		V = State.variables;
+		/* common variables */
+		FacilityIDArrayCleanup();
+		FacilityDecorationCleanup();
+		FacilityNameCleanup();
+		/* facility specific variables */
+		BrothelDatatypeCleanup();
+		DairyDatatypeCleanup();
+		ClubDatatypeCleanup();
+		ServantsQuartersDatatypeCleanup();
+		SchoolroomDatatypeCleanup();
+	}
+
+	function FacilityIDArrayCleanup() {
+		function helperFunction(facilityIDArray) {
+			if (!Array.isArray(facilityIDArray))
+				facilityIDArray = [];
+			else if (typeof facilityIDArray[0] === "object")
+				facilityIDArray = facilityIDArray.map(function(a) { return a.ID; });
+		}
+		helperFunction(V.BrothiIDs);
+		helperFunction(V.DairyiIDs);
+		helperFunction(V.ClubiIDs);
+		helperFunction(V.ServQiIDs);
+		helperFunction(V.SchlRiIDs);
+		helperFunction(V.SpaiIDs);
+		helperFunction(V.CliniciIDs);
+		helperFunction(V.ArcadeiIDs);
+		helperFunction(V.CellBiIDs);
+		helperFunction(V.MastSiIDs);
+		helperFunction(V.HGSuiteiIDs);
+		helperFunction(V.NurseryiIDs);
+		helperFunction(V.FarmyardiIDs);
+	}
+
+	function FacilityDecorationCleanup() {
+		if (typeof V.brothelDecoration !== "string")
+			V.brothelDecoration = "standard";
+		if (typeof V.dairyDecoration !== "string")
+			V.dairyDecoration = "standard";
+		if (typeof V.clubDecoration !== "string")
+			V.clubDecoration = "standard";
+		if (typeof V.servantsQuartersDecoration !== "string")
+			V.servantsQuartersDecoration = "standard";
+		if (typeof V.schoolroomDecoration !== "string")
+			V.schoolroomDecoration = "standard";
+		if (typeof V.spaDecoration !== "string")
+			V.spaDecoration = "standard";
+		if (typeof V.clinicDecoration !== "string")
+			V.clinicDecoration = "standard";
+		if (typeof V.arcadeDecoration !== "string")
+			V.arcadeDecoration = "standard";
+		if (typeof V.cellblockDecoration !== "string")
+			V.cellblockDecoration = "standard";
+		if (typeof V.masterSuiteDecoration !== "string")
+			V.masterSuiteDecoration = "standard";
+		if (typeof V.nurseryDecoration !== "string")
+			V.nurseryDecoration = "standard";
+		if (typeof V.farmyardDecoration !== "string")
+			V.farmyardDecoration = "standard";
+		if (typeof V.brothelDecoration !== "string")
+			V.brothelDecoration = "standard";
+	}
+
+	function FacilityNameCleanup() {
+		V.arcologies[0].name = V.arcologies[0].name || "Arcology X-4";
+		V.brothelName = V.brothelName || "the Brothel";
+		V.brothelNameCaps = V.brothelNameCaps || "The Brothel";
+		V.dairyName = V.dairyName || "the Dairy";
+		V.dairyNameCaps = V.dairyNameCaps || "The Dairy";
+		V.clubName = V.clubName || "the Club";
+		V.clubNameCaps = V.clubNameCaps || "The Club";
+		V.servantsQuartersName = V.servantsQuartersName || "the Servants' Quarters";
+		V.servantsQuartersNameCaps = V.servantsQuartersNameCaps || "The Servants' Quarters";
+		V.schoolroomName = V.schoolroomName || "the Schoolroom";
+		V.schoolroomNameCaps = V.schoolroomNameCaps || "The Schoolroom";
+		V.spaName = V.spaName || "the Spa";
+		V.spaNameCaps = V.spaNameCaps || "The Spa";
+		V.nurseryName = V.nurseryName || "the Nursery";
+		V.nurseryNameCaps = V.nurseryNameCaps || "The Nursery";
+		V.clinicName = V.clinicName || "the Clinic";
+		V.clinicNameCaps = V.clinicNameCaps || "The Clinic";
+		V.arcadeName = V.arcadeName || "the Arcade";
+		V.arcadeNameCaps = V.arcadeNameCaps || "The Arcade";
+		V.cellblockName = V.cellblockName || "the Cellblock";
+		V.cellblockNameCaps = V.cellblockNameCaps || "The Cellblock";
+		V.masterSuiteName = V.masterSuiteName || "the Master Suite";
+		V.masterSuiteNameCaps = V.masterSuiteNameCaps || "The Master Suite";
+		V.HGSuiteName = V.HGSuiteName || "the Head Girl Suite";
+		V.HGSuiteNameCaps = V.HGSuiteNameCaps || "The Head Girl Suite";
+		V.pitName = V.pitName || "the Pit";
+		V.pitNameCaps = V.pitNameCaps || "The Pit";
+		V.incubatorName = V.incubatorName || "the Incubator";
+		V.incubatorNameCaps = V.incubatorNameCaps || "The Incubator";
+		V.farmyardName = V.farmyardName || "the Farmyard";
+		V.farmyardNameCaps = V.farmyardNameCaps || "The Farmyard";
+	}
+
+	function BrothelDatatypeCleanup() {
+		/* ads */
+		V.brothelAdsSpending = Math.clamp(+V.brothelAdsSpending, 0, 5000) || 0;
+		V.brothelAdsStacked = Math.clamp(+V.brothelAdsStacked, -1, 1) || 0;
+		V.brothelAdsImplanted = Math.clamp(+V.brothelAdsImplanted, -1, 1) || 0;
+		V.brothelAdsModded = Math.clamp(+V.brothelAdsModded, -1, 1) || 0;
+		V.brothelAdsPreg = Math.clamp(+V.brothelAdsPreg, -1, 1) || 0;
+		V.brothelAdsOld = Math.clamp(+V.brothelAdsOld, -3, 1) || 0;
+		V.brothelAdsXX = Math.clamp(+V.brothelAdsXX, -1, 1) || 0;
+		/* upgrades */
+		V.brothel = Math.max(+V.brothel, 0) || 0;
+		V.brothelUpgradeDrugs = Math.clamp(+V.brothelUpgradeDrugs, 0, 2) || 0;
+		/* madam */
+		V.Madam = V.slaves.find(function(s) { return s.assignment === "be the Madam"; }) || 0;
+		V.MadamIgnoresFlaws = Math.clamp(+V.MadamIgnoresFlaws, 0, 1) || 0;
+	}
+
+	function DairyDatatypeCleanup() {
+		/* upgrades */
+		V.dairy = Math.max(+V.dairy, 0) || 0;
+		V.dairyFeedersUpgrade = Math.clamp(+V.dairyFeedersUpgrade, 0, 1) || 0;
+		V.dairyFeedersSetting = Math.clamp(+V.dairyFeedersSetting, 0, 2) || 0;
+		V.dairyPregUpgrade = Math.clamp(+V.dairyPregUpgrade, 0, 1) || 0;
+		V.dairyPregSetting = Math.clamp(+V.dairyPregSetting, 0, 3) || 0;
+		V.dairyStimulatorsUpgrade = Math.clamp(+V.dairyStimulatorsUpgrade, 0, 1) || 0;
+		V.dairyStimulatorsSetting = Math.clamp(+V.dairyStimulatorsSetting, 0, 2) || 0;
+		V.dairyRestraintsUpgrade = Math.clamp(+V.dairyRestraintsUpgrade, 0, 1) || 0;
+		V.dairyRestraintsSetting = Math.clamp(+V.dairyRestraintsSetting, 0, 2) || 0;
+		V.dairySlimMaintainUpgrade = Math.clamp(+V.dairySlimMaintainUpgrade, 0, 1) || 0;
+		V.dairySlimMaintain = Math.clamp(+V.dairySlimMaintain, 0, 1) || 0;
+		V.dairyPrepUpgrade = Math.clamp(+V.dairyPrepUpgrade, 0, 1) || 0;
+		V.dairyHyperPregRemodel = Math.clamp(+V.dairyHyperPregRemodel, 0, 1) || 0;
+		V.dairyImplantsSetting = Math.clamp(+V.dairyImplantsSetting, 0, 3) || 0;
+		V.dairyWeightSetting = Math.clamp(+V.dairyWeightSetting, 0, 4) || 0;
+		/* bioreactors */
+		V.bioreactorsAnnounced = Math.clamp(+V.bioreactorsAnnounced, 0, 1) || 0;
+		V.createBioreactors = Math.clamp(+V.createBioreactors, 0, 1) || 0;
+		V.dairyUpgradeMenials = Math.clamp(+V.dairyUpgradeMenials, 0, 1) || 0;
+		V.bioreactorsHerm = Math.max(+V.bioreactorsHerm, 0) || 0;
+		V.bioreactorsXX = Math.max(+V.bioreactorsXX, 0) || 0;
+		V.bioreactorsXY = Math.max(+V.bioreactorsXY, 0) || 0;
+		V.bioreactorsBarren = Math.max(+V.bioreactorsBarren, 0) || 0;
+		/* milkmaid */
+		V.Milkmaid = V.slaves.find(function(s) { return s.assignment === "be the Milkmaid"; }) || 0;
+		V.milkmaidImpregnates = Math.clamp(+V.milkmaidImpregnates, 0, 1) || 0;
+	}
+
+	function ClubDatatypeCleanup() {
+		/* ads */
+		V.clubAdsSpending = Math.clamp(+V.clubAdsSpending, 0, 5000) || 0;
+		V.clubAdsStacked = Math.clamp(+V.clubAdsStacked, -1, 1) || 0;
+		V.clubAdsImplanted = Math.clamp(+V.clubAdsImplanted, -1, 1) || 0;
+		V.clubAdsModded = Math.clamp(+V.clubAdsModded, -1, 1) || 0;
+		V.clubAdsPreg = Math.clamp(+V.clubAdsPreg, -1, 1) || 0;
+		V.clubAdsOld = Math.clamp(+V.clubAdsOld, -3, 1) || 0;
+		V.clubAdsXX = Math.clamp(+V.clubAdsXX, -1, 1) || 0;
+		/* upgrades */
+		V.club = Math.max(+V.club, 0) || 0;
+		V.clubUpgradePDAs = Math.clamp(+V.clubUpgradePDAs, 0, 1) || 0;
+		/* madam */
+		V.DJ = V.slaves.find(function(s) { return s.assignment === "be the DJ"; }) || 0;
+		V.DJignoresFlaws = Math.clamp(+V.DJignoresFlaws, 0, 1) || 0;
+	}
+
+	function ServantsQuartersDatatypeCleanup() {
+		/* upgrades */
+		V.servantsQuarters = Math.max(+V.servantsQuarters, 0) || 0;
+		V.servantsQuartersUpgradeMonitoring = Math.clamp(+V.servantsQuartersUpgradeMonitoring, 0, 1) || 0;
+		/* stewardess */
+		V.Stewardess = V.slaves.find(function(s) { return s.assignment === "be the Stewardess"; }) || 0;
+		V.stewardessImpregnates = Math.clamp(+V.stewardessImpregnates, 0, 1) || 0;
+	}
+
+	function SchoolroomDatatypeCleanup() {
+		/* upgrades */
+		V.schoolroom = Math.max(+V.schoolroom, 0) || 0;
+		V.schoolroomUpgradeSkills = Math.clamp(+V.schoolroomUpgradeSkills, 0, 1) || 0;
+		V.schoolroomUpgradeLanguage = Math.clamp(+V.schoolroomUpgradeLanguage, 0, 1) || 0;
+		V.schoolroomUpgradeRemedial = Math.clamp(+V.schoolroomUpgradeRemedial, 0, 1) || 0;
+		/* stewardess */
+		V.Schoolteacher = V.slaves.find(function(s) { return s.assignment === "be the Schoolteacher"; }) || 0;
+	}
+})();
diff --git a/src/uncategorized/BackwardsCompatibility.tw b/src/uncategorized/BackwardsCompatibility.tw
index 51cb9703282805a5d9d2c91f9b14d50a814e3dda..a2d64636a0d6392e8b8299952456d3dc69bda552 100644
--- a/src/uncategorized/BackwardsCompatibility.tw
+++ b/src/uncategorized/BackwardsCompatibility.tw
@@ -631,9 +631,6 @@
 <<if ndef $freshPC>>
 	<<set $freshPC = 0>>
 <</if>>
-<<if ndef $brothelAdsPreg>>
-	<<set $brothelAdsPreg = 0>>
-<</if>>
 <<if ndef $dairyHyperPregRemodel>>
 	<<set $dairyHyperPregRemodel = 0>>
 <</if>>
@@ -643,9 +640,6 @@
 <<if ndef $dairyImplantsSetting>>
 	<<set $dairyImplantsSetting = 1>>
 <</if>>
-<<if ndef $clubAdsPreg>>
-	<<set $clubAdsPreg = 0>>
-<</if>>
 <<if ndef $spaFix>>
 	<<set $spaFix = 0>>
 <</if>>
@@ -1773,42 +1767,6 @@ Setting missing global variables:
 	<<set $roomsPopulation = 0>>
 <</if>>
 
-<<if ndef $dairyFeedersUpgrade>>
-	<<set $dairyFeedersUpgrade = 0>>
-<</if>>
-<<if ndef $dairyStimulatorsUpgrade>>
-	<<set $dairyStimulatorsUpgrade = 0>>
-<</if>>
-<<if ndef $dairyPregUpgrade>>
-	<<set $dairyPregUpgrade = 0>>
-<</if>>
-
-<<if ndef $createBioreactors>>
-	<<set $createBioreactors = 0>>
-<</if>>
-<<if ndef $bioreactorsAnnounced>>
-	<<set $bioreactorsAnnounced = 0>>
-<</if>>
-<<if ndef $bioreactorsHerm>>
-	<<set $bioreactorsHerm = 0>>
-<</if>>
-<<if ndef $bioreactorsXX>>
-	<<set $bioreactorsXX = 0>>
-<</if>>
-<<if ndef $bioreactorsXY>>
-	<<set $bioreactorsXY = 0>>
-<</if>>
-<<if ndef $bioreactorsBarren>>
-	<<set $bioreactorsBarren = 0>>
-<</if>>
-
-<<if ndef $schoolroomUpgradeSkills>>
-	<<set $schoolroomUpgradeSkills = 0>>
-<</if>>
-<<if ndef $schoolroomUpgradeLanguage>>
-	<<set $schoolroomUpgradeLanguage = 0>>
-<</if>>
-
 <<if ndef $clinicSlaves>>
 	<<set $clinicSlaves = 0>>
 <</if>>
diff --git a/src/uncategorized/dairy.tw b/src/uncategorized/dairy.tw
index 20ead7606363b282be2215bcb13c0bfb9321df93..e26e317a5121c0b8060b68e0001332329e9d4455 100644
--- a/src/uncategorized/dairy.tw
+++ b/src/uncategorized/dairy.tw
@@ -381,7 +381,7 @@ $dairyNameCaps
 <</if>>
 
 <<set _Tmult2 = Math.trunc(5000*$upgradeMultiplierArcology)>>
-<<if ($dairyPregUpgrade == 2) || ($dairyStimulatorsSetting == 2)>>
+<<if ($dairyPregSetting == 2) || ($dairyStimulatorsSetting == 2)>>
 <br>
 <<if $dairyPrepUpgrade == 1>>
 	$dairyNameCaps features a preparatory raper designed to gape slaves for integration.