Index: /GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.cpp	(revision 1420)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/X3dParser.cpp	(revision 1421)
@@ -234,5 +234,5 @@
 		//-- load data as single triangles instead of whole meshes
 
-		//cout << "m";	
+		cout << "m";	
 		Mesh tempMesh(*mCurrentMesh);
 		ApplyTransformations(mTransformations, &tempMesh);
@@ -590,5 +590,5 @@
  
   if (element == "Shape") {
-	  //cout << "+"; 
+	  cout << "+"; 
 
 	  // reset current shape values
@@ -603,5 +603,5 @@
   }
 
-  // todo
+  // todo: materials don't work proberly yet
   if (element == "Material") {
 	  StartMaterial(attributes);
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h	(revision 1416)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.h	(revision 1421)
@@ -979,5 +979,5 @@
 };
 
-#define TEST_EVALUATION 1
+#define TEST_EVALUATION 0
 
 /**
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp	(revision 1418)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Environment.cpp	(revision 1421)
@@ -2427,5 +2427,5 @@
 					optFloat,
 					"hierarchy_term_min_global_cost_ratio=",
-					"0.00001");
+					"0.9");
 
 	RegisterOption("Hierarchy.Termination.globalCostMissTolerance",
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp	(revision 1418)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.cpp	(revision 1421)
@@ -131,5 +131,4 @@
 mBspTree(NULL),
 mVspBspTree(NULL),
-mVspTree(NULL),
 mHierarchyManager(NULL),
 mViewCellsManager(NULL),
@@ -185,8 +184,4 @@
 	cout << "Deleting kd tree...\n";
 	DEL_PTR(mKdTree);
-	cout << "done.\n";
-
-	cout << "Deleting vsp tree...\n";
-	DEL_PTR(mVspTree);
 	cout << "done.\n";
 
@@ -505,17 +500,17 @@
 		const bool ishack = false;
 		if (ishack)
-			hierarchyManager = new HierarchyManager(mVspTree, mKdTree);
+			hierarchyManager = new HierarchyManager(mKdTree);
 		else
-			hierarchyManager = new HierarchyManager(mVspTree, HierarchyManager::KD_BASED_OBJ_SUBDIV);
+			hierarchyManager = new HierarchyManager(HierarchyManager::KD_BASED_OBJ_SUBDIV);
 	}
 	else if (strcmp(name, "bvh") == 0)
 	{
 		Debug << "hierarchy manager: bvh" << endl;
-		hierarchyManager = new HierarchyManager(mVspTree, HierarchyManager::BV_BASED_OBJ_SUBDIV);
+		hierarchyManager = new HierarchyManager(HierarchyManager::BV_BASED_OBJ_SUBDIV);
 	}
 	else // only view space partition
 	{
 		Debug << "hierarchy manager: obj" << endl;
-		hierarchyManager = new HierarchyManager(mVspTree, HierarchyManager::NO_OBJ_SUBDIV);
+		hierarchyManager = new HierarchyManager(HierarchyManager::NO_OBJ_SUBDIV);
 	}
 
@@ -548,5 +543,5 @@
 	else if (strcmp(name, "vspOspTree") == 0)
 	{
-		mVspTree = new VspTree();
+		Debug << "view cell type: VspOsp" << endl;
 		char buf[100];		
 		Environment::GetSingleton()->GetStringValue("Hierarchy.type", buf);	
@@ -555,9 +550,8 @@
 		mViewCellsManager = new VspOspViewCellsManager(vcTree, mHierarchyManager);
 	}
-	else if (strcmp(name, "sceneDependent") == 0)
+	else if (strcmp(name, "sceneDependent") == 0) //TODO
 	{
 		Debug << "view cell type: Bsp" << endl;
-
-		//TODO
+		
 		mBspTree = new BspTree();
 		mViewCellsManager = new BspViewCellsManager(vcTree, mBspTree);
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h	(revision 1419)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.h	(revision 1421)
@@ -139,12 +139,15 @@
 
 public:
-	/** Constructor with the object space hierarchy type as argument.
-	*/
-	HierarchyManager(VspTree *vspTree, const int objectSpaceHierarchyType);
+	/** Constructor with the view space partition tree and
+		the object space hierarchy type as argument.
+	*/
+	HierarchyManager(const int objectSpaceHierarchyType);
 	/** Hack: OspTree will copy the content from this kd tree.
 		Only view space hierarchy will be constructed.
 	*/
-	HierarchyManager(VspTree *vspTree, KdTree *kdTree);
-
+	HierarchyManager(KdTree *kdTree);
+
+	/** Deletes space partition and view space partition.
+	*/
 	~HierarchyManager();
 
@@ -196,11 +199,21 @@
 		float &contribution) const;
 
-	void PrintHierarchyStatistics(ofstream &stream) const;
-
+	/** Print out statistics.
+	*/
+	void PrintHierarchyStatistics(ostream &stream) const;
+
+	/** Returns the view space partition tree.
+	*/
 	VspTree *GetVspTree();
 
+	/** Returns view space bounding box.
+	*/
 	AxisAlignedBox3 GetViewSpaceBox() const;
+	/** Returns object space bounding box.
+	*/
 	AxisAlignedBox3 GetObjectSpaceBox() const;
 
+	/** Exports object space hierarchy for visualization.
+	*/
 	void ExportObjectSpaceHierarchy(
 		Exporter *exporter, 
@@ -209,5 +222,6 @@
 		const bool exportBounds = true) const;
 
-
+	/** Returns intersectable pierced by this ray.
+	*/
 	Intersectable *GetIntersectable(
 		const VssRay &ray, 
@@ -216,7 +230,8 @@
 	friend ostream &operator<<(ostream &s, const HierarchyManager &hm) 
 	{
-		hm.mHierarchyStats.Print(s);
+		hm.PrintHierarchyStatistics(s);
 		return s;
 	} 
+
 
 protected:
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h	(revision 1418)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.h	(revision 1421)
@@ -199,6 +199,5 @@
   /// View space partition bsp tree
   VspBspTree *mVspBspTree;
-  // view space partition tree
-  VspTree *mVspTree;
+  /// Hierarchy manager handling view space and object space partition
   HierarchyManager *mHierarchyManager;
   /// BSP tree representing the viewcells
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp	(revision 1415)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp	(revision 1421)
@@ -211,5 +211,5 @@
 
 
-	////////////////////////////////////////////////
+	//////////////////////////////
 	//-- max cost ratio for early tree termination
 
@@ -221,5 +221,5 @@
 
 
-	/////////////////////////////////////////
+	//////////////////////////////
 	//-- factors for subdivision heuristics
 
@@ -239,5 +239,5 @@
 
 
-	/////////////////////////////////
+	/////////////
 	//-- debug output
 
@@ -294,6 +294,6 @@
 	AxisAlignedBox3 parentBox = leaf->GetBoundingBox();
 
-	// update stats
-	mBvhStats.nodes += 2; // we have two new leaves
+	// update stats: we have two new leaves
+	mBvhStats.nodes += 2;
 
 	if (tData.mDepth > mBvhStats.maxDepth)
@@ -306,5 +306,5 @@
 	
 
-	////////////////////////////////
+	//////////////////
 	//-- create front and back leaf
 
@@ -336,5 +336,5 @@
 
 
-	///////////////////////////////////////////////////////////////////
+	////////////////////////////////////////
 	//-- fill  front and back traversal data with the new values
 
@@ -393,5 +393,5 @@
 	if (!LocalTerminationCriteriaMet(tData) && !globalCriteriaMet)
 	{	
-		//////////////////////////////////////////
+		//////////////
 		//-- continue subdivision
 
@@ -412,5 +412,5 @@
 
 
-		/////////////////////////////////////////
+		///////////////////////////
 		//-- push the new split candidates on the queue
 		
@@ -487,9 +487,9 @@
 	const float renderCostDecr = oldRenderCost - newRenderCost;
 
-#ifdef _DEBUG
+//#ifdef _DEBUG
 	Debug << "old render cost: " << oldRenderCost << endl;
 	Debug << "new render cost: " << newRenderCost << endl;
 	Debug << "render cost decrease: " << renderCostDecr << endl;
-#endif
+//#endif
 	splitCandidate.SetRenderCostDecrease(renderCostDecr);
 
@@ -522,10 +522,19 @@
 inline bool BvHierarchy::GlobalTerminationCriteriaMet(const BvhTraversalData &data) const
 {
-	// matt: TODO
-	return (0
+	const bool terminationCriteriaMet =
+		(0
 		|| (mBvhStats.Leaves() >= mTermMaxLeaves)
 		|| (mGlobalCostMisses >= mTermGlobalCostMissTolerance)
 		//|| mOutOfMemory 
 		);
+
+	if (0 && terminationCriteriaMet)
+	{
+		Debug << "bvh global termination criteria met:" << endl;
+		Debug << "cost misses: " << mGlobalCostMisses << " " << mTermGlobalCostMissTolerance << endl;
+		Debug << "leaves: " << mBvhStats.Leaves() << " " << mTermMaxLeaves << endl;
+	}
+
+	return terminationCriteriaMet; 
 }
 
@@ -1233,11 +1242,11 @@
 void BvHierarchy::PrintSubdivisionStats(const SubdivisionCandidate &sc)
 {
-	const float costDecr = sc.GetRenderCostDecrease();	
+	const float costDecr = 
+		sc.GetRenderCostDecrease();// / mHierarchyManager->GetViewSpaceBox().GetVolume();	
 
 	mSubdivisionStats 
-			<< "#Leaves\n" << mBvhStats.Leaves()
+			<< "#Leaves\n" << mBvhStats.Leaves() << endl
 			<< "#RenderCostDecrease\n" << costDecr << endl 
 			<< "#TotalRenderCost\n" << mTotalCost << endl;
-			//<< "#AvgRenderCost\n" << avgRenderCost << endl;
 }
 
@@ -1277,5 +1286,5 @@
 			return 0.0f;
 
-		/////////////////////////////
+		////////////////////
 		//-- surface area heuristics
 
@@ -1283,8 +1292,8 @@
 		const float area = box.SurfaceArea();
 
-		return (float)objects.size() * area;
+		return (float)objects.size() * area / mHierarchyManager->GetViewSpaceBox().SurfaceArea();
 	}
 	else
-	{	/////////////////////////////
+	{	////////////////////
 		//-- render cost heuristics
 
@@ -1647,14 +1656,14 @@
 	//-- we don't have to sort them here and an binary search 
 	//-- for identifying if a object is in a leaf.
-
+	
 	mBvhStats.Reset();
 	mBvhStats.Start();
+
 	mBvhStats.nodes = 1;
-
+	mGlobalCostMisses = 0;
+	
 	// store pointer to this tree
 	BvhSubdivisionCandidate::sBvHierarchy = this;
-	mBvhStats.nodes = 1;
-	mGlobalCostMisses = 0;
-
+	
 	// compute bounding box from objects
 	// note: we assume that root was already created
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 1420)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp	(revision 1421)
@@ -4781,5 +4781,5 @@
 	GetRaySets(rays, mInitialSamples, constructionRays, &savedRays);
 
-	Debug << "initial rays: " << (int)constructionRays.size() << endl;
+	Debug << "initial rays used for construction: " << (int)constructionRays.size() << endl;
 	Debug << "saved rays: " << (int)savedRays.size() << endl;
 
@@ -4794,5 +4794,5 @@
 
 	// print subdivision statistics
-	Debug << endl << endl << mHierarchyManager << endl;
+	Debug << endl << endl << *mHierarchyManager << endl;
 	//mHierarchyManager->PrintHierarchyStatistics(Debug);
 
@@ -5583,7 +5583,5 @@
 
 	cout << "reseting pvs ... ";
-		
 	const bool startFromZero = true;
-
 
 	// reset pvs and start over from zero
@@ -5632,5 +5630,7 @@
 	mViewCellsTree->CollectLeaves(mViewCellsTree->GetRoot(), leaves);
 	float rc = 0;
+
 	ViewCellContainer::const_iterator vit, vit_end = leaves.end();
+	
 	for (vit = leaves.begin(); vit != vit_end; ++ vit)
 	{
@@ -5639,5 +5639,4 @@
 		float vol = vc->GetVolume();
 		rc += pvs * vol;
-
 	}
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp	(revision 1420)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Exporter.cpp	(revision 1421)
@@ -267,5 +267,5 @@
 		{
 		case Intersectable::TRIANGLE_INTERSECTABLE:
-			{cout << "y";
+			{
 				TriangleIntersectable *ti = dynamic_cast<TriangleIntersectable *>(obj);
 				polys.push_back(new Polygon3(ti->GetItem()));
@@ -273,9 +273,8 @@
 			}
 		case Intersectable::MESH_INSTANCE:
-			{cout << "x";
+			{
 				MeshInstance *mi = dynamic_cast<MeshInstance *>(obj);
 				ExportMesh(mi->GetMesh());
-				//polys.push_back(new Polygon3(ti->GetItem()));
-                break;
+				break;
 			}
 		default:
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp	(revision 1418)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/VspTree.cpp	(revision 1421)
@@ -359,4 +359,5 @@
 
 
+
 /*************************************************************************/
 /*                       class VspTree implementation                    */
@@ -367,5 +368,5 @@
 mRoot(NULL),
 mOutOfBoundsCell(NULL),
-mStoreRays(true),
+mStoreRays(false),
 mTimeStamp(1),
 mHierarchyManager(NULL)
@@ -566,5 +567,5 @@
 	if (0 && terminationCriteriaMet)
 	{
-		Debug << "globlal termination criteria met:" << endl;
+		Debug << "vsp global termination criteria met:" << endl;
 		Debug << "cost misses: " << mGlobalCostMisses << " " << mTermGlobalCostMissTolerance << endl;
 		Debug << "leaves: " << mVspStats.Leaves() << " " <<  mMaxViewCells << endl;
@@ -696,4 +697,5 @@
 		/////////////
 		//-- store pvs optained from rays
+
 		AddSamplesToPvs(leaf, *tData.mRays, sampCon, conSamp);
 
@@ -1295,5 +1297,5 @@
 	}
 	
-	
+	/////////	
 	//-- compute cost
 
@@ -1479,11 +1481,12 @@
 	// the render cost decrase for this split
 	const float renderCostDecrease = (oldRenderCost - newRenderCost) / viewSpaceVol;
-#ifdef _DEBUG
-	Debug << "\neval vsp render cost decrease" << endl
+
+//#ifdef _DEBUG
+	Debug << "\nvsp render cost decrease" << endl
 		  << "back pvs: " << pvsBack << " front pvs " << pvsFront << " total pvs: " << totalPvs << endl 
 		  << "back p: " << pBack / viewSpaceVol << " front p " << pFront / viewSpaceVol << " p: " << pOverall / viewSpaceVol << endl
 		  << "old rc: " << normalizedOldRenderCost << " new rc: " << newRenderCost / viewSpaceVol << endl
 		  << "render cost decrease: " << renderCostDecrease << endl;
-#endif
+//#endif
 	return renderCostDecrease;
 }
@@ -2681,8 +2684,9 @@
 
 	const int pvsSize = EvalPvsSize(rays);
-	//Debug <<  "pvs size: " << (int)pvsSize << endl;
-	//Debug <<  "rays size: " << (int)rays.size() << endl;
-
+	
+
+	//////////
 	//-- prepare view space partition
+
 	const float prop = mBoundingBox.GetVolume();
 	
@@ -2696,5 +2700,5 @@
 	// create first view cell
 	CreateViewCell(vData, false);
-		
+
 #if WORK_WITH_VIEWCELL_PVS
 	// add first view cell to all the objects view cell pvs
@@ -2709,5 +2713,6 @@
 #endif
 
-	//-- compute first split candidate
+	//////////////
+	//-- create the first split candidate
 
 	VspSubdivisionCandidate *splitCandidate = new VspSubdivisionCandidate(vData);
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/Triangle3.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/Triangle3.cpp	(revision 1420)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/Triangle3.cpp	(revision 1421)
@@ -100,5 +100,5 @@
   
 	const Vector3 pt = ray.GetLoc() + t * dir; 
-
+#if _DEBUG
 	if (!pt.CheckValidity())
 	{
@@ -106,5 +106,5 @@
 		cout << "v: " << pt << " t: " << t << " a: " << a << " b: " << b << " n: " << normal << endl;
 	}
-
+#endif
 	const Vector3 w = pt - mVertices[1];
 
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ObjParser.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ObjParser.cpp	(revision 1379)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ObjParser.cpp	(revision 1421)
@@ -211,28 +211,32 @@
 			{
 				cout << "f";
-#if CONNECT_SEQUENTIAL_FACES
-				Face *face = LoadFace(str, vertices, hashTable);
-				if (!face) break;
-	
-				faces.push_back(face);
-
-				if (faces.size() >= nMaxFaces)
+
+				if (loadMeshes)
 				{
-					ProcessMesh(faces, hashTable, root, parents);
+					Face *face = LoadFace(str, vertices, hashTable);
+					if (!face) break;
+	
+					faces.push_back(face);
+
+					if (faces.size() >= nMaxFaces)
+					{
+						ProcessMesh(faces, hashTable, root, parents);
+					}
 				}
-#else
-				Triangle3 triangle = LoadTriangle(str, vertices, hashTable);
+				else
+				{
+					Triangle3 triangle = LoadTriangle(str, vertices, hashTable);
 				
-				TriangleIntersectable *obj = new TriangleIntersectable(triangle);
-				root->mGeometry.push_back(obj);
-
-				// matt: we don't really need to keep an additional data structure
-				// if working with triangles => remove this
-				if (parents) 
-				{
-					FaceParentInfo info(obj, 0);
-					parents->push_back(info);
+					TriangleIntersectable *obj = new TriangleIntersectable(triangle);
+					root->mGeometry.push_back(obj);
+
+					// matt: we don't really need to keep an additional data structure
+					// if working with triangles => remove this
+					if (parents) 
+					{
+						FaceParentInfo info(obj, 0);
+						parents->push_back(info);
+					}
 				}
-#endif
 				break;
 			}   // end face
@@ -242,11 +246,13 @@
 	}
 
-#if CONNECT_SEQUENTIAL_FACES
-	// there could be faces remaining
-	if (!faces.empty())
-	{	
-		ProcessMesh(faces, hashTable, root, parents);
-	}
-#endif
+	if (loadMeshes)
+	{
+		// there could be faces remaining
+		if (!faces.empty())
+		{	
+			ProcessMesh(faces, hashTable, root, parents);
+		}
+	}
+
 	// reset tables
 	hashTable.clear();
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp	(revision 1420)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/HierarchyManager.cpp	(revision 1421)
@@ -34,8 +34,6 @@
 
 
-HierarchyManager::HierarchyManager(VspTree *vspTree, 
-								   const int objectSpaceSubdivisionType):
+HierarchyManager::HierarchyManager(const int objectSpaceSubdivisionType):
 mObjectSpaceSubdivisionType(objectSpaceSubdivisionType),
-mVspTree(vspTree), 
 mOspTree(NULL), 
 mBvHierarchy(NULL)
@@ -57,4 +55,5 @@
 
 	// hierarchy manager links view space partition and object space partition
+	mVspTree = new VspTree();
 	mVspTree->mHierarchyManager = this;
 	
@@ -63,7 +62,6 @@
 
 
-HierarchyManager::HierarchyManager(VspTree *vspTree, KdTree *kdTree): 
+HierarchyManager::HierarchyManager(KdTree *kdTree): 
 mObjectSpaceSubdivisionType(KD_BASED_OBJ_SUBDIV),
-mVspTree(vspTree), 
 mBvHierarchy(NULL)
 {
@@ -71,4 +69,5 @@
 	mOspTree->mVspTree = mVspTree;
 
+	mVspTree = new VspTree();
 	mVspTree->mHierarchyManager = this;
 
@@ -120,5 +119,5 @@
 {
 	DEL_PTR(mOspTree);
-	//DEL_PTR(mVspTree);
+	DEL_PTR(mVspTree);
 	DEL_PTR(mBvHierarchy);
 }
@@ -232,9 +231,18 @@
 bool HierarchyManager::GlobalTerminationCriteriaMet(SubdivisionCandidate *candidate) const
 {
-	return (0
+	const bool terminationCriteriaMet = 
+		(0
 		|| (mHierarchyStats.Leaves() >= mTermMaxLeaves) 
-		//|| (mGlobalCostMisses >= mTermGlobalCostMissTolerance)
-		||	candidate->GlobalTerminationCriteriaMet()
+		|| (mGlobalCostMisses >= mTermGlobalCostMissTolerance)
+		||(candidate->GlobalTerminationCriteriaMet())
 		);
+
+	if (0 && terminationCriteriaMet)
+	{
+		Debug << "hierarchy global termination criteria met:" << endl;
+		Debug << "leaves: " << mHierarchyStats.Leaves() << " " << mTermMaxLeaves << endl;
+		Debug << "cost misses: " << mGlobalCostMisses << " " << mTermGlobalCostMissTolerance << endl;
+	}
+	return terminationCriteriaMet;
 }
 
@@ -306,4 +314,7 @@
 		mVspTree->PrepareConstruction(sampleRays, *viewSpaceRays);
 
+	mTotalCost = mVspTree->mTotalCost;
+	Debug << "\nreseting cost, new total cost: " << mTotalCost << endl;
+
 	mTQueue.Push(vsc);
 }
@@ -328,5 +339,7 @@
 
 {
-	cout << "starting bv hierarchy construction ... " << endl;
+	const long startTime = GetTime();
+
+	cout << "preparing bv hierarchy construction ... " << endl;
 	mBvHierarchy->CreateRoot(objects);
 
@@ -339,4 +352,5 @@
 
     mTQueue.Push(sc);
+	cout << "finished bv hierarchy preparation in " << TimeDiff(startTime, GetTime()) * 1e-3 << " secs" << endl;
 }
 
@@ -357,5 +371,5 @@
 
 	mTotalCost = mOspTree->mTotalCost;
-	Debug << "reseting cost, new total cost: " << mTotalCost << endl;
+	Debug << "\nreseting cost, new total cost: " << mTotalCost << endl;
 	
     mTQueue.Push(osc);
@@ -739,8 +753,7 @@
 
 
-void HierarchyManager::PrintHierarchyStatistics(ofstream &stream) const
+void HierarchyManager::PrintHierarchyStatistics(ostream &stream) const
 {
 	stream << mHierarchyStats << endl;
-
 	stream << "\nview space:" << endl << endl;
 	stream << mVspTree->GetStatistics() << endl;
Index: /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp
===================================================================
--- /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp	(revision 1297)
+++ /GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp	(revision 1421)
@@ -621,5 +621,8 @@
 
 				mHierarchyManager = 
-					new HierarchyManager(mVspTree, HierarchyManager::KD_BASED_OBJ_SUBDIV);
+					new HierarchyManager(HierarchyManager::KD_BASED_OBJ_SUBDIV);
+
+				DEL_PTR(mHierarchyManager->mVspTree);
+				mHierarchyManager->mVspTree = mVspTree;
 
 				mObjectSpaceHierarchyType = OSP;
@@ -642,5 +645,8 @@
 				mObjectSpaceHierarchyType = BVH;
 				mHierarchyManager = 
-					new HierarchyManager(mVspTree, HierarchyManager::BV_BASED_OBJ_SUBDIV);
+					new HierarchyManager(HierarchyManager::BV_BASED_OBJ_SUBDIV);
+
+				DEL_PTR(mHierarchyManager->mVspTree);
+				mHierarchyManager->mVspTree = mVspTree;
 			}
 		}
@@ -905,9 +911,8 @@
 		}
 	}
-	//cout << "\nview space box: " << mViewSpaceBox << endl;
-}
-
-
-void ViewCellsParseHandlers::CreateViewCellsManager(/*const char *name*/)
+}
+
+
+void ViewCellsParseHandlers::CreateViewCellsManager()
 {
 	if (mViewSpaceHierarchyType == BSP)
@@ -920,5 +925,4 @@
 	{
 		Debug << "creating view cells manager: VspOsp" << endl;
-
 		// hack
 		mViewCellsManager = new VspOspViewCellsManager(mViewCellsTree, mHierarchyManager);
