From 292ec1f9a0b21cea1b01b6ffed691fe6e5c9db02 Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Sat, 9 Jan 2021 22:59:56 -0500
Subject: [PATCH] nest everything in functions to improve scoping

---
 src/facilities/surgery/surgeryPassageUpper.js | 1255 +++++++++--------
 1 file changed, 653 insertions(+), 602 deletions(-)

diff --git a/src/facilities/surgery/surgeryPassageUpper.js b/src/facilities/surgery/surgeryPassageUpper.js
index 95607b47f45..791f645edcc 100644
--- a/src/facilities/surgery/surgeryPassageUpper.js
+++ b/src/facilities/surgery/surgeryPassageUpper.js
@@ -11,736 +11,787 @@ App.UI.surgeryPassageUpper = function(slave, cheat = false) {
 	return container;
 
 	function content() {
-		const el = new DocumentFragment();
+		const frag = new DocumentFragment();
 		const {
 			His, He,
 			his, he
 		} = getPronouns(slave);
 		/** @type {HTMLAnchorElement[]} */
-		let linkArray;
 
-		App.Events.drawEventArt(el, slave);
+		App.Events.drawEventArt(frag, slave);
 
-		let r;
+		App.UI.DOM.appendNewElement("h3", frag, `Chest:`);
+		frag.append(
+			boobDesc(),
+			boobImplants(),
+			nipples(),
+			areolae(),
+			lactation()
+		);
+
+		App.UI.DOM.appendNewElement("h3", frag, `Midrif:`);
+
+		frag.append(
+			fat(),
+			moreFat(),
+			belly(),
+			wombImplant(),
+			bellySag()
+		);
+
+		return frag;
 
 		/* Generic boob desc*/
-		App.UI.DOM.appendNewElement("h3", el, `Chest:`);
-		r = [];
-		r.push(`${His}`);
-		if (slave.boobs < 300) {
-			r.push(`${either("androgynous", "flat")} chest is barely there.`);
-		} else if (slave.boobs < 400) {
-			r.push(`${either("pointy", "tiny")}, ${slave.boobs}cc chest only fill A-cups.`);
-		} else if (slave.boobs < 8500) {
-			if (V.showBoobCCs === 1) {
-				r.push(App.Desc.boobBits.format("%ADJ %NOUN, %VOLUME CCs, would fill %ACUP.", slave.boobs));
+		function boobDesc() {
+			const el = new DocumentFragment();
+			const r = [];
+			r.push(`${His}`);
+			if (slave.boobs < 300) {
+				r.push(`${either("androgynous", "flat")} chest is barely there.`);
+			} else if (slave.boobs < 400) {
+				r.push(`${either("pointy", "tiny")}, ${slave.boobs}cc chest only fill A-cups.`);
+			} else if (slave.boobs < 8500) {
+				if (V.showBoobCCs === 1) {
+					r.push(App.Desc.boobBits.format("%ADJ %NOUN, %VOLUME CCs, would fill %ACUP.", slave.boobs));
+				} else {
+					r.push(App.Desc.boobBits.format("%ADJ %NOUN, would fill %ACUP.", slave.boobs));
+				}
 			} else {
-				r.push(App.Desc.boobBits.format("%ADJ %NOUN, would fill %ACUP.", slave.boobs));
+				r.push(App.Desc.boobBits.format("%ADJ %NOUN, %VOLUME CCs, ", slave.boobs));
+				r.push(`fill out an enormous custom bra; ${his} tits dominate ${his} entire frame.`);
 			}
-		} else {
-			r.push(App.Desc.boobBits.format("%ADJ %NOUN, %VOLUME CCs, ", slave.boobs));
-			r.push(`fill out an enormous custom bra; ${his} tits dominate ${his} entire frame.`);
+			App.Events.addNode(el, r, "div");
+			return el;
 		}
-		App.Events.addNode(el, r, "div");
 
-		/* Boob implants*/
-		r = [];
-		r.push(`${He} has`);
-		if (["fillable", "advanced fillable", "hyper fillable"].includes(slave.boobsImplantType)) {
-			if (slave.boobsImplantType === "hyper fillable") {
-				if (slave.boobsImplant < 20000) {
-					r.push(`underfilled,`);
+		function boobImplants() {
+			const el = new DocumentFragment();
+			let r = [];
+			r.push(`${He} has`);
+			if (["fillable", "advanced fillable", "hyper fillable"].includes(slave.boobsImplantType)) {
+				if (slave.boobsImplantType === "hyper fillable") {
+					if (slave.boobsImplant < 20000) {
+						r.push(`underfilled,`);
+					} else {
+						r.push(`enormous,`);
+					}
+				} else if (slave.boobsImplantType === "advanced fillable") {
+					if (slave.boobsImplant <= 1000) {
+						r.push(`deflated,`);
+					} else if (slave.boobsImplant < 2200) {
+						r.push(`underfilled,`);
+					} else if (slave.boobsImplant > 10000) {
+						r.push(`massively overfilled,`);
+					} else {
+						r.push(`massive,`);
+					}
 				} else {
-					r.push(`enormous,`);
+					if (slave.boobsImplant <= 500) {
+						r.push(`deflated,`);
+					} else if (slave.boobsImplant < 800) {
+						r.push(`underfilled,`);
+					} else if (slave.boobsImplant > 1800) {
+						r.push(`massively overfilled,`);
+					} else if (slave.boobsImplant > 1000) {
+						r.push(`massive,`);
+					} else if (slave.boobsImplant >= 800) {
+						r.push(`giant,`);
+					}
 				}
-			} else if (slave.boobsImplantType === "advanced fillable") {
-				if (slave.boobsImplant <= 1000) {
-					r.push(`deflated,`);
-				} else if (slave.boobsImplant < 2200) {
-					r.push(`underfilled,`);
-				} else if (slave.boobsImplant > 10000) {
-					r.push(`massively overfilled,`);
-				} else {
-					r.push(`massive,`);
+				r.push(`${slave.boobsImplant}cc ${slave.boobsImplantType} breast implants.`);
+			} else if (slave.boobsImplantType !== "none") {
+				if (slave.boobsImplant > 1000) {
+					r.push(`massive, ${slave.boobsImplant}cc`);
+				} else if (slave.boobsImplant > 800) {
+					r.push(`giant, ${slave.boobsImplant}cc`);
+				} else if (slave.boobsImplant > 600) {
+					r.push(`huge, ${slave.boobsImplant}cc`);
+				} else if (slave.boobsImplant > 400) {
+					r.push(`large, ${slave.boobsImplant}cc`);
+				} else if (slave.boobsImplant > 200) {
+					r.push(`moderate, ${slave.boobsImplant}cc`);
+				} else if (slave.boobsImplant > 0) {
+					r.push(`small, ${slave.boobsImplant}cc`);
 				}
-			} else {
-				if (slave.boobsImplant <= 500) {
-					r.push(`deflated,`);
-				} else if (slave.boobsImplant < 800) {
-					r.push(`underfilled,`);
-				} else if (slave.boobsImplant > 1800) {
-					r.push(`massively overfilled,`);
-				} else if (slave.boobsImplant > 1000) {
-					r.push(`massive,`);
-				} else if (slave.boobsImplant >= 800) {
-					r.push(`giant,`);
+				if (slave.boobsImplantType !== "normal") {
+					r.push(`${slave.boobsImplantType}`);
 				}
+				r.push(`breast implants.`);
+				if (slave.boobsImplant > 8000 && slave.boobsImplantType === "string") {
+					r.push(`<span class="yellow">Large string based implants are a risk to a slave's health.</span>`);
+				}
+			} else {
+				r.push(`no implants.`);
 			}
-			r.push(`${slave.boobsImplant}cc ${slave.boobsImplantType} breast implants.`);
-		} else if (slave.boobsImplantType !== "none") {
-			if (slave.boobsImplant > 1000) {
-				r.push(`massive, ${slave.boobsImplant}cc`);
-			} else if (slave.boobsImplant > 800) {
-				r.push(`giant, ${slave.boobsImplant}cc`);
-			} else if (slave.boobsImplant > 600) {
-				r.push(`huge, ${slave.boobsImplant}cc`);
-			} else if (slave.boobsImplant > 400) {
-				r.push(`large, ${slave.boobsImplant}cc`);
-			} else if (slave.boobsImplant > 200) {
-				r.push(`moderate, ${slave.boobsImplant}cc`);
-			} else if (slave.boobsImplant > 0) {
-				r.push(`small, ${slave.boobsImplant}cc`);
-			}
-			if (slave.boobsImplantType !== "normal") {
-				r.push(`${slave.boobsImplantType}`);
-			}
-			r.push(`breast implants.`);
-			if (slave.boobsImplant > 8000 && slave.boobsImplantType === "string") {
-				r.push(`<span class="yellow">Large string based implants are a risk to a slave's health.</span>`);
-			}
-		} else {
-			r.push(`no implants.`);
-		}
-		App.Events.addNode(el, r, "div");
-		const _surgeries = App.Medicine.Surgery.sizingProcedures.boobs(slave, App.Medicine.Surgery.allSizingOptions());
-		const _surgeryLinks = _surgeries.map(s => App.Medicine.Surgery.makeLink("Surgery Degradation", s, slave));
-		App.UI.DOM.appendNewElement("div", el, (App.UI.DOM.generateLinksStrip(_surgeryLinks)), "choices");
+			App.Events.addNode(el, r, "div");
+			const _surgeries = App.Medicine.Surgery.sizingProcedures.boobs(slave, App.Medicine.Surgery.allSizingOptions());
+			const _surgeryLinks = _surgeries.map(s => App.Medicine.Surgery.makeLink("Surgery Degradation", s, slave));
+			App.UI.DOM.appendNewElement("div", el, (App.UI.DOM.generateLinksStrip(_surgeryLinks)), "choices");
 
-		r = [];
-		linkArray = [];
-		if (slave.boobsImplant !== 0) {
-			r.push(`The shape of ${his} breasts is determined by ${his} implants.`);
-		} else {
-			if (slave.boobs <= 250) {
-				r.push(`${He}'s so flat-chested that ${his} breasts don't have much shape.`);
+			r = [];
+			const linkArray = [];
+			if (slave.boobsImplant !== 0) {
+				r.push(`The shape of ${his} breasts is determined by ${his} implants.`);
 			} else {
-				switch (slave.boobShape) {
-					case "perky":
-						r.push(`They're perky, with nipples that point slightly upwards.`);
-						break;
-					case "downward-facing":
-						r.push(`They're not attractively shaped; ${his} nipples pointing downward.`);
-						break;
-					case "torpedo-shaped":
-						r.push(`They're torpedo-shaped, projecting some way from ${his} chest.`);
-						break;
-					case "wide-set":
-						r.push(`They're wide-set, with nipples pointing away from ${his} sternum.`);
-						break;
-					case "saggy":
-						r.push(`They're not attractively shaped, with ${his} nipples pointing down.`);
-						break;
-					default:
-						r.push(`They're nicely rounded and rest naturally.`);
-				}
-				if (slave.indentureRestrictions >= 2) {
-					r.push(`<span class="note">${His} indenture does not allow breast restructuring</span>`);
-				} else if (slave.breastMesh === 1) {
-					r.push(`<span class="note">${His} supportive mesh implant prevents reconstruction</span>`);
+				if (slave.boobs <= 250) {
+					r.push(`${He}'s so flat-chested that ${his} breasts don't have much shape.`);
 				} else {
-					if (slave.boobShape === "saggy" || slave.boobShape === "downward-facing") {
-						linkArray.push(makeLink(
-							"Breast lift",
-							"breastLift",
-							() => {
-								slave.boobShape = "normal";
-								surgeryDamage(slave, 20);
-							}
-						));
-						if (slave.preg > slave.pregData.normalBirth / 1.42 || (slave.boobs >= 5000 && slave.boobs < 8000)) {
-							r.push(` <span class="note">${His} current state may result in ${his} breasts becoming saggy again</span>`);
-						}
+					switch (slave.boobShape) {
+						case "perky":
+							r.push(`They're perky, with nipples that point slightly upwards.`);
+							break;
+						case "downward-facing":
+							r.push(`They're not attractively shaped; ${his} nipples pointing downward.`);
+							break;
+						case "torpedo-shaped":
+							r.push(`They're torpedo-shaped, projecting some way from ${his} chest.`);
+							break;
+						case "wide-set":
+							r.push(`They're wide-set, with nipples pointing away from ${his} sternum.`);
+							break;
+						case "saggy":
+							r.push(`They're not attractively shaped, with ${his} nipples pointing down.`);
+							break;
+						default:
+							r.push(`They're nicely rounded and rest naturally.`);
+					}
+					if (slave.indentureRestrictions >= 2) {
+						r.push(`<span class="note">${His} indenture does not allow breast restructuring</span>`);
+					} else if (slave.breastMesh === 1) {
+						r.push(`<span class="note">${His} supportive mesh implant prevents reconstruction</span>`);
 					} else {
-						if (slave.boobShape === "normal") {
+						if (slave.boobShape === "saggy" || slave.boobShape === "downward-facing") {
 							linkArray.push(makeLink(
-								"Reshape them to be perkier",
-								"breastReconstruction",
-								() => {
-									slave.boobShape = "perky";
-									surgeryDamage(slave, 10);
-								}
-							));
-							linkArray.push(makeLink(
-								"Make them torpedo-shaped",
-								"breastReconstruction",
-								() => {
-									slave.boobShape = "torpedo-shaped";
-									surgeryDamage(slave, 10);
-								}
-							));
-						} else {
-							linkArray.push(makeLink(
-								"Reshape them to be more normal",
-								"breastReconstruction",
+								"Breast lift",
+								"breastLift",
 								() => {
 									slave.boobShape = "normal";
-									surgeryDamage(slave, 10);
+									surgeryDamage(slave, 20);
 								}
 							));
+							if (slave.preg > slave.pregData.normalBirth / 1.42 || (slave.boobs >= 5000 && slave.boobs < 8000)) {
+								r.push(` <span class="note">${His} current state may result in ${his} breasts becoming saggy again</span>`);
+							}
+						} else {
+							if (slave.boobShape === "normal") {
+								linkArray.push(makeLink(
+									"Reshape them to be perkier",
+									"breastReconstruction",
+									() => {
+										slave.boobShape = "perky";
+										surgeryDamage(slave, 10);
+									}
+								));
+								linkArray.push(makeLink(
+									"Make them torpedo-shaped",
+									"breastReconstruction",
+									() => {
+										slave.boobShape = "torpedo-shaped";
+										surgeryDamage(slave, 10);
+									}
+								));
+							} else {
+								linkArray.push(makeLink(
+									"Reshape them to be more normal",
+									"breastReconstruction",
+									() => {
+										slave.boobShape = "normal";
+										surgeryDamage(slave, 10);
+									}
+								));
+							}
+							if (slave.boobShape !== "saggy" && slave.boobShape !== "downward-facing" && slave.boobs >= 2000 && slave.boobsImplant === 0 && V.meshImplants === 1 && V.surgeryUpgrade === 1) {
+								linkArray.push(makeLink(
+									"Implant a supportive mesh to preserve their shape",
+									"breastShapePreservation",
+									() => {
+										slave.breastMesh = 1;
+										surgeryDamage(slave, 10);
+									},
+									slave.boobs / 100
+								));
+							}
 						}
-						if (slave.boobShape !== "saggy" && slave.boobShape !== "downward-facing" && slave.boobs >= 2000 && slave.boobsImplant === 0 && V.meshImplants === 1 && V.surgeryUpgrade === 1) {
+					}
+				}
+			}
+			App.Events.addNode(el, r, "div");
+			App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices");
+			return el;
+		}
+
+		/* Nipples*/
+		function nipples() {
+			const el = new DocumentFragment();
+			if (V.surgeryUpgrade === 1) {
+				App.UI.DOM.appendNewElement("div", el, `${He} has ${slave.nipples} nipples.`);
+				if (slave.indentureRestrictions >= 2) {
+					App.UI.DOM.appendNewElement("div", el, `${His} indenture forbids elective surgery`, ["choices", "note"]);
+				} else if (slave.indentureRestrictions === 1) {
+					App.UI.DOM.appendNewElement("div", el, `${His} indenture forbids extreme body modification`, ["choices", "note"]);
+				} else { /* split for possible dicknips later on, should lcd wish to attempt it again. */
+					const linkArray = [];
+					if (slave.nipples === "fuckable") {
+						linkArray.push(makeLink(
+							"Restore their shape and function",
+							"areolae",
+							() => {
+								slave.nipples = "huge";
+								surgeryDamage(slave, 10);
+							}
+						));
+					} else {
+						if (slave.boobs - slave.boobsMilk < 500) {
+							App.UI.DOM.appendNewElement("div", el, `${His} breasts are too small to support reshaping ${his} nipples to be penetratable`, ["choices", "note"]);
+						} else if (slave.boobs - slave.boobsImplant - slave.boobsMilk < 500) {
+							App.UI.DOM.appendNewElement("div", el, `${His} implants are too large to support reshaping ${his} nipples to be penetratable`, ["choices", "note"]);
+						} else if (slave.nipples !== "huge") {
+							App.UI.DOM.appendNewElement("div", el, `${His} nipples are too small to be made fuckable`, ["choices", "note"]);
+						} else {
 							linkArray.push(makeLink(
-								"Implant a supportive mesh to preserve their shape",
-								"breastShapePreservation",
+								"Reshape them to support being penetrated",
+								"nippleCunts",
 								() => {
-									slave.breastMesh = 1;
-									surgeryDamage(slave, 10);
+									slave.nipples = "fuckable";
+									slave.nipplesPiercing = 0;
+									surgeryDamage(slave, 20);
 								},
-								slave.boobs / 100
+								1,
+								(slave.nipplesPiercing > 0) ? `Will remove piercings` : ``
 							));
 						}
 					}
+					App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices");
 				}
 			}
+			return el;
 		}
-		App.Events.addNode(el, r, "div");
-		App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices");
 
-		/* Nipples*/
-		if (V.surgeryUpgrade === 1) {
-			App.UI.DOM.appendNewElement("div", el, `${He} has ${slave.nipples} nipples.`);
-			if (slave.indentureRestrictions >= 2) {
-				App.UI.DOM.appendNewElement("div", el, `${His} indenture forbids elective surgery`, ["choices", "note"]);
-			} else if (slave.indentureRestrictions === 1) {
-				App.UI.DOM.appendNewElement("div", el, `${His} indenture forbids extreme body modification`, ["choices", "note"]);
-			} else { /* split for possible dicknips later on, should lcd wish to attempt it again. */
-				linkArray = [];
-				if (slave.nipples === "fuckable") {
+		/* Areolae*/
+		function areolae() {
+			const el = new DocumentFragment();
+			const r = [];
+			const linkArray = [];
+			if (slave.areolae === 0) {
+				r.push(`${His} areolae are small`);
+				if (slave.areolaeShape !== "circle") {
+					r.push(`and have been surgically altered to be ${slave.areolaeShape}-shaped.`);
+				} else {
+					r.push(`and fairly normal.`);
+				}
+			} else if (slave.areolae === 1) {
+				r.push(`${His} areolae are large`);
+				if (slave.areolaeShape !== "circle") {
+					r.push(`and have been surgically altered to be ${slave.areolaeShape}-shaped.`);
+				} else {
+					r.push(`but still fairly normal.`);
+				}
+			} else if (slave.areolae > 1) {
+				r.push(`${He} has`);
+				if (slave.areolae === 2) {
+					r.push(`wide`);
+				} else if (slave.areolae === 3) {
+					r.push(`huge`);
+				} else if (slave.areolae === 4) {
+					r.push(`massive`);
+				}
+				r.push(`areolae${(slave.areolaeShape !== "circle") ? `, which have been surgically altered to be ${slave.areolaeShape}-shaped` : ``}.`);
+			}
+			if (slave.indentureRestrictions < 2) {
+				if (slave.areolaeShape !== "circle") {
+					r.push(`${His} ${slave.areolaeShape}-shaped areolae can be normalized or reshaped:`);
 					linkArray.push(makeLink(
-						"Restore their shape and function",
+						"Normal",
 						"areolae",
 						() => {
-							slave.nipples = "huge";
+							slave.areolaeShape = "circle";
 							surgeryDamage(slave, 10);
 						}
 					));
+					if (slave.areolaeShape !== "heart") {
+						linkArray.push(makeLink(
+							"Heart-shaped",
+							"areolae",
+							() => {
+								slave.areolaeShape = "heart";
+								surgeryDamage(slave, 10);
+							}
+						));
+					}
+					if (slave.areolaeShape !== "star") {
+						linkArray.push(makeLink(
+							"Star-shaped",
+							"areolae",
+							() => {
+								slave.areolaeShape = "star";
+								surgeryDamage(slave, 10);
+							}
+						));
+					}
 				} else {
-					if (slave.boobs - slave.boobsMilk < 500) {
-						App.UI.DOM.appendNewElement("div", el, `${His} breasts are too small to support reshaping ${his} nipples to be penetratable`, ["choices", "note"]);
-					} else if (slave.boobs - slave.boobsImplant - slave.boobsMilk < 500) {
-						App.UI.DOM.appendNewElement("div", el, `${His} implants are too large to support reshaping ${his} nipples to be penetratable`, ["choices", "note"]);
-					} else if (slave.nipples !== "huge") {
-						App.UI.DOM.appendNewElement("div", el, `${His} nipples are too small to be made fuckable`, ["choices", "note"]);
-					} else {
+					if (slave.areolae > 0 && slave.areolaeShape === "circle") {
+						r.push(`They are big enough that they could be reshaped into a pattern. Graft skin to make ${his} areolae:`);
+					}
+					if (slave.areolae > 0 && slave.areolaeShape === "circle") {
 						linkArray.push(makeLink(
-							"Reshape them to support being penetrated",
-							"nippleCunts",
+							"Heart-shaped",
+							"areolae",
 							() => {
-								slave.nipples = "fuckable";
-								slave.nipplesPiercing = 0;
-								surgeryDamage(slave, 20);
-							},
-							1,
-							(slave.nipplesPiercing > 0) ? `Will remove piercings` : ``
+								slave.areolae -= 1;
+								slave.areolaeShape = "heart";
+								surgeryDamage(slave, 10);
+							}
+						));
+						linkArray.push(makeLink(
+							"Star-shaped",
+							"areolae",
+							() => {
+								slave.areolae -= 1;
+								slave.areolaeShape = "star";
+								surgeryDamage(slave, 10);
+							}
 						));
 					}
 				}
-				App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices");
-			}
-		}
 
-		/* Areolae*/
-		r = [];
-		linkArray = [];
-		if (slave.areolae === 0) {
-			r.push(`${His} areolae are small`);
-			if (slave.areolaeShape !== "circle") {
-				r.push(`and have been surgically altered to be ${slave.areolaeShape}-shaped.`);
-			} else {
-				r.push(`and fairly normal.`);
-			}
-		} else if (slave.areolae === 1) {
-			r.push(`${His} areolae are large`);
-			if (slave.areolaeShape !== "circle") {
-				r.push(`and have been surgically altered to be ${slave.areolaeShape}-shaped.`);
-			} else {
-				r.push(`but still fairly normal.`);
-			}
-		} else if (slave.areolae > 1) {
-			r.push(`${He} has`);
-			if (slave.areolae === 2) {
-				r.push(`wide`);
-			} else if (slave.areolae === 3) {
-				r.push(`huge`);
-			} else if (slave.areolae === 4) {
-				r.push(`massive`);
-			}
-			r.push(`areolae${(slave.areolaeShape !== "circle") ? `, which have been surgically altered to be ${slave.areolaeShape}-shaped` : ``}.`);
-		}
-		if (slave.indentureRestrictions < 2) {
-			if (slave.areolaeShape !== "circle") {
-				r.push(`${His} ${slave.areolaeShape}-shaped areolae can be normalized or reshaped:`);
-				linkArray.push(makeLink(
-					"Normal",
-					"areolae",
-					() => {
-						slave.areolaeShape = "circle";
-						surgeryDamage(slave, 10);
-					}
-				));
-				if (slave.areolaeShape !== "heart") {
+				if (slave.areolae > 0) {
 					linkArray.push(makeLink(
-						"Heart-shaped",
+						"Reduce areolae",
 						"areolae",
 						() => {
-							slave.areolaeShape = "heart";
+							slave.areolae -= 1;
 							surgeryDamage(slave, 10);
 						}
 					));
 				}
-				if (slave.areolaeShape !== "star") {
+				if (slave.areolae < 4) {
 					linkArray.push(makeLink(
-						"Star-shaped",
+						"Enlarge areolae",
 						"areolae",
 						() => {
-							slave.areolaeShape = "star";
+							slave.areolae += 1;
 							surgeryDamage(slave, 10);
 						}
 					));
 				}
+			}
+			App.Events.addNode(el, r, "div");
+			App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices");
+			return el;
+		}
+
+		/* Lactation*/
+		function lactation() {
+			const el = new DocumentFragment();
+			const r = [];
+			const linkArray = [];
+			if (slave.lactation === 0) {
+				r.push(`${He} is not lactating.`);
+			} else if (slave.lactation === 2) {
+				r.push(`${He} is implanted with slow-release pro-lactation drugs.`);
 			} else {
-				if (slave.areolae > 0 && slave.areolaeShape === "circle") {
-					r.push(`They are big enough that they could be reshaped into a pattern. Graft skin to make ${his} areolae:`);
-				}
-				if (slave.areolae > 0 && slave.areolaeShape === "circle") {
-					linkArray.push(makeLink(
-						"Heart-shaped",
-						"areolae",
-						() => {
-							slave.areolae -= 1;
-							slave.areolaeShape = "heart";
-							surgeryDamage(slave, 10);
-						}
-					));
+				r.push(`${He} is lactating naturally.`);
+			}
+			if (slave.lactation < 2) {
+				if (slave.indentureRestrictions < 2) {
 					linkArray.push(makeLink(
-						"Star-shaped",
-						"areolae",
+						"Implant slow-release pro-lactation drugs",
+						"lactation",
 						() => {
-							slave.areolae -= 1;
-							slave.areolaeShape = "star";
+							slave.lactationDuration = 2;
+							slave.induceLactation = 0;
+							slave.boobs -= slave.boobsMilk;
+							slave.boobsMilk = 0;
+							slave.rules.lactation = "none";
 							surgeryDamage(slave, 10);
-						}
+						},
+						1,
+						`This may increase ${his} natural breast size`
 					));
 				}
 			}
-
-			if (slave.areolae > 0) {
-				linkArray.push(makeLink(
-					"Reduce areolae",
-					"areolae",
-					() => {
-						slave.areolae -= 1;
-						surgeryDamage(slave, 10);
-					}
-				));
-			}
-			if (slave.areolae < 4) {
+			if (slave.lactation > 1) {
 				linkArray.push(makeLink(
-					"Enlarge areolae",
-					"areolae",
+					"Remove lactation implant",
+					"endlac",
 					() => {
-						slave.areolae += 1;
+						slave.lactation = 0;
+						slave.lactationDuration = 0;
 						surgeryDamage(slave, 10);
 					}
 				));
 			}
+			App.Events.addNode(el, r, "div");
+			App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices");
+			return el;
 		}
-		App.Events.addNode(el, r, "div");
-		App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices");
-
-		/* Lactation*/
-		r = [];
-		linkArray = [];
-		if (slave.lactation === 0) {
-			r.push(`${He} is not lactating.`);
-		} else if (slave.lactation === 2) {
-			r.push(`${He} is implanted with slow-release pro-lactation drugs.`);
-		} else {
-			r.push(`${He} is lactating naturally.`);
-		}
-		// <div class="choices">
-		if (slave.lactation < 2) {
-			if (slave.indentureRestrictions < 2) {
-				linkArray.push(makeLink(
-					"Implant slow-release pro-lactation drugs",
-					"lactation",
-					() => {
-						slave.lactationDuration = 2;
-						slave.induceLactation = 0;
-						slave.boobs -= slave.boobsMilk;
-						slave.boobsMilk = 0;
-						slave.rules.lactation = "none";
-						surgeryDamage(slave, 10);
-					},
-					1,
-					`This may increase ${his} natural breast size`
-				));
-			}
-		}
-		if (slave.lactation > 1) {
-			linkArray.push(makeLink(
-				"Remove lactation implant",
-				"endlac",
-				() => {
-					slave.lactation = 0;
-					slave.lactationDuration = 0;
-					surgeryDamage(slave, 10);
-				}
-			));
-		}
-		App.Events.addNode(el, r, "div");
-		App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices");
 
-
-		App.UI.DOM.appendNewElement("h3", el, `Midrif:`);
 		/* Fat*/
-		r = [];
-		linkArray = [];
-		if (slave.indentureRestrictions >= 2 && slave.weight > 30) {
-			App.UI.DOM.appendNewElement("div", el, `${His} indenture forbids elective surgery`, ["choices", "note"]);
-		} else if (slave.weight > 30) {
-			if (slave.weight > 190) {
-				r.push(`${He} is extremely fat.`);
-				linkArray.push(makeLink(
-					"Major liposuction",
-					"liposuction",
-					() => {
-						slave.weight = 0;
-						surgeryDamage(slave, 40);
-					}
-				));
-			} else if (slave.weight > 130) {
-				r.push(`${He} is fat.`);
-				linkArray.push(makeLink(
-					"Heavy liposuction",
-					"liposuction",
-					() => {
-						slave.weight = 0;
-						surgeryDamage(slave, 20);
-					}
-				));
+		function fat() {
+			const el = new DocumentFragment();
+			const r = [];
+			const linkArray = [];
+			if (slave.indentureRestrictions >= 2 && slave.weight > 30) {
+				App.UI.DOM.appendNewElement("div", el, `${His} indenture forbids elective surgery`, ["choices", "note"]);
 			} else if (slave.weight > 30) {
-				r.push(`${He} is overweight.`);
-				linkArray.push(makeLink(
-					"Liposuction",
-					"liposuction",
-					() => {
-						slave.weight = 0;
-						surgeryDamage(slave, 10);
-					}
-				));
-			}
-			if (V.surgeryUpgrade === 1) {
-				linkArray.push(
-					App.UI.DOM.link(
-						"Fat grafting",
+				if (slave.weight > 190) {
+					r.push(`${He} is extremely fat.`);
+					linkArray.push(makeLink(
+						"Major liposuction",
+						"liposuction",
 						() => {
+							slave.weight = 0;
 							surgeryDamage(slave, 40);
-							cashX(forceNeg(V.surgeryCost * 2), "slaveSurgery", slave);
-							V.surgeryType = "fat graft";
-						},
-						[],
-						"Fat Grafting"
-					)
-				);
+						}
+					));
+				} else if (slave.weight > 130) {
+					r.push(`${He} is fat.`);
+					linkArray.push(makeLink(
+						"Heavy liposuction",
+						"liposuction",
+						() => {
+							slave.weight = 0;
+							surgeryDamage(slave, 20);
+						}
+					));
+				} else if (slave.weight > 30) {
+					r.push(`${He} is overweight.`);
+					linkArray.push(makeLink(
+						"Liposuction",
+						"liposuction",
+						() => {
+							slave.weight = 0;
+							surgeryDamage(slave, 10);
+						}
+					));
+				}
+				if (V.surgeryUpgrade === 1) {
+					linkArray.push(
+						App.UI.DOM.link(
+							"Fat grafting",
+							() => {
+								surgeryDamage(slave, 40);
+								cashX(forceNeg(V.surgeryCost * 2), "slaveSurgery", slave);
+								V.surgeryType = "fat graft";
+							},
+							[],
+							"Fat Grafting"
+						)
+					);
+				}
 			}
+			App.Events.addNode(el, r, "div");
+			App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices");
+			return el;
 		}
-		App.Events.addNode(el, r, "div");
-		App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices");
 
 		/* Also fat*/
-		r = [];
-		linkArray = [];
-		r.push(`${He} has`);
-		if (slave.waist > 95) {
-			r.push(`a masculine`);
-		} else if (slave.waist > 40) {
-			r.push(`an ugly`);
-		} else if (slave.waist > 10) {
-			r.push(`an unattractive`);
-		} else if (slave.waist >= -10) {
-			r.push(`an average`);
-		} else if (slave.waist >= -40) {
-			r.push(`a feminine`);
-		} else if (slave.waist >= -95) {
-			r.push(`an hourglass`);
-		} else {
-			r.push(`an absurd`);
-		}
-		r.push(`waist.`);
-		App.Events.addNode(el, r, "div");
-		if (slave.waist >= -75) {
-			if (slave.indentureRestrictions < 2) {
-				linkArray.push(makeLink(
-					"Liposuction",
-					"lipo",
-					() => {
-						slave.waist -= 20;
-						surgeryDamage(slave, 10);
-					}
-				));
+		function moreFat() {
+			const el = new DocumentFragment();
+			const r = [];
+			const linkArray = [];
+			r.push(`${He} has`);
+			if (slave.waist > 95) {
+				r.push(`a masculine`);
+			} else if (slave.waist > 40) {
+				r.push(`an ugly`);
+			} else if (slave.waist > 10) {
+				r.push(`an unattractive`);
+			} else if (slave.waist >= -10) {
+				r.push(`an average`);
+			} else if (slave.waist >= -40) {
+				r.push(`a feminine`);
+			} else if (slave.waist >= -95) {
+				r.push(`an hourglass`);
+			} else {
+				r.push(`an absurd`);
 			}
-		}
-		if (slave.waist >= -95 && slave.waist < -75 && V.seeExtreme === 1) {
-			if (slave.indentureRestrictions < 1 && (slave.breedingMark !== 1 || V.propOutcome === 0 || V.eugenicsFullControl === 1 || V.arcologies[0].FSRestart === "unset")) {
-				linkArray.push(makeLink(
-					`Remove ribs to severely narrow ${his} waist`,
-					"ribs",
-					() => {
-						slave.waist = -100;
-						surgeryDamage(slave, 40);
-					}
-				));
+			r.push(`waist.`);
+			App.Events.addNode(el, r, "div");
+			if (slave.waist >= -75) {
+				if (slave.indentureRestrictions < 2) {
+					linkArray.push(makeLink(
+						"Liposuction",
+						"lipo",
+						() => {
+							slave.waist -= 20;
+							surgeryDamage(slave, 10);
+						}
+					));
+				}
+			}
+			if (slave.waist >= -95 && slave.waist < -75 && V.seeExtreme === 1) {
+				if (slave.indentureRestrictions < 1 && (slave.breedingMark !== 1 || V.propOutcome === 0 || V.eugenicsFullControl === 1 || V.arcologies[0].FSRestart === "unset")) {
+					linkArray.push(makeLink(
+						`Remove ribs to severely narrow ${his} waist`,
+						"ribs",
+						() => {
+							slave.waist = -100;
+							surgeryDamage(slave, 40);
+						}
+					));
+				}
 			}
+			App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices");
+			return el;
 		}
-		App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices");
 
 		/* Belly*/
-		r = [];
-		linkArray = [];
-		r.push(`${He}'s`);
-		if (slave.pregKnown > 0) {
-			r.push(`pregnant.`);
-		} else if (slave.womb.length === 0 && slave.broodmother > 0) {
-			r.push(`got a dormant broodmother implant in ${his} womb.`);
-		} else if (slave.preg > 0) {
-			r.push(`showing unusual discomfort as ${his} stomach is inspected. A quick test reveals that <span class="lime">${he} is pregnant.</span>`);
-			slave.pregKnown = 1;
-		} else if (slave.bellyImplant > 0) {
-			r.push(`got a ${slave.bellyImplant}cc implant filled implant located in ${his} abdomen.`);
-			if (slave.cervixImplant === 1) {
-				r.push(`${He} also has micropump filter installed in ${his} cervix feeding into the implant.`);
-			} else if (slave.cervixImplant === 2) {
-				r.push(`${He} also has micropump filter installed in ${his} rectum feeding into the implant.`);
-			} else if (slave.cervixImplant === 3) {
-				r.push(`${He} also has micropump filter installed in both ${his} holes feeding into the implant.`);
-			}
-		} else if (slave.bellyFluid >= 1500) {
-			r.push(`got a ${slave.inflationType}-filled implant located in ${his} abdomen.`);
-			if (slave.cervixImplant === 1) {
-				r.push(`${He} also has micropump filter installed in ${his} cervix feeding into the implant.`);
-			} else if (slave.cervixImplant === 2) {
-				r.push(`${He} also has micropump filter installed in ${his} rectum feeding into the implant.`);
-			} else if (slave.cervixImplant === 3) {
-				r.push(`${He} also has micropump filter installed in both ${his} holes feeding into the implant.`);
-			}
-		} else if (slave.bellyImplant === 0) {
-			r.push(`got an empty fillable implant located in ${his} abdomen.`);
-			if (slave.cervixImplant === 1) {
-				r.push(`${He} also has micropump filter installed in ${his} cervix feeding into the implant.`);
-			} else if (slave.cervixImplant === 2) {
-				r.push(`${He} also has micropump filter installed in ${his} rectum feeding into the implant.`);
-			} else if (slave.cervixImplant === 3) {
-				r.push(`${He} also has micropump filter installed in both ${his} holes feeding into the implant.`);
+		function belly() {
+			const el = new DocumentFragment();
+			const r = [];
+			const linkArray = [];
+			r.push(`${He}'s`);
+			if (slave.pregKnown > 0) {
+				r.push(`pregnant.`);
+			} else if (slave.womb.length === 0 && slave.broodmother > 0) {
+				r.push(`got a dormant broodmother implant in ${his} womb.`);
+			} else if (slave.preg > 0) {
+				r.push(`showing unusual discomfort as ${his} stomach is inspected. A quick test reveals that <span class="lime">${he} is pregnant.</span>`);
+				slave.pregKnown = 1;
+			} else if (slave.bellyImplant > 0) {
+				r.push(`got a ${slave.bellyImplant}cc implant filled implant located in ${his} abdomen.`);
+				if (slave.cervixImplant === 1) {
+					r.push(`${He} also has micropump filter installed in ${his} cervix feeding into the implant.`);
+				} else if (slave.cervixImplant === 2) {
+					r.push(`${He} also has micropump filter installed in ${his} rectum feeding into the implant.`);
+				} else if (slave.cervixImplant === 3) {
+					r.push(`${He} also has micropump filter installed in both ${his} holes feeding into the implant.`);
+				}
+			} else if (slave.bellyFluid >= 1500) {
+				r.push(`got a ${slave.inflationType}-filled implant located in ${his} abdomen.`);
+				if (slave.cervixImplant === 1) {
+					r.push(`${He} also has micropump filter installed in ${his} cervix feeding into the implant.`);
+				} else if (slave.cervixImplant === 2) {
+					r.push(`${He} also has micropump filter installed in ${his} rectum feeding into the implant.`);
+				} else if (slave.cervixImplant === 3) {
+					r.push(`${He} also has micropump filter installed in both ${his} holes feeding into the implant.`);
+				}
+			} else if (slave.bellyImplant === 0) {
+				r.push(`got an empty fillable implant located in ${his} abdomen.`);
+				if (slave.cervixImplant === 1) {
+					r.push(`${He} also has micropump filter installed in ${his} cervix feeding into the implant.`);
+				} else if (slave.cervixImplant === 2) {
+					r.push(`${He} also has micropump filter installed in ${his} rectum feeding into the implant.`);
+				} else if (slave.cervixImplant === 3) {
+					r.push(`${He} also has micropump filter installed in both ${his} holes feeding into the implant.`);
+				}
+			} else {
+				r.push(`got a normal stomach.`);
 			}
-		} else {
-			r.push(`got a normal stomach.`);
-		}
-		App.Events.addNode(el, r, "div");
-		if (slave.indentureRestrictions >= 2) {
-			App.UI.DOM.appendNewElement("div", el, `${His} indenture forbids elective surgery`, ["choices", "note"]);
-		} else if (slave.breedingMark === 1 && V.propOutcome === 1 && V.eugenicsFullControl !== 1 && V.arcologies[0].FSRestart !== "unset") {
-			App.UI.DOM.appendNewElement("div", el, `You are forbidden from affecting ${his} fertility`, ["choices", "note"]);
-		} else if (slave.preg > 0 || slave.inflation > 0 || slave.broodmother > 0) {
-			App.UI.DOM.appendNewElement("div", el, `${He} is unable to support an abdominal implant at this time`, ["choices", "note"]);
-		} else if (slave.bellyImplant >= 750000) {
-			App.UI.DOM.appendNewElement("div", el, `${His} abdominal implant is so far beyond its maximum limit it is at risk of rupturing`, ["choices", "note"]);
-		} else if (slave.bellyImplant >= 600000) {
-			App.UI.DOM.appendNewElement("div", el, `${His} abdominal implant is greatly beyond its maximum limit`, ["choices", "note"]);
-		} else if (slave.bellyImplant >= 450000) {
-			App.UI.DOM.appendNewElement("div", el, `${His} abdominal implant is over-filled`, ["choices", "note"]);
-		} else if (slave.bellyImplant >= 400000) {
-			App.UI.DOM.appendNewElement("div", el, `${His} abdominal implant is at its capacity`, ["choices", "note"]);
-		} else if (slave.bellyImplant > 130000 && V.arcologies[0].FSTransformationFetishistResearch !== 1) {
-			App.UI.DOM.appendNewElement("div", el, `${His} abdominal implant is at its capacity`, ["choices", "note"]);
-		} else if (slave.bellyImplant === -1 && V.bellyImplants === 1) {
-			if (slave.ovaries === 1 || slave.mpreg === 1) {
+			App.Events.addNode(el, r, "div");
+			if (slave.indentureRestrictions >= 2) {
+				App.UI.DOM.appendNewElement("div", el, `${His} indenture forbids elective surgery`, ["choices", "note"]);
+			} else if (slave.breedingMark === 1 && V.propOutcome === 1 && V.eugenicsFullControl !== 1 && V.arcologies[0].FSRestart !== "unset") {
+				App.UI.DOM.appendNewElement("div", el, `You are forbidden from affecting ${his} fertility`, ["choices", "note"]);
+			} else if (slave.preg > 0 || slave.inflation > 0 || slave.broodmother > 0) {
+				App.UI.DOM.appendNewElement("div", el, `${He} is unable to support an abdominal implant at this time`, ["choices", "note"]);
+			} else if (slave.bellyImplant >= 750000) {
+				App.UI.DOM.appendNewElement("div", el, `${His} abdominal implant is so far beyond its maximum limit it is at risk of rupturing`, ["choices", "note"]);
+			} else if (slave.bellyImplant >= 600000) {
+				App.UI.DOM.appendNewElement("div", el, `${His} abdominal implant is greatly beyond its maximum limit`, ["choices", "note"]);
+			} else if (slave.bellyImplant >= 450000) {
+				App.UI.DOM.appendNewElement("div", el, `${His} abdominal implant is over-filled`, ["choices", "note"]);
+			} else if (slave.bellyImplant >= 400000) {
+				App.UI.DOM.appendNewElement("div", el, `${His} abdominal implant is at its capacity`, ["choices", "note"]);
+			} else if (slave.bellyImplant > 130000 && V.arcologies[0].FSTransformationFetishistResearch !== 1) {
+				App.UI.DOM.appendNewElement("div", el, `${His} abdominal implant is at its capacity`, ["choices", "note"]);
+			} else if (slave.bellyImplant === -1 && V.bellyImplants === 1) {
+				if (slave.ovaries === 1 || slave.mpreg === 1) {
+					linkArray.push(makeLink(
+						`Implant fillable abdominal implant`,
+						"bellyIn",
+						() => {
+							slave.bellyImplant = 0;
+							slave.preg = -2;
+							slave.bellyPain += 1;
+							surgeryDamage(slave, 10);
+						}
+					));
+				} else {
+					linkArray.push(makeLink(
+						`Implant a fillable abdominal implant`,
+						"bellyInMale",
+						() => {
+							slave.bellyImplant = 0;
+							slave.bellyPain += 2;
+							surgeryDamage(slave, 50);
+						}
+					));
+				}
+			} else if (slave.bellyPain === 2) {
+				App.UI.DOM.appendNewElement("div", el, `${His} body cannot handle more filler this week`, ["choices", "note"]);
+			} else if (slave.bellyImplant > -1) {
 				linkArray.push(makeLink(
-					`Implant fillable abdominal implant`,
-					"bellyIn",
+					`Add inert filler`,
+					"bellyUp",
 					() => {
-						slave.bellyImplant = 0;
-						slave.preg = -2;
+						slave.bellyImplant += 200;
 						slave.bellyPain += 1;
-						surgeryDamage(slave, 10);
-					}
+						surgeryDamage(slave, (slave.bellyPain) ? 30 : 10);
+					},
+					1,
+					(slave.bellyPain && slave.health.health < 0) ? "This may cause severe health issues" : ""
 				));
-			} else {
 				linkArray.push(makeLink(
-					`Implant a fillable abdominal implant`,
-					"bellyInMale",
+					`Add a considerable amount of inert filler`,
+					"bellyUp",
 					() => {
-						slave.bellyImplant = 0;
-						slave.bellyPain += 2;
-						surgeryDamage(slave, 50);
-					}
+						slave.bellyImplant += 500;
+						slave.bellyPain += 1;
+						surgeryDamage(slave, (slave.bellyPain) ? 40 : 20);
+					},
+					1,
+					(slave.bellyPain && slave.health.health < 0) ? "This may cause severe health issues" : ""
 				));
 			}
-		} else if (slave.bellyPain === 2) {
-			App.UI.DOM.appendNewElement("div", el, `${His} body cannot handle more filler this week`, ["choices", "note"]);
-		} else if (slave.bellyImplant > -1) {
-			linkArray.push(makeLink(
-				`Add inert filler`,
-				"bellyUp",
-				() => {
-					slave.bellyImplant += 200;
-					slave.bellyPain += 1;
-					surgeryDamage(slave, (slave.bellyPain) ? 30 : 10);
-				},
-				1,
-				(slave.bellyPain && slave.health.health < 0) ? "This may cause severe health issues" : ""
-			));
-			linkArray.push(makeLink(
-				`Add a considerable amount of inert filler`,
-				"bellyUp",
-				() => {
-					slave.bellyImplant += 500;
-					slave.bellyPain += 1;
-					surgeryDamage(slave, (slave.bellyPain) ? 40 : 20);
-				},
-				1,
-				(slave.bellyPain && slave.health.health < 0) ? "This may cause severe health issues" : ""
-			));
-		}
-		if (slave.bellyImplant > -1) {
-			linkArray.push(makeLink(
-				`Drain implant`,
-				"bellyDown",
-				() => {
-					slave.bellyImplant -= 200;
-					surgeryDamage(slave, 5);
-				}
-			));
-			if (slave.bellyImplant >= 500) {
+			if (slave.bellyImplant > -1) {
 				linkArray.push(makeLink(
-					`Greatly drain implant`,
+					`Drain implant`,
 					"bellyDown",
 					() => {
-						slave.bellyImplant -= 500;
+						slave.bellyImplant -= 200;
 						surgeryDamage(slave, 5);
 					}
 				));
-			}
-			if (slave.indentureRestrictions < 2) {
-				linkArray.push(makeLink(
-					`Remove implant`,
-					"bellyOut",
-					() => {
-						slave.bellyImplant = -1;
-						slave.cervixImplant = 0;
-						surgeryDamage(slave, 10);
-					}
-				));
-				if (slave.cervixImplant !== 1 && slave.cervixImplant !== 3 && V.cervixImplants >= 1 && slave.vagina > -1) { /* slave should have vagina */
+				if (slave.bellyImplant >= 500) {
 					linkArray.push(makeLink(
-						`Install cervix micropump filter`,
-						"cervixPump",
+						`Greatly drain implant`,
+						"bellyDown",
 						() => {
-							slave.cervixImplant = (slave.cervixImplant === 0 ? 1 : 3);
-							surgeryDamage(slave, 10);
-						},
-						1,
-						`Will allow ${his} belly implant to slowly swell as people cum in ${his} vagina`
+							slave.bellyImplant -= 500;
+							surgeryDamage(slave, 5);
+						}
 					));
 				}
-				if (slave.cervixImplant !== 2 && slave.cervixImplant !== 3 && V.cervixImplants === 2) {
+				if (slave.indentureRestrictions < 2) {
 					linkArray.push(makeLink(
-						`Install rectal micropump filter`,
-						"cervixPumpA",
+						`Remove implant`,
+						"bellyOut",
 						() => {
-							slave.cervixImplant = (slave.cervixImplant === 0 ? 2 : 3);
-							surgeryDamage(slave, 20);
-						},
-						1,
-						`Will allow ${his} belly implant to slowly swell as people cum in ${his} anus`
+							slave.bellyImplant = -1;
+							slave.cervixImplant = 0;
+							surgeryDamage(slave, 10);
+						}
 					));
+					if (slave.cervixImplant !== 1 && slave.cervixImplant !== 3 && V.cervixImplants >= 1 && slave.vagina > -1) { /* slave should have vagina */
+						linkArray.push(makeLink(
+							`Install cervix micropump filter`,
+							"cervixPump",
+							() => {
+								slave.cervixImplant = (slave.cervixImplant === 0 ? 1 : 3);
+								surgeryDamage(slave, 10);
+							},
+							1,
+							`Will allow ${his} belly implant to slowly swell as people cum in ${his} vagina`
+						));
+					}
+					if (slave.cervixImplant !== 2 && slave.cervixImplant !== 3 && V.cervixImplants === 2) {
+						linkArray.push(makeLink(
+							`Install rectal micropump filter`,
+							"cervixPumpA",
+							() => {
+								slave.cervixImplant = (slave.cervixImplant === 0 ? 2 : 3);
+								surgeryDamage(slave, 20);
+							},
+							1,
+							`Will allow ${his} belly implant to slowly swell as people cum in ${his} anus`
+						));
+					}
 				}
 			}
+			App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices");
+			return el;
 		}
-		App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices");
 
 		/* Uterine Implants */
-		linkArray = [];
-		if (slave.wombImplant === "none" && (V.UterineRestraintMesh === 1) && (slave.ovaries === 1 || slave.mpreg === 1)) {
-			App.UI.DOM.appendNewElement("div", el, `${He} has a normal uterus${(slave.mpreg === 1) ? `, though slightly repositioned` : ``}.`);
-			if (slave.indentureRestrictions >= 1) {
-				App.UI.DOM.appendNewElement("div", el, `${His} indenture forbids elective surgery`, ["choices", "note"]);
-			} else if (slave.bellyImplant > 0 || slave.preg > 0) {
-				App.UI.DOM.appendNewElement("div", el, `${His} womb is currently in use and unsafe to operate on`, ["choices", "note"]);
-			} else {
-				if (V.surgeryUpgrade === 1) {
-					if (V.UterineRestraintMesh === 1) {
-						App.UI.DOM.appendNewElement("div", el, ``, ["choices", "note"]);
-						linkArray.push(makeLink(
-							`Install reinforcing organic mesh`,
-							"womb",
-							() => {
-								slave.wombImplant = "restraint";
-								surgeryDamage(slave, 25);
-							}
-						));
+		function wombImplant() {
+			const el = new DocumentFragment();
+			const linkArray = [];
+			if (slave.wombImplant === "none" && (V.UterineRestraintMesh === 1) && (slave.ovaries === 1 || slave.mpreg === 1)) {
+				App.UI.DOM.appendNewElement("div", el, `${He} has a normal uterus${(slave.mpreg === 1) ? `, though slightly repositioned` : ``}.`);
+				if (slave.indentureRestrictions >= 1) {
+					App.UI.DOM.appendNewElement("div", el, `${His} indenture forbids elective surgery`, ["choices", "note"]);
+				} else if (slave.bellyImplant > 0 || slave.preg > 0) {
+					App.UI.DOM.appendNewElement("div", el, `${His} womb is currently in use and unsafe to operate on`, ["choices", "note"]);
+				} else {
+					if (V.surgeryUpgrade === 1) {
+						if (V.UterineRestraintMesh === 1) {
+							App.UI.DOM.appendNewElement("div", el, ``, ["choices", "note"]);
+							linkArray.push(makeLink(
+								`Install reinforcing organic mesh`,
+								"womb",
+								() => {
+									slave.wombImplant = "restraint";
+									surgeryDamage(slave, 25);
+								}
+							));
+						}
 					}
 				}
+			} else if (slave.wombImplant === "restraint") {
+				App.UI.DOM.appendNewElement("div", el, `${He} has a mesh reinforced uterus.`);
+				if (slave.indentureRestrictions >= 1) {
+					App.UI.DOM.appendNewElement("div", el, `${His} indenture forbids elective surgery`, ["choices", "note"]);
+				} else if (slave.bellyImplant > 0 || slave.preg > 0) {
+					App.UI.DOM.appendNewElement("div", el, `${His} womb is currently in use and unsafe to operate on`, ["choices", "note"]);
+				} else {
+					linkArray.push(makeLink(
+						`Remove organic mesh`,
+						"womb",
+						() => {
+							slave.wombImplant = "none";
+							surgeryDamage(slave, 50);
+						},
+						1,
+						(slave.health.health < 0) ? `This may cause severe health issues` : ""
+					));
+				}
 			}
-		} else if (slave.wombImplant === "restraint") {
-			App.UI.DOM.appendNewElement("div", el, `${He} has a mesh reinforced uterus.`);
-			if (slave.indentureRestrictions >= 1) {
-				App.UI.DOM.appendNewElement("div", el, `${His} indenture forbids elective surgery`, ["choices", "note"]);
-			} else if (slave.bellyImplant > 0 || slave.preg > 0) {
-				App.UI.DOM.appendNewElement("div", el, `${His} womb is currently in use and unsafe to operate on`, ["choices", "note"]);
-			} else {
-				linkArray.push(makeLink(
-					`Remove organic mesh`,
-					"womb",
-					() => {
-						slave.wombImplant = "none";
-						surgeryDamage(slave, 50);
-					},
-					1,
-					(slave.health.health < 0) ? `This may cause severe health issues` : ""
-				));
-			}
+			App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices");
+			return el;
 		}
-		App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices");
 
 		/* Belly sag*/
-		r = [];
-		linkArray = [];
-		if (slave.bellySagPreg > 0) {
-			if (slave.belly >= 1500) {
-				r.push(`${He} has a sagging midriff, ruined from excessive pregnancy. It is currently filled out by ${his} swollen belly and cannot safely be worked on.`);
-			} else {
-				r.push(`${He} has a sagging midriff, ruined from excessive pregnancy.`);
-				linkArray.push(makeLink(
-					`Tummy tuck`,
-					"tummyTuck",
-					() => {
-						slave.bellySag = 0;
-						slave.bellySagPreg = 0;
-						surgeryDamage(slave, 20);
-					}
-				));
-			}
-		} else if (slave.bellySag > 0) {
-			if (slave.belly >= 1500) {
-				r.push(`${He} has a sagging midriff, ruined from excessive distention. It is currently filled out by ${his} swollen belly and cannot safely be worked on.`);
-			} else {
-				r.push(`${He} has a sagging midriff, ruined from excessive distention.`);
-				linkArray.push(makeLink(
-					`Tummy tuck`,
-					"tummyTuck",
-					() => {
-						slave.bellySag = 0;
-						slave.bellySagPreg = 0;
-						surgeryDamage(slave, 20);
-					}
-				));
+		function bellySag() {
+			const el = new DocumentFragment();
+			const r = [];
+			const linkArray = [];
+			if (slave.bellySagPreg > 0) {
+				if (slave.belly >= 1500) {
+					r.push(`${He} has a sagging midriff, ruined from excessive pregnancy. It is currently filled out by ${his} swollen belly and cannot safely be worked on.`);
+				} else {
+					r.push(`${He} has a sagging midriff, ruined from excessive pregnancy.`);
+					linkArray.push(makeLink(
+						`Tummy tuck`,
+						"tummyTuck",
+						() => {
+							slave.bellySag = 0;
+							slave.bellySagPreg = 0;
+							surgeryDamage(slave, 20);
+						}
+					));
+				}
+			} else if (slave.bellySag > 0) {
+				if (slave.belly >= 1500) {
+					r.push(`${He} has a sagging midriff, ruined from excessive distention. It is currently filled out by ${his} swollen belly and cannot safely be worked on.`);
+				} else {
+					r.push(`${He} has a sagging midriff, ruined from excessive distention.`);
+					linkArray.push(makeLink(
+						`Tummy tuck`,
+						"tummyTuck",
+						() => {
+							slave.bellySag = 0;
+							slave.bellySagPreg = 0;
+							surgeryDamage(slave, 20);
+						}
+					));
+				}
 			}
+			App.Events.addNode(el, r, "div");
+			App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices");
+			return el;
 		}
-		App.Events.addNode(el, r, "div");
-		App.UI.DOM.appendNewElement("div", el, App.UI.DOM.generateLinksStrip(linkArray), "choices");
-
-		return el;
 	}
 
 	/**
-- 
GitLab