Index: cpp/frams/genetics/fL/fL_general.cpp
===================================================================
--- cpp/frams/genetics/fL/fL_general.cpp	(revision 935)
+++ cpp/frams/genetics/fL/fL_general.cpp	(revision 973)
@@ -1,4 +1,4 @@
 // This file is a part of Framsticks SDK.  http://www.framsticks.com/
-// Copyright (C) 1999-2018  Maciej Komosinski and Szymon Ulatowski.
+// Copyright (C) 1999-2020  Maciej Komosinski and Szymon Ulatowski.
 // See LICENSE.txt for details.
 
@@ -76,8 +76,8 @@
 {
 	// if position exceeds length then return false
-	if (pos >= src.len()) return false;
+	if (pos >= src.length()) return false;
 	int opencount = -1;
 	int i = pos;
-	for (; i < src.len(); i++)
+	for (; i < src.length(); i++)
 	{
 		// token cannot contain branching parenthesis
@@ -169,5 +169,5 @@
 	SString temp;
 	temp = token.substr(tokpos);
-	temp = temp.substr(0, temp.len() - 1);
+	temp = temp.substr(0, temp.length() - 1);
 
 	// if word has parameters
@@ -199,5 +199,5 @@
 				// if string is empty, then evaluate this with 0
 				// if sequence could not be evaluated, then return error
-				if (seq.len() > 0)
+				if (seq.length() > 0)
 				{
 					eval = new MathEvaluation(numparams);
@@ -217,5 +217,5 @@
 		}
 	}
-	else if (word->npar == 0 && temp.len() > 0)
+	else if (word->npar == 0 && temp.length() > 0)
 	{
 		SString message = "Too many parameters for word:  ";
@@ -351,5 +351,5 @@
 {
 	// if word already exist, then return error
-	if (this->name.len() == 0)
+	if (this->name.length() == 0)
 	{
 		logMessage("fL_Word", "processDefinition", LOG_ERROR, "Axiom name is empty");
@@ -456,26 +456,26 @@
 	switch (type)
 	{
-		case fLElementType::TERM:
-		{
-			tab = fL_word_paramtab;
-			obj = new fL_Word();
-			break;
-		}
-		case fLElementType::INFO:
-		{
-			tab = fL_builder_paramtab;
-			obj = this;
-			break;
-		}
-		case fLElementType::RULE:
-		{
-			tab = fL_rule_paramtab;
-			obj = new fL_Rule(begin, end);
-			break;
-		}
-		default:
-			tab = NULL;
-			obj = NULL;
-			break;
+	case fLElementType::TERM:
+	{
+		tab = fL_word_paramtab;
+		obj = new fL_Word();
+		break;
+	}
+	case fLElementType::INFO:
+	{
+		tab = fL_builder_paramtab;
+		obj = this;
+		break;
+	}
+	case fLElementType::RULE:
+	{
+		tab = fL_rule_paramtab;
+		obj = new fL_Rule(begin, end);
+		break;
+	}
+	default:
+		tab = NULL;
+		obj = NULL;
+		break;
 	}
 	Param par(tab);
@@ -573,5 +573,5 @@
 	while (genotype.getNextToken(pos, line, '\n'))
 	{
-		if (line.len() > 0)
+		if (line.length() > 0)
 		{
 			// words can be defined in the beginning of genotype
@@ -851,5 +851,5 @@
 				{
 					SString t = par.getString(q);
-					if (t.len() > 0)
+					if (t.length() > 0)
 					{
 						fL_Word *attrword = NULL;
@@ -957,5 +957,5 @@
 		}
 		double partprop = (ppar.getDoubleById(fL_part_names[i]) * alterationcount +
-				currval) / (alterationcount + 1.0);
+			currval) / (alterationcount + 1.0);
 		ppar.setDoubleById(fL_part_names[i], partprop);
 	}
@@ -1097,5 +1097,5 @@
 						delete newpart;
 						logMessage("fL_Builder", "developModel", LOG_ERROR,
-								"Error parsing word parameter");
+							"Error parsing word parameter");
 						return 1;
 					}
@@ -1124,5 +1124,5 @@
 						{
 							logMessage("fL_Builder", "developModel", LOG_ERROR,
-									"Error parsing word parameter");
+								"Error parsing word parameter");
 							delete newjoint;
 							return 1;
@@ -1162,5 +1162,5 @@
 			else if (word->name == "C")
 			{
-				connsbuffer.push_back({w, currstate.currneuron});
+				connsbuffer.push_back({ w, currstate.currneuron });
 			}
 			else if (word->name.startsWith("rot"))
@@ -1182,13 +1182,13 @@
 				if (word->name == "rotX")
 				{
-					rotmatrix.rotate(Pt3D(rot,0,0));
+					rotmatrix.rotate(Pt3D(rot, 0, 0));
 				}
 				else if (word->name == "rotY")
 				{
-					rotmatrix.rotate(Pt3D(0,rot,0));
+					rotmatrix.rotate(Pt3D(0, rot, 0));
 				}
 				else if (word->name == "rotZ")
 				{
-					rotmatrix.rotate(Pt3D(0,0,rot));
+					rotmatrix.rotate(Pt3D(0, 0, rot));
 				}
 				currstate.direction = rotmatrix.transform(currstate.direction);
@@ -1212,5 +1212,5 @@
 	{
 		if (connsbuffer[i].second == NULL ||
-				(connsbuffer[i].second->getClass()->getPreferredInputs() != -1 &&
+			(connsbuffer[i].second->getClass()->getPreferredInputs() != -1 &&
 				connsbuffer[i].second->getInputCount() >=
 				connsbuffer[i].second->getClass()->getPreferredInputs()))
@@ -1225,5 +1225,5 @@
 			SString attr = par.getStringById(FL_PE_CONN_ATTR);
 			fL_Word *attractor = NULL;
-			if (attr.len() > 0)
+			if (attr.length() > 0)
 			{
 				createWord(attr, attractor, 0, (*connsbuffer[i].first)->begin, (*connsbuffer[i].first)->end);
@@ -1236,5 +1236,5 @@
 				{
 					logMessage("fL_Builder", "developModel", LOG_ERROR,
-							"Error parsing word parameter");
+						"Error parsing word parameter");
 					delete attractor;
 					return 1;
@@ -1245,6 +1245,6 @@
 				connsbuffer[i].second->addInput(neu, weight);
 				if (using_mapping) neu->addMapping(
-						IRange((*connsbuffer[i].first)->begin,
-								(*connsbuffer[i].first)->end));
+					IRange((*connsbuffer[i].first)->begin,
+						(*connsbuffer[i].first)->end));
 			}
 			else
@@ -1252,6 +1252,6 @@
 				connsbuffer[i].second->addInput(connsbuffer[i].second, weight);
 				if (using_mapping) neu->addMapping(
-						IRange((*connsbuffer[i].first)->begin,
-								(*connsbuffer[i].first)->end));
+					IRange((*connsbuffer[i].first)->begin,
+						(*connsbuffer[i].first)->end));
 			}
 			delete attractor;
@@ -1286,5 +1286,5 @@
 	m->open(using_checkpoints);
 	bool wordsexceeded = false;
-	for (; t <= time; t+= timestamp)
+	for (; t <= time; t += timestamp)
 	{
 		alterTimedProperties(t); // always alter timed properties in the beginning
@@ -1293,5 +1293,5 @@
 		{
 			iterate(t);
-			curriter+=1.0;
+			curriter += 1.0;
 		}
 		if (using_checkpoints)
@@ -1362,5 +1362,5 @@
 {
 	int count = genotype.size();
-	for (fL_Rule *rul: rules)
+	for (fL_Rule *rul : rules)
 	{
 		count += rul->objsucc.size();
@@ -1373,5 +1373,5 @@
 {
 	for (std::vector<fL_Rule *>::iterator it = rules.begin();
-			it != rules.end(); it++)
+		it != rules.end(); it++)
 	{
 		std::vector<fL_Rule *>::iterator it2 = it;
@@ -1393,5 +1393,5 @@
 				{
 					if ((*it)->condeval->getStringifiedRPN() ==
-							(*it2)->condeval->getStringifiedRPN())
+						(*it2)->condeval->getStringifiedRPN())
 					{
 						todelete = true;
Index: cpp/frams/genetics/fL/fL_oper.cpp
===================================================================
--- cpp/frams/genetics/fL/fL_oper.cpp	(revision 935)
+++ cpp/frams/genetics/fL/fL_oper.cpp	(revision 973)
@@ -285,93 +285,87 @@
 	switch (method)
 	{
-		case FL_CHG_ITER:
-		{
-			if (rndUint(2) == 0)
-			{
-				creature->time = creature->time + iterchangestep <= ExtValue::getDouble(FL_MAXITER) ?
-						creature->time + iterchangestep : creature->time - iterchangestep;
-			}
-			else
-			{
-				creature->time = creature->time - iterchangestep >= 0 ?
-						creature->time - iterchangestep : creature->time + iterchangestep;
-			}
+	case FL_CHG_ITER:
+	{
+		if (rndUint(2) == 0)
+		{
+			creature->time = creature->time + iterchangestep <= ExtValue::getDouble(FL_MAXITER) ?
+				creature->time + iterchangestep : creature->time - iterchangestep;
+		}
+		else
+		{
+			creature->time = creature->time - iterchangestep >= 0 ?
+				creature->time - iterchangestep : creature->time + iterchangestep;
+		}
+		break;
+	}
+	case FL_CHG_COND:
+	{
+		if (creature->rules.size() > 0)
+		{
+			int ruleid = rndUint(creature->rules.size());
+			if (!creature->rules[ruleid]->condeval)
+			{
+				creature->rules[ruleid]->condeval = new MathEvaluation(creature->rules[ruleid]->objpred->npar);
+			}
+			creature->rules[ruleid]->condeval->mutateConditional();
 			break;
 		}
-		case FL_CHG_COND:
-		{
-			if (creature->rules.size() > 0)
-			{
-				int ruleid = rndUint(creature->rules.size());
-				if (!creature->rules[ruleid]->condeval)
-				{
-					creature->rules[ruleid]->condeval = new MathEvaluation(creature->rules[ruleid]->objpred->npar);
-				}
-				creature->rules[ruleid]->condeval->mutateConditional();
-				break;
-			}
-			// if there are no rules - create one
-		}
-		[[fallthrough]];
-		case FL_ADD_RULE:
-		{
-			std::unordered_map<std::string, fL_Word *>::iterator pred = creature->words.begin();
-			std::vector<fL_Word *> wordswithnorules;
-			for (; pred != creature->words.end(); pred++)
-			{
-				if (!pred->second->builtin)
-				{
-					bool norules = true;
-					for (fL_Rule * r : creature->rules)
-					{
-						if (pred->second->name == r->objpred->name &&
-								pred->second->npar == r->objpred->npar)
-						{
-							norules = false;
-							break;
-						}
-					}
-					if (norules)
-					{
-						wordswithnorules.push_back(pred->second);
-					}
-				}
-			}
-			if (wordswithnorules.size() > 0)
-			{
-				int predid = rndUint(wordswithnorules.size());
-				fL_Rule *newrule = new fL_Rule(0,0);
-				fL_Word *pred = new fL_Word();
-				*pred = *wordswithnorules[predid];
-				newrule->objpred = pred;
-				fL_Word *initdef = randomWordDefinition(creature, roulette(addtypes, FL_ADD_COUNT - 1)); // -1 to avoid branching
-				addWord(&newrule->objsucc, initdef, newrule->objsucc.begin());
-				creature->rules.push_back(newrule);
-				break;
-			}
-			else if (creature->rules.size() > 0)
-			{
-				int ruleid = rndUint(creature->rules.size());
-				fL_Rule *newrule = new fL_Rule(0, 0);
-				fL_Word *pred = new fL_Word();
-				*pred = *creature->rules[ruleid]->objpred;
-				newrule->objpred = pred;
-				if (creature->rules[ruleid]->condeval)
-				{
-					std::string formula = "";
-					creature->rules[ruleid]->condeval->RPNToInfix(formula);
-					if (formula.find("1.0-(") != 0)
-					{
-						std::string res = "1.0-(";
-						res += formula;
-						res += ")";
-						newrule->condeval = new MathEvaluation(pred->npar);
-						newrule->condeval->convertString(res);
-					}
-					else
-					{
-						newrule->condeval = new MathEvaluation(pred->npar);
-						newrule->condeval->mutateConditional();
-					}
+		// if there are no rules - create one
+	}
+	[[fallthrough]];
+	case FL_ADD_RULE:
+	{
+		std::unordered_map<std::string, fL_Word *>::iterator pred = creature->words.begin();
+		std::vector<fL_Word *> wordswithnorules;
+		for (; pred != creature->words.end(); pred++)
+		{
+			if (!pred->second->builtin)
+			{
+				bool norules = true;
+				for (fL_Rule * r : creature->rules)
+				{
+					if (pred->second->name == r->objpred->name &&
+						pred->second->npar == r->objpred->npar)
+					{
+						norules = false;
+						break;
+					}
+				}
+				if (norules)
+				{
+					wordswithnorules.push_back(pred->second);
+				}
+			}
+		}
+		if (wordswithnorules.size() > 0)
+		{
+			int predid = rndUint(wordswithnorules.size());
+			fL_Rule *newrule = new fL_Rule(0, 0);
+			fL_Word *pred = new fL_Word();
+			*pred = *wordswithnorules[predid];
+			newrule->objpred = pred;
+			fL_Word *initdef = randomWordDefinition(creature, roulette(addtypes, FL_ADD_COUNT - 1)); // -1 to avoid branching
+			addWord(&newrule->objsucc, initdef, newrule->objsucc.begin());
+			creature->rules.push_back(newrule);
+			break;
+		}
+		else if (creature->rules.size() > 0)
+		{
+			int ruleid = rndUint(creature->rules.size());
+			fL_Rule *newrule = new fL_Rule(0, 0);
+			fL_Word *pred = new fL_Word();
+			*pred = *creature->rules[ruleid]->objpred;
+			newrule->objpred = pred;
+			if (creature->rules[ruleid]->condeval)
+			{
+				std::string formula = "";
+				creature->rules[ruleid]->condeval->RPNToInfix(formula);
+				if (formula.find("1.0-(") != 0)
+				{
+					std::string res = "1.0-(";
+					res += formula;
+					res += ")";
+					newrule->condeval = new MathEvaluation(pred->npar);
+					newrule->condeval->convertString(res);
 				}
 				else
@@ -380,180 +374,211 @@
 					newrule->condeval->mutateConditional();
 				}
-				fL_Word *worddef = randomWordDefinition(creature, roulette(addtypes, FL_ADD_COUNT - 1));
-				addWord(&newrule->objsucc, worddef, newrule->objsucc.begin());
-				creature->rules.push_back(newrule);
-				break;
-			}
-			// if there are no words, from which rules can be formed, then add one
-		}
-		[[fallthrough]];
-		case FL_ADD_WDEF:
-		{
-			if (creature->countDefinedWords() <= maxdefinedwords)
-			{
-				int npar = rndUint(ExtValue::getInt(FL_MAXPARAMS, false));
-				for (int i = 0; i < maxdefinedwords; i++)
-				{
-					std::string name = "w";
-					name += std::to_string(i);
-					if (creature->words.find(name) == creature->words.end())
-					{
-						fL_Word *word = new fL_Word(false, 0, 0);
-						word->npar = npar;
-						word->name = name.c_str();
-						word->processDefinition(creature);
-						break;
-					}
-				}
-				break;
-			}
-			//no break at the end of case - if there is too many words, then
-			// deletion should be performed
-		}
-		[[fallthrough]];
-		case FL_DEL_WORD:
-		{
+			}
+			else
+			{
+				newrule->condeval = new MathEvaluation(pred->npar);
+				newrule->condeval->mutateConditional();
+			}
+			fL_Word *worddef = randomWordDefinition(creature, roulette(addtypes, FL_ADD_COUNT - 1));
+			addWord(&newrule->objsucc, worddef, newrule->objsucc.begin());
+			creature->rules.push_back(newrule);
+			break;
+		}
+		// if there are no words, from which rules can be formed, then add one
+	}
+	[[fallthrough]];
+	case FL_ADD_WDEF:
+	{
+		if (creature->countDefinedWords() <= maxdefinedwords)
+		{
+			int npar = rndUint(ExtValue::getInt(FL_MAXPARAMS, false));
+			for (int i = 0; i < maxdefinedwords; i++)
+			{
+				std::string name = "w";
+				name += std::to_string(i);
+				if (creature->words.find(name) == creature->words.end())
+				{
+					fL_Word *word = new fL_Word(false, 0, 0);
+					word->npar = npar;
+					word->name = name.c_str();
+					word->processDefinition(creature);
+					break;
+				}
+			}
+			break;
+		}
+		//no break at the end of case - if there is too many words, then
+		// deletion should be performed
+	}
+	[[fallthrough]];
+	case FL_DEL_WORD:
+	{
+		int numpars = 0;
+		int ruleid = 0;
+		std::list<fL_Word *> *list = selectRandomSequence(creature, numpars, ruleid);
+		if (ruleid == -1 && creature->countSticksInSequence(list) == 1)
+		{
+			if (list->size() > 1)
+			{
+				int rndid = rndUint(list->size() - 1);
+				int j = 0;
+				std::list<fL_Word *>::iterator it = list->begin();
+				if ((*it)->name == "S")
+				{
+					it++;
+				}
+				while (it != list->end() && j < rndid && ((*it)->name == "S"))
+				{
+					if ((*it)->name != "S")
+					{
+						j++;
+					}
+					it++;
+				}
+				if (it != list->end())
+				{
+					if ((*it)->type == fLElementType::BRANCH)
+					{
+						deleteBranch(list, it);
+					}
+					else
+					{
+						delete (*it);
+						list->erase(it);
+					}
+					break;
+				}
+				// else add word
+			}
+			// else add word
+		}
+		else
+		{
+			int rndid = rndUint(list->size());
+			std::list<fL_Word *>::iterator it = list->begin();
+			std::advance(it, rndid);
+			if ((*it)->type == fLElementType::BRANCH)
+			{
+				deleteBranch(list, it);
+			}
+			else
+			{
+				delete (*it);
+				list->erase(it);
+			}
+			if (ruleid > -1 && creature->rules[ruleid]->objsucc.size() == 0)
+			{
+				delete creature->rules[ruleid];
+				creature->rules.erase(creature->rules.begin() + ruleid);
+			}
+			break;
+		}
+		// if no words available, then add word
+	}
+	[[fallthrough]];
+	case FL_ADD_WORD:
+	{
+		int numpars = 0;
+		int tmp = 0;
+		std::list<fL_Word *> *list = selectRandomSequence(creature, numpars, tmp);
+		int rndid = rndUint(list->size());
+		std::list<fL_Word *>::iterator it = list->begin();
+		std::advance(it, rndid);
+		int meth = roulette(addtypes, FL_ADD_COUNT);
+		if (tmp == -1)
+		{ // if sequence is axiom and it does not have non-builtin words
+			bool hasdefined = false;
+			for (std::list<fL_Word *>::iterator elem = list->begin(); elem != list->end(); elem++)
+			{
+				if (!(*elem)->builtin)
+				{
+					hasdefined = true;
+					break;
+				}
+			}
+			if (!hasdefined)
+			{
+				meth = FL_ADD_OTHER;
+			}
+
+		}
+		if (meth != FL_ADD_BRANCH)
+		{
+			fL_Word *worddef = randomWordDefinition(creature, meth);
+			addWord(list, worddef, it);
+		}
+		else
+		{
+			fL_Branch *start = new fL_Branch(fL_Branch::BranchType::OPEN, 0, 0);
+			list->insert(it, start);
+			int rottype = rndUint(2);
+			switch (rottype)
+			{
+			case 0:
+				addWord(list, creature->words["rotY"], it);
+			case 1:
+				addWord(list, creature->words["rotZ"], it);
+			}
+			addWord(list, creature->words["S"], it);
+			fL_Branch *end = new fL_Branch(fL_Branch::BranchType::CLOSE, 0, 0);
+			list->insert(it, end);
+		}
+		break;
+	}
+	case FL_CHG_WORD:
+	{
+		int numpars = 0;
+		int tmp = 0;
+		std::list<fL_Word *> *list = selectRandomSequence(creature, numpars, tmp);
+		int rndid = rndUint(list->size());
+		std::list<fL_Word *>::iterator selectedword = list->begin();
+		std::advance(selectedword, rndid);
+		if ((*selectedword)->type == fLElementType::BRANCH)
+		{
+			break;
+		}
+		int chgtype = roulette(chgoperations, FL_CHG_COUNT);
+		if (creature->countSticksInSequence(list) == 1 && tmp == -1) // if sequence is axiom
+		{
+			fL_Word *worddef = randomWordDefinition(creature, roulette(addtypes, FL_ADD_COUNT - 1));
+
 			int numpars = 0;
-			int ruleid = 0;
-			std::list<fL_Word *> *list = selectRandomSequence(creature, numpars, ruleid);
-			if (ruleid == -1 && creature->countSticksInSequence(list) == 1)
-			{
-				if (list->size() > 1)
-				{
-					int rndid = rndUint(list->size() - 1);
-					int j = 0;
-					std::list<fL_Word *>::iterator it = list->begin();
-					if ((*it)->name == "S")
-					{
-						it++;
-					}
-					while (it != list->end() && j < rndid && ((*it)->name == "S"))
-					{
-						if ((*it)->name != "S")
-						{
-							j++;
-						}
-						it++;
-					}
-					if (it != list->end())
-					{
-						if ((*it)->type == fLElementType::BRANCH)
-						{
-							deleteBranch(list, it);
-						}
-						else
-						{
-							delete (*it);
-							list->erase(it);
-						}
-						break;
-					}
-					// else add word
-				}
-				// else add word
-			}
-			else
-			{
-				int rndid = rndUint(list->size());
-				std::list<fL_Word *>::iterator it = list->begin();
-				std::advance(it, rndid);
-				if ((*it)->type == fLElementType::BRANCH)
-				{
-					deleteBranch(list, it);
-				}
-				else
-				{
-					delete (*it);
-					list->erase(it);
-				}
-				if (ruleid > -1 && creature->rules[ruleid]->objsucc.size() == 0)
-				{
-					delete creature->rules[ruleid];
-					creature->rules.erase(creature->rules.begin() + ruleid);
-				}
-				break;
-			}
-			// if no words available, then add word
-		}
-		[[fallthrough]];
-		case FL_ADD_WORD:
-		{
-			int numpars = 0;
-			int tmp = 0;
 			std::list<fL_Word *> *list = selectRandomSequence(creature, numpars, tmp);
 			int rndid = rndUint(list->size());
 			std::list<fL_Word *>::iterator it = list->begin();
 			std::advance(it, rndid);
-			int meth = roulette(addtypes, FL_ADD_COUNT);
-			if (tmp == -1)
-			{ // if sequence is axiom and it does not have non-builtin words
-				bool hasdefined = false;
-				for (std::list<fL_Word *>::iterator elem = list->begin(); elem != list->end(); elem++)
-				{
-					if (!(*elem)->builtin)
-					{
-						hasdefined = true;
-						break;
-					}
-				}
-				if (!hasdefined)
-				{
-					meth = FL_ADD_OTHER;
-				}
-
-			}
-			if (meth != FL_ADD_BRANCH)
-			{
-				fL_Word *worddef = randomWordDefinition(creature, meth);
-				addWord(list, worddef, it);
+
+			addWord(list, worddef, it);
+
+			break;
+		}
+		else if (chgtype == FL_CHG_WORD_NAME)
+		{
+			if ((*selectedword)->builtin)
+			{
+				delete (*selectedword);
+				selectedword = list->erase(selectedword);
+				fL_Word *worddef = randomWordDefinition(creature, roulette(addtypes, FL_ADD_COUNT - 1));
+				addWord(list, worddef, selectedword);
 			}
 			else
 			{
-				fL_Branch *start = new fL_Branch(fL_Branch::BranchType::OPEN, 0, 0);
-				list->insert(it, start);
-				int rottype = rndUint(2);
-				switch (rottype)
-				{
-				case 0:
-					addWord(list, creature->words["rotY"], it);
-				case 1:
-					addWord(list, creature->words["rotZ"], it);
-				}
-				addWord(list, creature->words["S"], it);
-				fL_Branch *end = new fL_Branch(fL_Branch::BranchType::CLOSE, 0, 0);
-				list->insert(it, end);
-			}
-			break;
-		}
-		case FL_CHG_WORD:
-		{
-			int numpars = 0;
-			int tmp = 0;
-			std::list<fL_Word *> *list = selectRandomSequence(creature, numpars, tmp);
-			int rndid = rndUint(list->size());
-			std::list<fL_Word *>::iterator selectedword = list->begin();
-			std::advance(selectedword, rndid);
-			if ((*selectedword)->type == fLElementType::BRANCH)
-			{
-				break;
-			}
-			int chgtype = roulette(chgoperations, FL_CHG_COUNT);
-			if (creature->countSticksInSequence(list) == 1 && tmp == -1) // if sequence is axiom
-			{
-				fL_Word *worddef = randomWordDefinition(creature, roulette(addtypes, FL_ADD_COUNT - 1));
-
-				int numpars = 0;
-				std::list<fL_Word *> *list = selectRandomSequence(creature, numpars, tmp);
-				int rndid = rndUint(list->size());
-				std::list<fL_Word *>::iterator it = list->begin();
-				std::advance(it, rndid);
-
-				addWord(list, worddef, it);
-
-				break;
-			}
-			else if (chgtype == FL_CHG_WORD_NAME)
-			{
-				if ((*selectedword)->builtin)
+				std::vector<fL_Word *> available;
+				for (std::unordered_map<std::string, fL_Word *>::iterator wit = creature->words.begin();
+					wit != creature->words.end(); wit++)
+				{
+					if ((*selectedword)->npar == wit->second->npar &&
+						(*selectedword)->name != wit->second->name &&
+						!wit->second->builtin)
+					{
+						available.push_back(wit->second);
+					}
+				}
+				if (available.size() > 0)
+				{
+					int newnameid = rndUint(available.size());
+					(*selectedword)->name = available[newnameid]->name;
+				}
+				else
 				{
 					delete (*selectedword);
@@ -562,114 +587,89 @@
 					addWord(list, worddef, selectedword);
 				}
-				else
-				{
-					std::vector<fL_Word *> available;
-					for (std::unordered_map<std::string, fL_Word *>::iterator wit = creature->words.begin();
-							wit != creature->words.end(); wit++)
-					{
-						if ((*selectedword)->npar == wit->second->npar &&
-								(*selectedword)->name != wit->second->name &&
-								!wit->second->builtin)
+			}
+		}
+		else
+		{
+			if ((*selectedword)->npar > 0)
+			{
+				int randeval = rndUint((*selectedword)->npar);
+				Param par((*selectedword)->tab, (*selectedword)->data);
+				if ((*selectedword)->builtin && (*selectedword)->name == "N"
+					&& strcmp(par.id(randeval), FL_PE_NEURO_DET) == 0)
+				{
+					SString res = par.getStringById(FL_PE_NEURO_DET);
+					Geno_fH::mutateNeuronProperties(res);
+					par.setStringById(FL_PE_NEURO_DET, res);
+				}
+				else if ((*selectedword)->builtin &&
+					(*selectedword)->name == "C" &&
+					strcmp(par.id(randeval), FL_PE_CONN_ATTR) == 0)
+				{
+					SString strattractor = par.getStringById(FL_PE_CONN_ATTR);
+					if (strattractor.length() > 0)
+					{
+						fL_Word *w = NULL;
+						creature->createWord(strattractor, w, numpars, 0, 0);
+						// mutate attractor parameter
+						if (w->npar > 0)
 						{
-							available.push_back(wit->second);
+							int rndattr = rndUint(w->npar);
+							if (!w->parevals[rndattr])
+							{
+								w->parevals[rndattr] = new MathEvaluation(numpars);
+							}
+							w->parevals[rndattr]->mutate(false, false);
 						}
-					}
-					if (available.size() > 0)
-					{
-						int newnameid = rndUint(available.size());
-						(*selectedword)->name = available[newnameid]->name;
+						strattractor = w->stringify(true);
+						par.setStringById(FL_PE_CONN_ATTR, strattractor);
+						delete w;
 					}
 					else
 					{
-						delete (*selectedword);
-						selectedword = list->erase(selectedword);
-						fL_Word *worddef = randomWordDefinition(creature, roulette(addtypes, FL_ADD_COUNT - 1));
-						addWord(list, worddef, selectedword);
-					}
-				}
-			}
-			else
-			{
-				if ((*selectedword)->npar > 0)
-				{
-					int randeval = rndUint((*selectedword)->npar);
-					Param par((*selectedword)->tab, (*selectedword)->data);
-					if ((*selectedword)->builtin && (*selectedword)->name == "N"
-							&& strcmp(par.id(randeval), FL_PE_NEURO_DET) == 0)
-					{
-						SString res = par.getStringById(FL_PE_NEURO_DET);
-						Geno_fH::mutateNeuronProperties(res);
-						par.setStringById(FL_PE_NEURO_DET, res);
-					}
-					else if ((*selectedword)->builtin &&
-							(*selectedword)->name == "C" &&
-							strcmp(par.id(randeval), FL_PE_CONN_ATTR) == 0)
-					{
-						SString strattractor = par.getStringById(FL_PE_CONN_ATTR);
-						if (strattractor.len() > 0)
+						if (creature->builtincount < (int)creature->words.size())
 						{
-							fL_Word *w = NULL;
-							creature->createWord(strattractor, w, numpars, 0, 0);
-							// mutate attractor parameter
+							fL_Word *wdef = randomWordDefinition(creature, FL_ADD_OTHER);
+							fL_Word *w = new fL_Word();
+							*w = *wdef;
+							w->data = ParamObject::makeObject(w->tab);
+							Param apar(w->tab);
+							apar.select(w->data);
+							apar.setDefault();
 							if (w->npar > 0)
 							{
 								int rndattr = rndUint(w->npar);
-								if (!w->parevals[rndattr])
+								for (int i = 0; i < w->npar; i++)
 								{
-									w->parevals[rndattr] = new MathEvaluation(numpars);
+									if (i == rndattr)
+									{
+										MathEvaluation *ev = new MathEvaluation(numpars);
+										ev->mutate(false, false);
+										w->parevals.push_back(ev);
+									}
+									else
+									{
+										w->parevals.push_back(NULL);
+									}
 								}
-								w->parevals[rndattr]->mutate(false, false);
+
 							}
-							strattractor = w->stringify(true);
+							strattractor = w->stringify(false);
 							par.setStringById(FL_PE_CONN_ATTR, strattractor);
 							delete w;
 						}
-						else
-						{
-							if (creature->builtincount < (int)creature->words.size())
-							{
-								fL_Word *wdef = randomWordDefinition(creature, FL_ADD_OTHER);
-								fL_Word *w = new fL_Word();
-								*w = *wdef;
-								w->data = ParamObject::makeObject(w->tab);
-								Param apar(w->tab);
-								apar.select(w->data);
-								apar.setDefault();
-								if (w->npar > 0)
-								{
-									int rndattr = rndUint(w->npar);
-									for (int i = 0; i < w->npar; i++)
-									{
-										if (i == rndattr)
-										{
-											MathEvaluation *ev = new MathEvaluation(numpars);
-											ev->mutate(false, false);
-											w->parevals.push_back(ev);
-										}
-										else
-										{
-											w->parevals.push_back(NULL);
-										}
-									}
-
-								}
-								strattractor = w->stringify(false);
-								par.setStringById(FL_PE_CONN_ATTR, strattractor);
-								delete w;
-							}
-						}
-					}
-					else
-					{
-						if (!(*selectedword)->parevals[randeval])
-						{
-							(*selectedword)->parevals[randeval] = new MathEvaluation(numpars);
-						}
-						(*selectedword)->parevals[randeval]->mutate(false, iterchangestep != 1.0);
-					}
-				}
-			}
-			break;
-		}
+					}
+				}
+				else
+				{
+					if (!(*selectedword)->parevals[randeval])
+					{
+						(*selectedword)->parevals[randeval] = new MathEvaluation(numpars);
+					}
+					(*selectedword)->parevals[randeval]->mutate(false, iterchangestep != 1.0);
+				}
+			}
+		}
+		break;
+	}
 	}
 
@@ -702,5 +702,5 @@
 	}
 	else if (to->words.find(fromword->name.c_str()) != to->words.end() &&
-			to->words[fromword->name.c_str()]->npar == fromword->npar) // if there is already same word with same number of parameters
+		to->words[fromword->name.c_str()]->npar == fromword->npar) // if there is already same word with same number of parameters
 	{
 		fL_Word *newword = new fL_Word();
@@ -710,5 +710,5 @@
 	}
 	for (std::unordered_map<std::string, fL_Word *>::iterator it = to->words.begin();
-			it != to->words.end(); it++)
+		it != to->words.end(); it++)
 	{ // find word with same number of parameters
 		if (fromword->npar == it->second->npar && map.find(fromword->name.c_str()) == map.end() && !it->second->builtin)
@@ -774,5 +774,5 @@
 					std::string form;
 					if (w->builtin && w->name == "N"
-							&& strcmp(par.id(i), FL_PE_NEURO_DET) == 0)
+						&& strcmp(par.id(i), FL_PE_NEURO_DET) == 0)
 					{
 						SString res = origpar.getStringById(FL_PE_NEURO_DET);
@@ -781,8 +781,8 @@
 					}
 					else if (w->builtin && w->name == "C"
-							&& strcmp(par.id(i), FL_PE_CONN_ATTR) == 0)
+						&& strcmp(par.id(i), FL_PE_CONN_ATTR) == 0)
 					{
 						SString strattractor = origpar.getStringById(FL_PE_CONN_ATTR);
-						if (strattractor.len() > 0)
+						if (strattractor.length() > 0)
 						{
 							fL_Word *tmp = NULL;
