diff --git a/src/js/familyTreeJS.js b/src/js/familyTreeJS.js
index f01bb34522c3af4727172925efb67e5232a77928..8a97c85cc38f9c11cbf2e998215a12e1eb71bc2a 100644
--- a/src/js/familyTreeJS.js
+++ b/src/js/familyTreeJS.js
@@ -177,7 +177,9 @@ globalThis.buildFamilyTree = function(slaves, filterID) {
 		'-6': 'Social Elite',
 		'-7': 'Gene lab'
 	};
+	/** @type {Record<string, Array<string>>} */
 	let outdads = {};
+	/** @type {Record<string, Array<string>>} */
 	let outmoms = {};
 	let kids = {};
 
@@ -218,34 +220,31 @@ globalThis.buildFamilyTree = function(slaves, filterID) {
 		}
 	}
 
+	const haveChar = (ID) => charList.includes(c => c.ID === ID);
 	for (const character of charList) {
 		if (character.mother === 0 && character.father === 0 && !kids[character.ID]) {
 			continue;
 		}
 		let mom = character.mother;
 		if (mom < -6) {
-			if (mom in V.missingTable && V.showMissingSlaves) {
-				if (typeof node_lookup[mom] === 'undefined') {
-					node_lookup[mom] = family_graph.nodes.length;
-					let missing = V.missingTable[mom];
-					charList.push({
-						ID: mom,
-						mother: missing.mother,
-						father: missing.father,
-						is_mother: true,
-						dick: missing.dick,
-						vagina: missing.vagina,
-						slaveName: missing.slaveName
-					});
-				}
+			if (mom in V.missingTable && V.showMissingSlaves && !haveChar(mom)) {
+				const missing = V.missingTable[mom];
+				charList.push({
+					ID: mom,
+					mother: missing.mother,
+					father: missing.father,
+					is_mother: true,
+					dick: missing.dick,
+					vagina: missing.vagina,
+					slaveName: missing.slaveName
+				});
 			} else {
 				if (typeof outmoms[mom] === 'undefined') {
 					outmoms[mom] = [];
 				}
 				outmoms[mom].push(character.slaveName);
 			}
-		} else if (mom < 0 && typeof node_lookup[mom] === 'undefined' && typeof preset_lookup[mom] !== 'undefined') {
-			node_lookup[mom] = family_graph.nodes.length;
+		} else if (mom < 0 && typeof preset_lookup[mom] !== 'undefined' && !haveChar(mom)) {
 			charList.push({
 				ID: mom,
 				mother: 0,
@@ -259,28 +258,24 @@ globalThis.buildFamilyTree = function(slaves, filterID) {
 
 		let dad = character.father;
 		if (dad < -6) {
-			if (dad in V.missingTable && V.showMissingSlaves) {
-				if (typeof node_lookup[dad] === 'undefined') {
-					node_lookup[dad] = family_graph.nodes.length;
-					let missing = V.missingTable[dad];
-					charList.push({
-						ID: dad,
-						mother: missing.mother,
-						father: missing.father,
-						is_father: true,
-						dick: missing.dick,
-						vagina: missing.vagina,
-						slaveName: missing.slaveName
-					});
-				}
+			if (dad in V.missingTable && V.showMissingSlaves && !haveChar(dad)) {
+				const missing = V.missingTable[dad];
+				charList.push({
+					ID: dad,
+					mother: missing.mother,
+					father: missing.father,
+					is_father: true,
+					dick: missing.dick,
+					vagina: missing.vagina,
+					slaveName: missing.slaveName
+				});
 			} else {
 				if (typeof outdads[dad] === 'undefined') {
 					outdads[dad] = [];
 				}
 				outdads[dad].push(character.slaveName);
 			}
-		} else if (dad < 0 && typeof node_lookup[dad] === 'undefined' && typeof preset_lookup[dad] !== 'undefined') {
-			node_lookup[dad] = family_graph.nodes.length;
+		} else if (dad < 0 && typeof preset_lookup[dad] !== 'undefined' && !haveChar(dad)) {
 			charList.push({
 				ID: dad,
 				mother: 0,
@@ -304,7 +299,6 @@ globalThis.buildFamilyTree = function(slaves, filterID) {
 			names[-1] = `and ${names[-1]}`;
 			name = names.join(', ');
 		}
-		node_lookup[key] = family_graph.nodes.length;
 		// Outside extant slaves set
 		charList.push({
 			ID: key,
@@ -329,7 +323,6 @@ globalThis.buildFamilyTree = function(slaves, filterID) {
 			names[-1] = `and ${names[-1]}`;
 			name = names.join(', ');
 		}
-		node_lookup[key] = family_graph.nodes.length;
 		// Outside extant slaves set
 		charList.push({
 			ID: key,