Index: cpp/frams/genetics/f4/f4_general.cpp
===================================================================
--- cpp/frams/genetics/f4/f4_general.cpp	(revision 1231)
+++ cpp/frams/genetics/f4/f4_general.cpp	(revision 1232)
@@ -795,35 +795,31 @@
 }
 
-void f4_Cells::setRepairRemove(int nerrpos, f4_Node *rem)
-{
+void f4_Cells::setRepairRemove(int nerrpos, f4_Node *to_remove)
+{
+	errorcode = GENOPER_REPAIR;
+	errorpos = nerrpos;
 	if (!repair)
 	{
 		// not in repair mode, treat as repairable error
-		errorcode = GENOPER_REPAIR;
-		errorpos = nerrpos;
 	}
 	else
 	{
-		errorcode = GENOPER_REPAIR;
-		errorpos = nerrpos;
-		repair_remove = rem;
-	}
-}
-
-int f4_Cells::setRepairInsert(int nerrpos, f4_Node *parent, f4_Node *insert)
-{
+		repair_remove = to_remove;
+	}
+}
+
+int f4_Cells::setRepairInsert(int nerrpos, f4_Node *parent, f4_Node *to_insert)
+{
+	errorcode = GENOPER_REPAIR;
+	errorpos = nerrpos;
 	if (!repair)
 	{
 		// not in repair mode, treat as repairable error
-		errorcode = GENOPER_REPAIR;
-		errorpos = nerrpos;
 		return -1;
 	}
 	else
 	{
-		errorcode = GENOPER_REPAIR;
-		errorpos = nerrpos;
 		repair_parent = parent;
-		repair_insert = insert;
+		repair_insert = to_insert;
 		return 0;
 	}
@@ -1423,8 +1419,9 @@
 	int res = f4_processRecur(genot, pos, root);
 	if (res > 0)
-		return res; //error
-	else if (genot[pos] == 0) //parsed until the end - OK!
-		return 0;
-	else return pos + 1; //junk, unparsed genes after successful parsing, for example /*4*/<X>N:N>whatever or /*4*/<X>X>>>
+		return res; //parsing error
+	else if (genot[pos] != 0)
+		return pos + 1; //parsing OK but junk, unparsed genes left, for example /*4*/<X>N:N>whatever or /*4*/<X>X>>>
+	else
+		return 0; //parsing OK and parsed until the end
 }
 
Index: cpp/frams/genetics/f4/f4_general.h
===================================================================
--- cpp/frams/genetics/f4/f4_general.h	(revision 1231)
+++ cpp/frams/genetics/f4/f4_general.h	(revision 1232)
@@ -303,7 +303,7 @@
 	 * Sets the element of genotype to be repaired by removal.
 	 * @param nerrpos position of an error in genotype
-	 * @param rem the f4_Node to be removed from the  genotype tree in order to repair
-	 */
-	void setRepairRemove(int nerrpos, f4_Node *rem);
+	 * @param to_remove the f4_Node to be removed from the genotype tree in order to repair
+	 */
+	void setRepairRemove(int nerrpos, f4_Node *to_remove);
 
 	/**
@@ -311,8 +311,8 @@
 	 * @param nerrpos position of an error in genotype
 	 * @param parent the parent of a new element
-	 * @param insert the element to be inserted
+	 * @param to_insert the element to be inserted
 	 * @return 0 if repair can be performed, or -1 otherwise because the repair flag wasn't set in the constructor
 	 */
-	int setRepairInsert(int nerrpos, f4_Node *parent, f4_Node *insert);
+	int setRepairInsert(int nerrpos, f4_Node *parent, f4_Node *to_insert);
 
 	/**
Index: cpp/frams/genetics/f4/f4_oper.cpp
===================================================================
--- cpp/frams/genetics/f4/f4_oper.cpp	(revision 1231)
+++ cpp/frams/genetics/f4/f4_oper.cpp	(revision 1232)
@@ -16,4 +16,5 @@
 // TODO the behavior of neuron input indexes during mutation seems badly implemented (see also TREAT_BAD_CONNECTIONS_AS_INVALID_GENO). Are they kept properly maintained when nodes are added and removed? This could be done well because during mutation we operate on the tree structure with cross-references between nodes (so they should not be affected by local changes in the tree), and then convert the tree back to string. Yet, the f4_Node.conn_from is an integer and these fields in nodes do not seem to be maintained on tree node adding/removal... change these integer offsets to references to node objects? But actually, do the offsets that constitute relative connection references concern the f4_Node tree structure (and all these sophisticated calculations of offsets during mutation are useful) or rather they concern the f4_Cells development? verify all situations in f4_Cell::oneStep(), case '['.
 // TODO add simplifying sequences of modifiers (so capital and small letter cancel out, like in f1) - but seems like each single modifier is a separate f4_Node? and perhaps we don't want to use the repair mechanism for this... maybe mutations, when they add/modify/remove a modifier node, should be "cleaning" the tree by removing nodes when they encounter contradictory modifiers on the same subpath, and also limit the number of modifiers of each type just like in f1? To avoid sequences like ...<X>llmlIilImmimiimmimifmfl<fifmmimilimmmiimiliffmfliIfififlliflimfliffififmiffmfliflifmIlimimiflimfiffmllliflmimifllifliliflifmIlimimiflimfiffmllliflmimifllfmIlimimiflimfiffmllliflmimiflliflimimmiflimfliffmiflifmfiffllIlififliffififmiffmfliflifIliflimimflimflfflimimifllfflifllfflimlififfiiffifIr<r<...
+// TODO in mutation, adding the '#' gene does not seem to be effective. The gene is added and genotypes are valid, but hardly ever #n is effective, i.e., it hardly ever multiplicates body or brain parts... investigate!
 // TODO add support for properties of (any class of) neurons - not just sigmoid/force/intertia (':' syntax) for N
 // TODO add mapping genotype character ranges for neural [connections]
@@ -123,7 +124,7 @@
 	f4_Node root;
 	int res = f4_process(geno, &root);
-	if (res == 0 || root.childCount() != 1) return GENOPER_OK; // either parsing says the genotype is OK or the resulting tree will not be repairable (fatal flaw; root must have exactly one child) - do not attempt repair
-
-	// here we have a genotype with res>0 (for sure has some error) and root.childCount()==1 (still something was parsed into a tree)
+	if (root.childCount() != 1) return GENOPER_OK; // the resulting tree will not be repairable (fatal flaw; root must have exactly one child) - do not even attempt repair
+
+	// here we have a genotype with root.childCount()==1 (meaning some part was successfully parsed into a tree) and either res==0 (syntax was correct, semantics we don't know) or res>0 (for sure has some error)
 	const int VALIDATE_TRIALS = 20;
 	res = ValidateRecur(&root, VALIDATE_TRIALS);
