Index: cpp/frams/genetics/f4/f4_general.cpp
===================================================================
--- cpp/frams/genetics/f4/f4_general.cpp	(revision 760)
+++ cpp/frams/genetics/f4/f4_general.cpp	(revision 767)
@@ -466,5 +466,14 @@
 				float w = gcur->f1;
 				f4_Cell *tneu = NULL;
-				if (t > 0) // sensors
+				if (t < 0) // wrong sensor
+				{
+					string buf = "wrong sensor in link '";
+					buf.append(gcur->s1);
+					buf.append("'");
+					logMessage("f4_Cell", "onestep", LOG_ERROR, buf.c_str());
+					org->setRepairRemove(gcur->pos, gcur);
+					return 1;
+				}
+				else if (t > 0) // sensors
 				{
 					char *temp = (char*)gcur->s1.c_str();
@@ -476,5 +485,5 @@
 						buf.append(gcur->s1);
 						buf.append("'");
-						logMessage("f4_Cell", "onestep", LOG_WARN, buf.c_str()); //TODO ask
+						logMessage("f4_Cell", "onestep", LOG_ERROR, buf.c_str());
 						org->setRepairRemove(gcur->pos, gcur);
 						return 1;
@@ -1227,5 +1236,5 @@
 void f4_node::sprint(SString& out)
 {
-	string buf2 = "";
+	char buf2[20];
 	// special case: repetition code
 	if (name == "#")
@@ -1234,6 +1243,6 @@
 		if (i1 != 1)
 		{
-			sprintf((char*)buf2.c_str(), "%d", i1);
-			out += buf2.c_str();
+			sprintf(buf2, "%d", i1);
+			out += buf2;
 		}
 	}
@@ -1250,14 +1259,14 @@
 			else
 			{
-				sprintf((char*)buf2.c_str(), "%ld", l1);
-				out += buf2.c_str();
-			}
-			sprintf((char*)buf2.c_str(), ":%g]", f1);
-			out += buf2.c_str();
+				sprintf(buf2, "%ld", l1);
+				out += buf2;
+			}
+			sprintf(buf2, ":%g]", f1);
+			out += buf2;
 		}
 		else if (name == ":")
 		{
-			sprintf((char*)buf2.c_str(), ":%c%c:", l1 ? '+' : '-', (char)i1);
-			out += buf2.c_str();
+			sprintf(buf2, ":%c%c:", l1 ? '+' : '-', (char)i1);
+			out += buf2;
 		}
 		else if (name == "@" || name == "|")
@@ -1265,12 +1274,10 @@
 			if (parent->name == "N")
 			{
-				buf2 = name;
-				out += buf2.c_str();
+				out += name.c_str();
 			}
 			else
 			{
 				out += "N:";
-				buf2 = name;
-				out += buf2.c_str();
+				out += name.c_str();
 			}
 		}
@@ -1283,6 +1290,5 @@
 				out += "N:";
 			}
-			buf2 = name;
-			out += buf2.c_str();
+			out += name.c_str();
 		}
 	}
@@ -1402,11 +1408,15 @@
 		{
 			// repetition marker, 1 by default
-			if (sscanf(genot + gpos, "#%d", &i) != 1) i = 1;
+			ExtValue val;
+			const char * end = val.parseNumber(genot + gpos + 1, ExtPType::TInt);
+			if (end == NULL) i = 1;
+			else i = val.getInt();
 			// find out genotype start for continuation
 			j = scanrec(genot + gpos + 1, strlen(genot + gpos + 1), '>');
 			// skip number
 			oldpos = gpos;
-			gpos++;
-			while ((genot[gpos] >= '0') && (genot[gpos] <= '9')) gpos++;
+			gpos += end - (genot + gpos);
+			//gpos++;
+			//while ((genot[gpos] >= '0') && (genot[gpos] <= '9')) gpos++;node1 = new f4_node("#", par, oldpos);
 			node1 = new f4_node("#", par, oldpos);
 			node1->i1 = i;
@@ -1527,5 +1537,5 @@
 				end = parseConnectionWithNeuron(genot + gpos, neutype, w);
 				if (end == NULL) t = -1;
-				t = 1;
+				else t = 1;
 			}
 			else
Index: cpp/frams/genetics/f4/f4_general.h
===================================================================
--- cpp/frams/genetics/f4/f4_general.h	(revision 760)
+++ cpp/frams/genetics/f4/f4_general.h	(revision 767)
@@ -97,5 +97,5 @@
 		inline void dec() { count--; };
 		f4_node    *node; ///<pointer to the repetition code
-		char       count; ///<repetition counter
+		int       count; ///<repetition counter
 	};
 
@@ -140,6 +140,5 @@
 	 * @param newP genotype properties of a given cell
 	 */
-	f4_Cell(int nname,
-		f4_Cell * ndad, int nangle, GeneProps newP);
+	f4_Cell(int nname, f4_Cell *ndad, int nangle, GeneProps newP);
 	/**
 	 * Creates a new f4_Cell object.
@@ -152,37 +151,36 @@
 	 * @param newP genotype properties of a given cell
 	 */
-	f4_Cell(f4_Cells *nO, int nname, f4_node *ngeno, f4_node *ngcur,
-		f4_Cell *ndad, int nangle, GeneProps newP);
+	f4_Cell(f4_Cells *nO, int nname, f4_node *ngeno, f4_node *ngcur, f4_Cell *ndad, int nangle, GeneProps newP);
 
 	~f4_Cell();
 
 	/**
-	 * Performs one step of cell development. This method requires pointer to
-	 * f4_Cells object in org attribute. If the current node in genotype tree
-	 * represents branching, then the cell divides into two cells, unless the
-	 * cell was already differentiated into stick cell. Otherwise the current
-	 * differentiation or modification is performed on cell. If current node is
-	 * creating a connection between two neuron nodes, and the input node is not
-	 * yet developed, then the simulation of current cell halts and waits until
-	 * the input node will be developed. The onestep method is ran on each cell
-	 * at least once and if one cell requires another to develop, then onestep
+	 * Performs a single step of cell development. This method requires a pointer to
+	 * the f4_Cells object in org attribute. If the current node in genotype tree
+	 * is the branching character '<', the cell divides into two cells, unless the
+	 * cell was already differentiated into the stick cell. Otherwise, the current
+	 * differentiation or modification is performed on the cell. If current node is
+	 * creating a connection between two neuron nodes and the input node is not
+	 * yet developed, the simulation of the development of the current cell waits until
+	 * the input node is created. The onestep method is deployed for every cell
+	 * at least once. If one cell requires another one to develop, onestep
 	 * should be deployed again on this cell. This method, unlike genotype tree
 	 * creation, checks semantics. This means that this function will fail if:
-	 *  - the stick cell will have divide node,
-	 *  - the undifferentiated cell will have '>' node (end of cell development),
-	 *  - the stack of repetition marker '#' will be overflowed,
+	 *  - the cell differentiated as a stick will have branching node '<',
+	 *  - the undifferentiated cell will have termination node '>' (end of cell development without differentiation),
+	 *  - the stack of repetition marker '#' will exceed maximum allowed value of repetition,
 	 *  - the stick modifiers, like rotation, will be applied on neuron cell,
 	 *  - the differentiated cell will be differentiated again,
-	 *  - the neuron class inside cell connection definition is not a sensor,
-	 *  - the connection between neurons could not be established,
+	 *  - the neuron class inside cell connection (i.e. N[G:5]) is not a sensor,
+	 *  - the connection between neurons cannot be established,
 	 *  - the neuron class is not valid.
 	 *
 	 * @return 0 if development was successful, 1 if there was an error in genotype tree
 	 */
-	int onestep();	// execute one simulation step (till a division)
-
-	/**
-	 * Add link between this neuron cell and a given neuron cell. If nfrom object
-	 * is not given, than neuron type in nt holds the sensor type.
+	int onestep();
+
+	/**
+	 * Adds a link between this neuron cell and a given neuron cell in nfrom. If the nfrom object
+	 * is not given, neuron type in nt should be a sensor type.
 	 * @param nfrom input neuron cell, or NULL if not given
 	 * @param nw weight of connection
@@ -190,5 +188,5 @@
 	 * @return 0 if link is established, -1 otherwise
 	 */
-	int   addlink(f4_Cell * nfrom, double nw, string nt);
+	int   addlink(f4_Cell *nfrom, double nw, string nt);
 
 	/**
@@ -197,17 +195,17 @@
 	void  adjustRec();
 
-	int        name;               ///<name of cell(number)
+	int        name;               ///<name of cell (number)
 	int        type;               ///<type
-	f4_Cell *  dadlink;            ///<pointer to cell parent
-	f4_Cells * org;	               ///<uplink to organism
-
-	f4_node *  genot;	           ///<genotype tree
-	f4_node *  gcur;               ///<current genotype execution pointer
-	int        active;             ///<whether development is still active
+	f4_Cell *dadlink;              ///<pointer to cell parent
+	f4_Cells  *org;	               ///<uplink to organism
+
+	f4_node *genot; 	           ///<genotype tree
+	f4_node *gcur;                 ///<current genotype execution pointer
+	int active;                    ///<determines whether development is still active
 	repeat_stack repeat;           ///<stack holding repetition nodes and counters
-	int        recProcessedFlag;   ///<used during recursive traverse
+	int recProcessedFlag;          ///<used during recursive traverse
 	MultiRange genoRange;          ///<remember the genotype codes affecting this cell so far
 
-	GeneProps     P;               ///<properties
+	GeneProps    P;                ///<properties
 	int          anglepos;         ///<number of position within dad's children (,)
 	int          childcount;       ///<number of children
@@ -218,7 +216,7 @@
 
 	double       mz;               ///<freedom in z
-	int          p2_refno;         ///<number of last end part object, used in f0
-	int          joint_refno;      ///<number of the joint object, used in f0
-	int          neuro_refno;      ///<number of the neuro object, used in f0
+	int          p2_refno;         ///<the number of the last end part object, used in f0
+	int          joint_refno;      ///<the number of the joint object, used in f0
+	int          neuro_refno;      ///<the number of the neuro object, used in f0
 
 	int          ctrl;             ///<neuron type
@@ -227,7 +225,7 @@
 	double       force;            ///<force of neuron
 	double       sigmo;            ///<sigmoid of neuron
-	f4_CellLink* links[MAXINPUTS]; ///<array of neuron links
+	f4_CellLink *links[MAXINPUTS]; ///<array of neuron links
 	int          nolink;           ///<number of links
-	NeuroClass * neuclass = NULL;  ///<pointer to neuron class
+	NeuroClass *neuclass;          ///<pointer to neuron class
 };
 
@@ -239,17 +237,17 @@
 public:
 	/**
-	 * Constructor for f4_CellLink class. Parameter nfrom can represent input
-	 * neuron cell or be NULL, if connection has neuron cell definition inside.
-	 * The inside definition must be hold in nt parameter and a neuron class
-	 * must represent sensor.
+	 * Constructor for f4_CellLink class. Parameter nfrom represents input
+	 * neuron cell or NULL if connection has defined sensor type inside, like "[G:5]".
+	 * The name of sensor class defined inside neuron connection is stored in the nt
+	 * parameter.
 	 * @param nfrom pointer to input neuron cell or NULL
 	 * @param nw weight of connection
 	 * @param nt name of neuron class or empty string
 	 */
-	f4_CellLink(f4_Cell * nfrom, double nw, string nt);
-
-	f4_Cell *    from; ///<pointer to input neuron cell
-	string  t;    ///<empty if from cell is given, NeuroClass name otherwise
-	double       w;    ///<weight of connection
+	f4_CellLink(f4_Cell *nfrom, double nw, string nt);
+
+	f4_Cell *from; ///<pointer to input neuron cell
+	string t;      ///<empty if 'from' cell is given, NeuroClass name otherwise
+	double w;      ///<weight of connection
 };
 
@@ -257,5 +255,5 @@
 // a collection of cells, like Organism, for developmental encoding
 /**
- * Class representing a collection of cells. It is equivalent of organism.
+ * A class representing a collection of cells. It is equivalent to an organism.
  */
 class f4_Cells
@@ -268,5 +266,5 @@
 	 * @param nrepair 0 if nothing to repair
 	 */
-	f4_Cells(f4_node * genome, int nrepair);
+	f4_Cells(f4_node *genome, int nrepair);
 
 	/**
@@ -283,25 +281,24 @@
 
 	/**
-	 * Adds new cell to organism.
+	 * Adds a new cell to organism.
 	 * @param newcell cell to be added
 	 */
-	void addCell(f4_Cell * newcell);
-
-	/**
-	 * Creates approximate genotype in f1 encoding and stores it in a given
-	 * parameter.
-	 * @param out the string in which approximate f1 genotype will be stored
+	void addCell(f4_Cell *newcell);
+
+	/**
+	 * Creates an approximate genotype in the f1 encoding and stores it in a given parameter.
+	 * @param out the string in which the approximate f1 genotype will be stored
 	 */
 	void toF1Geno(SString &out);
 
 	/**
-	 * Performs single step of organism development. It runs each active cell
-	 * in organism.
-	 * @return 0 if all cells are developed, or 1 otherwise
+	 * Performs a single step of organism development. It runs each active cell
+	 * in the organism.
+	 * @return 0 if all cells are developed, 1 otherwise
 	 */
 	int  onestep();
 
 	/**
-	 * Performs full development of organism and returns error code if something
+	 * Performs the full development of organism and returns error code if something
 	 * went wrong.
 	 * @return 0 if organism developed successfully, error code if something went wrong
@@ -310,5 +307,5 @@
 
 	/**
-	 * Returns error code of last simulation.
+	 * Returns error code of the last simulation.
 	 * @return error code
 	 */
@@ -316,12 +313,12 @@
 
 	/**
-	 * Returns position of error in genotype.
-	 * @return position of error
+	 * Returns position of an error in genotype.
+	 * @return position of an error
 	 */
 	int  geterrorpos() { return errorpos; };
 
 	/**
-	 * Sets error code GENOPER_OPFAIL for simulation on a given position.
-	 * @param nerrpos position of error
+	 * Sets error code GENOPER_OPFAIL for a simulation on a given position.
+	 * @param nerrpos position of an error
 	 */
 	void setError(int nerrpos);
@@ -329,28 +326,28 @@
 	/**
 	 * Sets the element of genotype to be repaired by removal.
-	 * @param nerrpos position of error in genotype
-	 * @param rem the f4_node to be removed from genotype tree in order to repair
-	 */
-	void setRepairRemove(int nerrpos, f4_node * rem);
-
-	/**
-	 * Sets repairing of genotype by inserting new node to current genotype.
-	 * @param nerrpos position of error in genotype
-	 * @param parent the parent of new element
+	 * @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);
+
+	/**
+	 * Sets repairing of a genotype by inserting a new node to the current genotype.
+	 * @param nerrpos position of an error in genotype
+	 * @param parent the parent of a new element
 	 * @param insert the element to be inserted
 	 * @return 0 if repair can be performed, -1 otherwise (the repair flag wasn't set in constructor)
 	 */
-	int  setRepairInsert(int nerrpos, f4_node * parent, f4_node * insert);
-
-	/**
-	 * Repairs genotype according to setRepairRemove or setRepairInsert method.
-	 * @param geno pointer to genotype tree
+	int  setRepairInsert(int nerrpos, f4_node *parent, f4_node *insert);
+
+	/**
+	 * Repairs the genotype according to setRepairRemove or setRepairInsert methods.
+	 * @param geno pointer to the genotype tree
 	 * @param whichchild 1 if first child, 2 otherwise
 	 */
-	void repairGeno(f4_node * geno, int whichchild);
+	void repairGeno(f4_node *geno, int whichchild);
 
 	// the cells
-	f4_Cell * C[MAX4CELLS]; ///<Array of all cells of organism
-	int       nc;           ///<Number of cells in organism
+	f4_Cell *C[MAX4CELLS];  ///<Array of all cells of an organism
+	int       nc;           ///<Number of cells in an organism
 
 private:
@@ -359,15 +356,15 @@
 	int error;
 	int errorpos;
-	f4_node * repair_remove;
-	f4_node * repair_parent;
-	f4_node * repair_insert;
+	f4_node *repair_remove;
+	f4_node *repair_parent;
+	f4_node *repair_insert;
 	void toF1GenoRec(int curc, SString &out);
-	f4_Cell * tmpcel;		// needed by toF1Geno
-	f4_node * f4rootnode;          // used by constructor
+	f4_Cell *tmpcel;		// needed by toF1Geno
+	f4_node *f4rootnode;          // used by constructor
 };
 
 
 /**
- * Class to organize a f4 genotype in a tree structure.
+ * A class to organize a f4 genotype in a tree structure.
  */
 class f4_node
@@ -375,16 +372,13 @@
 public:
 	string name; ///<one-letter 'name', multiple characters for classes
-	f4_node *parent; ///<parent link, or NULL
-	f4_node *child; ///<child, or NULL
-	f4_node *child2; ///<second child, or NULL
-	int         pos; ///<original position in string
-	int         i1; ///<internal int  parameter1
-	int         l1; ///<internal long parameter1
-	double      f1; ///<internal double parameter1
+	f4_node *parent; ///<parent link or NULL
+	f4_node *child; ///<child or NULL
+	f4_node *child2; ///<second child or NULL
+	int pos; ///<original position in the string
+	int i1; ///<internal int  parameter1
+	int l1; ///<internal long parameter1
+	double f1; ///<internal double parameter1
 	string s1; ///<internal string parameter1
 
-	/**
-	 * Default constructor.
-	 */
 	f4_node();
 
@@ -392,52 +386,49 @@
 	 * Multiple-character name constructor.
 	 * @param nname string from genotype representing node
-	 * @param nparent pointer to parent of node
-	 * @param npos position of node substring in genotype string
-	 */
-	f4_node(string nname, f4_node * nparent, int npos);
-
-	/**
-	 * One-character name constructor.
+	 * @param nparent pointer to parent of the node
+	 * @param npos position of node substring in the genotype string
+	 */
+	f4_node(string nname, f4_node *nparent, int npos);
+
+	/**
+	 * Single-character name constructor.
 	 * @param nname character from genotype representing node
-	 * @param nparent pointer to parent of node
-	 * @param npos position of node character in genotype string
-	 */
-	f4_node(char nname, f4_node * nparent, int npos);
-
-	/**
-	 * Desctructor of object.
-	 */
+	 * @param nparent pointer to parent of the node
+	 * @param npos position of node character in the genotype string
+	 */
+	f4_node(char nname, f4_node *nparent, int npos);
+
 	~f4_node();
 
 	/**
-	 * Method for adding child to a node.
-	 * @param nchi child to be added to node
-	 * @return 0 if child could be added, -1 otherwise
-	 */
-	int       addChild(f4_node * nchi);
-
-	/**
-	 * Method for removing child from node.
-	 * @param nchi child to be removed from node
+	 * Adds the child to the node.
+	 * @param nchi the child to be added to the node
+	 * @return 0 if the child could be added, -1 otherwise
+	 */
+	int addChild(f4_node *nchi);
+
+	/**
+	 * Removes the child from the node.
+	 * @param nchi the child to be removed from the node
 	 * @return 0 if child could be removed, -1 otherwise
 	 */
-	int       removeChild(f4_node * nchi);
-
-	/**
-	 * Returns number of children.
+	int removeChild(f4_node *nchi);
+
+	/**
+	 * Returns the number of children.
 	 * @return 0, 1 or 2
 	 */
-	int       childCount();
-
-	/**
-	 * Returns number of nodes coming from this node in a recursive way.
-	 * @return number of nodes from this node
-	 */
-	int       count();
+	int childCount();
+
+	/**
+	 * Returns the number of nodes coming from this node in a recursive way.
+	 * @return the number of nodes from this node
+	 */
+	int count();
 
 	/**
 	 * Returns the nth subnode (0-)
-	 * @param n index of child to be found
-	 * @return pointer to nth subnode or NULL if not found
+	 * @param n index of the child to be found
+	 * @return pointer to the nth subnode or NULL if not found
 	 */
 	f4_node * ordNode(int n);
@@ -450,19 +441,19 @@
 
 	/**
-	 * Returns a random subnode with given size.
+	 * Returns a random subnode with a given size.
 	 * @param min minimum size
 	 * @param max maximum size
-	 * @return a random subnode with given size or NULL
+	 * @return a random subnode with a given size or NULL
 	 */
 	f4_node * randomNodeWithSize(int min, int max);
 
 	/**
-	 * Prints recursively tree from a given node.
-	 * @param buf variable storing printing result
-	 */
-	void      sprintAdj(char *& buf);
-
-	/**
-	 * Recursively copies genotype tree from this node.
+	 * Prints recursively the tree from a given node.
+	 * @param buf variable to store printing result
+	 */
+	void      sprintAdj(char *&buf);
+
+	/**
+	 * Recursively copies the genotype tree from this node.
 	 * @return pointer to a tree copy
 	 */
@@ -474,5 +465,5 @@
 	void      destroy();
 private:
-	void     sprint(SString & out);	// print recursively
+	void     sprint(SString &out);	// print recursively
 };
 
@@ -480,52 +471,52 @@
 
 /**
- * Main function to perform conversion of f4 geno to tree structure. Prepares
+ * The main function for converting a string of f4 encoding to a tree structure. Prepares
  * f4_node root of tree and runs f4_processrec function for it.
- * @param geno string representing f4 genotype
- * @return pointer to f4_node object representing f4 tree root
- */
-f4_node * f4_processtree(const char * geno);
-
-/**
- * Scans genotype string from a given position. This recursive method creates
- * tree of f4_node objects. The method extract each potentially functional element
- * of genotype string to separate f4_nodes. When branching character '<' occurs,
- * then f4_processrec is ran for latest f4_node element. This method does not
- * analyse genotype semantically, it checks only if syntax is proper. The only
- * semantic aspect is neuron class name extraction, in which the GenoOperators
- * class is used to parse possible neuron class in genotype.
- * @param genot the string holding all genotype
+ * @param geno the string representing an f4 genotype
+ * @return a pointer to the f4_node object representing the f4 tree root
+ */
+f4_node * f4_processtree(const char *geno);
+
+/**
+ * Scans a genotype string starting from a given position. This recursive method creates
+ * a tree of f4_node objects. This method extracts each potentially functional element
+ * of a genotype string to a separate f4_nodes. When the branching character '<' occurs,
+ * f4_processrec is deployed for the latest f4_node element. This method does not
+ * analyse the genotype semantically, it only checks if the syntax is proper. The only
+ * semantic aspect is neuron class name extraction, where the GenoOperators
+ * class is used to parse the potential neuron class name.
+ * @param genot the string holding all the genotype
  * @param pos0 the current position of processing in string
- * @param current parent of analysed branch of genotype
- * @return 0 if processing was successful or position of error in genotype
- */
-int f4_processrec(const char * genot, unsigned pos0, f4_node * parent);
-
-/**
- * Function parses notation of neuron connection - it takes beginning of connection
- * definition, extracts relative position of input neurons and weight of connection.
- * After successful parsing it returns pointer to first character after connection
- * definition, or NULL if connection definition was not valid - lack of [, :, ]
- * characters or wrong value of relfrom or weight.
- * @param fragm the beginning of connection definition, it should be '[' character
- * @param relfrom the reference to int variable, in which relative position of input neuron will be stored
- * @param weight the reference to double variable, in which weight of connection will be stored
- * @return the pointer to first character in string after connection definition
- */
-const char * parseConnection(const char * fragm, int& relfrom, double &weight);
-
-/**
- * Function parses notation of neuron connection with neuron definition - it
- * takes beginning of connection definition, extracts the name of neuron class
- * that will be the input for current neuron and weight of connection.
- * After successful parsing it returns pointer to first character after connection
- * definition, or NULL if connection definition was not valid - lack of [, :, ]
- * characters, wrong value of weight or invalid neuron class name.
- * @param fragm the beginning of connection definition, it should be '[' character
- * @param neutype the reference to string representing input neuron class name. The name of class is validated with GenoOperators::parseNeuroClass
- * @param weight the reference to double variable, in which weight of connection will be stored
- * @return the pointer to first character in string after connection definition
- */
-const char * parseConnectionWithNeuron(const char * fragm, string& neutype, double &weight);
+ * @param current parent of the analysed branch of the genotype
+ * @return 0 if processing was successful, otherwise returns the position of an error in the genotype
+ */
+int f4_processrec(const char *genot, unsigned pos0, f4_node *parent);
+
+/**
+ * Parses notation of the neuron connection - takes the beginning of the connection
+ * definition, extracts the relative position of input neurons and the weight of the connection.
+ * After successful parsing, returns the pointer to the first character after the connection
+ * definition, or NULL if the connection definition was not valid due to the lack of [, :, ]
+ * characters or an invalid value of relfrom or weight.
+ * @param fragm the beginning of connection definition, should be the '[' character
+ * @param relfrom the reference to an int variable in which the relative position of the input neuron will be stored
+ * @param weight the reference to a double variable in which the weight of the connection will be stored
+ * @return the pointer to the first character in string after connection definition
+ */
+const char * parseConnection(const char *fragm, int &relfrom, double &weight);
+
+/**
+ * Parses the notation of the neuron connection with neuron definition - takes
+ * the beginning of the connection definition, extracts the name of neuron class
+ * that will be the input for the current neuron and the weight of the connection.
+ * After successful parsing, returns a pointer to the first character after the connection
+ * definition, or NULL if the connection definition was not valid due to the lack of [, :, ]
+ * characters, an invalid value of the weight or an invalid neuron class name.
+ * @param fragm the beginning of the connection definition, should be the '[' character
+ * @param neutype the reference to a string representing the input neuron class name. The name of the class is validated with GenoOperators::parseNeuroClass()
+ * @param weight the reference to a double variable in which the weight of the connection will be stored
+ * @return the pointer to the first character in string after the connection definition
+ */
+const char * parseConnectionWithNeuron(const char *fragm, string &neutype, double &weight);
 
 #endif
Index: cpp/frams/genetics/f4/oper_f4.cpp
===================================================================
--- cpp/frams/genetics/f4/oper_f4.cpp	(revision 760)
+++ cpp/frams/genetics/f4/oper_f4.cpp	(revision 767)
@@ -20,6 +20,10 @@
 #define F4_MODIFIERS_VISUAL "" //not supported in f4
 #define F4_MODIFIERS_RARE "EeWwAaSs" //expdef would need to handle these properly/specifically to ensure reasonable behavior, and hardly any expdef does. Modifying initial energy of a creature as a result of its genes (Ee) is in general not a good idea. Weight (Ww) works only in water, and in water sinking/going up should usually be caused by real "intentional" activity of a creature, not by its inherited weight. For assimilation (Aa), there is a dedicated parameter in CreaturesGroup. Stamina (Ss) is no longer needed as destructive collisions are not supported, and even if they were, some expdef would need to impose reasonable restrictions on the value of this parameter (e.g. similar to normalizeBiol4()) so there is some cost associated with it, and the specific consequences of destructions should be defined as needed.
-#define F4_MODIFIERS "LlRrCcQqFfMmIi" F4_MODIFIERS_RARE F4_MODIFIERS_VISUAL
+#define F4_MODIFIERS ",LlRrCcQqFfMmIi" F4_MODIFIERS_RARE F4_MODIFIERS_VISUAL
 const char *Geno_f4::all_modifiers = F4_MODIFIERS;
+
+// codes that can be changed (apart from being added/deleted)
+#define MUT_CHAN_CODES "<[#"
+#define REP_MAXCOUNT 19
 
 #define FIELDSTRUCT Geno_f4
@@ -134,9 +138,4 @@
 	// ! the genotype is g->child (not g) !
 
-	// codes that can be changed (apart being added/deleted)
-#define MUT_CHAN_CODES "<[#"
-#define ADD_SIMPLE_CODES ",XlLcCrRaAiIsSmMfFwWeEN@|"
-#define REP_MAXCOUNT 19
-
 	// do the mutation
 	// pick a random node
@@ -176,5 +175,5 @@
 				else
 				{
-					f4_node *n4 = new f4_node(rndclass->getName().c_str(), n2, n2->pos); //TODO move this above
+					f4_node *n4 = new f4_node(rndclass->getName().c_str(), n2, n2->pos);
 					if (rndclass->getPreferredInputs() != 0)
 					{
@@ -280,5 +279,7 @@
 			// choose a simple node from ADD_SIMPLE_CODES
 			n1->parent->removeChild(n1);
-			f4_node *n2 = new f4_node(ADD_SIMPLE_CODES[randomN(strlen(ADD_SIMPLE_CODES))], n1->parent, n1->parent->pos);
+			//f4_node *n2 = new f4_node(ADD_SIMPLE_CODES[randomN(strlen(ADD_SIMPLE_CODES))], n1->parent, n1->parent->pos);
+			int modifierid = GenoOperators::getRandomChar(all_modifiers, excluded_modifiers.c_str());
+			f4_node *n2 = new f4_node(all_modifiers[modifierid], n1->parent, n1->parent->pos);
 			n2->addChild(n1);
 			n1->parent = n2;
@@ -717,6 +718,4 @@
 }
 
-
-
 uint32_t Geno_f4::style(const char *g, int pos)
 {
@@ -727,6 +726,8 @@
 #define STYL4CAT_DIGIT "0123456789."
 #define STYL4CAT_REST "XN<># "
-	if (!strchr(STYL4CAT_MODIFIC STYL4CAT_NEUMOD STYL4CAT_DIGIT STYL4CAT_REST, ch))
+
+	if (!isalpha(ch) && !isdigit(ch) &&  !strchr("<>-+[]:,.@|#*/=!\t",ch)) {
 		return GENSTYLE_CS(0, GENSTYLE_INVALID);
+	}
 	uint32_t style = GENSTYLE_CS(0, GENSTYLE_STRIKEOUT); //default, should be changed below
 	if (strchr("X ", ch))              style = GENSTYLE_CS(0, GENSTYLE_NONE);
@@ -737,4 +738,18 @@
 	if (strchr(STYL4CAT_MODIFIC, ch))   style = GENSTYLE_RGBS(100, 100, 100, GENSTYLE_NONE);
 	if (strchr(STYL4CAT_NEUMOD, ch))    style = GENSTYLE_RGBS(0, 150, 0, GENSTYLE_NONE);
+	if (isalpha(ch)) {
+		int p = pos;
+		while (p > 0) {
+			p--;
+			if (!isalpha(g[p])) {
+				if (isupper(g[p+1]) && (g[p] == ':' || g[p] == '[')) { // name of neuron class
+					style = GENSTYLE_RGBS(150,0,150,GENSTYLE_ITALIC);
+				}
+				else { // property
+					style = GENSTYLE_RGBS(255,140,0,GENSTYLE_BOLD);
+				}
+			}
+		}
+	}
 	return style;
 }
