Index: /applications/robust/robustlib.h
===================================================================
--- /applications/robust/robustlib.h (revision 1307)
+++ /applications/robust/robustlib.h (revision 1310)
@@ -834,11 +834,12 @@
 					if(is_last)
 					{
+						
+						/// \TODO Nechapu druhou podminku, zda se mi ze je to spatne.. Nemela by byt jen prvni? Nebo se jedna o nastaveni totalni neutrality?
 						if((current_parent->negativechildren.size()>0&&current_parent->positivechildren.size()>0)||
 													(current_parent->neutralchildren.size()>0&&current_parent->totally_neutral==false))
-						{								
+						{
+							for_splitting[level+1].push_back(current_parent);						
 								
-								for_splitting[level+1].push_back(current_parent);
-								
-								current_parent->set_state(0, SPLIT);
+							current_parent->set_state(0, SPLIT);
 						}
 						else
@@ -947,4 +948,5 @@
 			{
 				
+				/*
 				if(i==statistic.size()-1)
 				{
@@ -956,4 +958,5 @@
 					cout << ((vertex*)horiz_ref)->get_coordinates() << endl;
 				}
+				*/
 
 				char* string = "Checkpoint";
@@ -1216,4 +1219,45 @@
 							(*child_ref)->parents.push_back(current_positive);													
 						}
+
+						// current_positive->parents.insert(current_positive->parents.begin(),current_negative->parents.begin(),current_negative->parents.end());
+						// unique(current_positive->parents.begin(),current_positive->parents.end());
+
+						for(list<polyhedron*>::iterator parent_ref = current_negative->parents.begin();parent_ref!=current_negative->parents.end();parent_ref++)
+						{
+							(*parent_ref)->children.remove(current_negative);
+
+							switch(current_negative->get_state(SPLIT))
+							{
+							case -1:
+								(*parent_ref)->negativechildren.remove(current_negative);
+								break;
+							case 0:
+								(*parent_ref)->neutralchildren.remove(current_negative);								
+								break;
+							case 1:
+								(*parent_ref)->positivechildren.remove(current_negative);
+								break;
+							}
+							//(*parent_ref)->children.push_back(current_positive);
+						}
+
+						if(current_positive->get_state(SPLIT)!=0||current_negative->get_state(SPLIT)==0)
+						{
+							for(list<polyhedron*>::iterator parent_ref = current_positive->parents.begin();parent_ref!=current_positive->parents.end();parent_ref++)
+							{
+								if(current_positive->get_state(SPLIT)==1)
+								{
+									(*parent_ref)->positivechildren.remove(current_positive);
+								}
+								else
+								{
+									(*parent_ref)->negativechildren.remove(current_positive);
+								}
+
+								(*parent_ref)->neutralchildren.push_back(current_positive);
+							}
+
+							current_positive->set_state(0,SPLIT);
+						}
 						
 						if((current_positive->get_state(SPLIT)==0&&!current_positive->totally_neutral)||(current_negative->get_state(SPLIT)==0&&!current_negative->totally_neutral))
@@ -1264,12 +1308,5 @@
 						}
 
-						current_positive->parents.insert(current_positive->parents.begin(),current_negative->parents.begin(),current_negative->parents.end());
-						// unique(current_positive->parents.begin(),current_positive->parents.end());
-
-						for(list<polyhedron*>::iterator parent_ref = current_negative->parents.begin();parent_ref!=current_negative->parents.end();parent_ref++)
-						{
-							(*parent_ref)->children.remove(current_negative);
-							(*parent_ref)->children.push_back(current_positive);
-						}						
+												
 						
 						current_positive->vertices.insert(current_negative->vertices.begin(),current_negative->vertices.end());
@@ -1331,4 +1368,6 @@
 						current_positive->grandparents.clear();
 
+						
+						
 						current_positive->totally_neutral = (current_positive->totally_neutral && current_negative->totally_neutral);
 
@@ -1397,4 +1436,5 @@
 		}
 		
+		step_me(0);
 
 		if(should_add)
@@ -1550,5 +1590,5 @@
 		}
 
-		
+		/*
 		vector<int> sizevector;
 		for(int s = 0;s<statistic.size();s++)
@@ -1557,4 +1597,5 @@
 			cout << statistic.row_size(s) << ", ";
 		}
+		*/
 
 		cout << endl;
