diff --git a/GoogleCardboardAndroid/NOMADgvrT/src/main/jni/treasure_hunt_renderer.cc b/GoogleCardboardAndroid/NOMADgvrT/src/main/jni/treasure_hunt_renderer.cc
index b3022872769e50a4b4c74b2084a701eb77c61215..984fc80920811497d47cf6a46054c56b4da37a35 100644
--- a/GoogleCardboardAndroid/NOMADgvrT/src/main/jni/treasure_hunt_renderer.cc
+++ b/GoogleCardboardAndroid/NOMADgvrT/src/main/jni/treasure_hunt_renderer.cc
@@ -56,7 +56,7 @@ void eprintf( const char *fmt, ... )
 	vsprintf( buffer, fmt, args );
 	va_end( args );
 
-	LOGD("Error in NOMADgvrT");
+	LOGD("Message in NOMADgvrT");
 	if (*fmt=='\0')
 		LOGD("Empty format");
 	LOGD("<%s>", buffer);
@@ -66,6 +66,39 @@ void eprintf( const char *fmt, ... )
 
 
 namespace {
+
+
+gvr::Mat4f TranslationMatrix (float x, float y, float z) 
+{
+gvr::Mat4f mvs;
+mvs.m[0][0]=1;mvs.m[0][1]=0;mvs.m[0][2]=0; mvs.m[0][3]=x;
+mvs.m[1][0]=0;mvs.m[1][1]=1;mvs.m[1][2]=0;mvs.m[1][3]=y;
+mvs.m[2][0]=0;mvs.m[2][1]=0;mvs.m[2][2]=1; mvs.m[2][3]=z;
+mvs.m[3][0]=0;mvs.m[3][1]=0;mvs.m[3][2]=0; mvs.m[3][3]=1;
+return mvs;
+}
+
+gvr::Mat4f TranslationMatrix (float v[3]) 
+{
+return TranslationMatrix (v[0], v[1], v[2]);
+}
+
+gvr::Mat4f ScalingMatrix (float x, float y, float z) 
+{
+gvr::Mat4f mvs;
+
+mvs.m[0][0]=x;mvs.m[0][1]=0;mvs.m[0][2]=0; mvs.m[0][3]=0;
+mvs.m[1][0]=0;mvs.m[1][1]=y;mvs.m[1][2]=0;mvs.m[1][3]=0;
+mvs.m[2][0]=0;mvs.m[2][1]=0;mvs.m[2][2]=z; mvs.m[2][3]=0;
+mvs.m[3][0]=0;mvs.m[3][1]=0;mvs.m[3][2]=0; mvs.m[3][3]=1;
+return mvs;
+}
+
+gvr::Mat4f ScalingMatrix (float v[3]) 
+{
+return ScalingMatrix(v[0], v[1], v[2]);
+}
+
 //static const float kZNear = 1.0f;
 //static const float kZFar = 100.0f;
 static const float kZNear = 0.01f;
@@ -343,6 +376,10 @@ void TreasureHuntRenderer::loadConfigFile(void)
 		LOGD("No atom glyph specified, using Icosahedron");
 		solid=new Solid(Solid::Type::Icosahedron);
 	}
+	for (int i=0;i<3;i++)
+		UserTranslation[i]=userpos[i];
+
+//	LOGD("UT=%f, %f, %f\n", UserTranslation[0], UserTranslation[1], UserTranslation[2]);
 }
 
 TreasureHuntRenderer::TreasureHuntRenderer(
@@ -355,6 +392,8 @@ TreasureHuntRenderer::TreasureHuntRenderer(
 	loadConfigFile();
 	//eprintf("after config load, timesteps=%d", TIMESTEPS);
 	
+
+
   ResumeControllerApiAsNeeded();
   if (gvr_viewer_type_ == GVR_VIEWER_TYPE_CARDBOARD) {
     LOGD("Viewer type: CARDBOARD");
@@ -506,26 +545,43 @@ glGenTextures(2+ZLAYERS, textDepthPeeling);
 		for (int p = 0; p < TIMESTEPS*ISOS; p++) {
 			sprintf(tmpname, "%s%d-%s.ply", PATH, timestep, 
 				plyfiles[p % ISOS]);
-			gvr::Mat4f trans, matFinal;
+			gvr::Mat4f trans;
+			gvr::Mat4f matFinal, matcubetrans, mvs, sc, sctrans;
 //rotateX(-90)
+		if (voxelSize[0]!=-1) {
+			mvs=ScalingMatrix(scaling/(float)voxelSize[0], scaling/(float)voxelSize[1],
+				scaling/(float)voxelSize[2]);
+			matcubetrans=TranslationMatrix(cubetrans);
+			gvr::Mat4f abcm {abc[0][0], abc[0][1], abc[0][2], 0,
+					abc[1][0], abc[1][1], abc[1][2], 0,
+					abc[2][0], abc[2][1], abc[2][2], 0,
+					0, 0, 0, 1};
+			sc=ScalingMatrix(supercell);
+			sctrans=TranslationMatrix(-translations[p%ISOS][2], 
+					-translations[p%ISOS][1], -translations[p%ISOS][0]);
+			matFinal = MatrixMul(abcm,sctrans);
+			matFinal=MatrixMul(matFinal,sc);
+			matFinal=MatrixMul(matFinal,mvs);
+		} else {
 			trans.m[0][0]=1;trans.m[0][1]=0;trans.m[0][2]=0; trans.m[0][3]=0;
 			trans.m[1][0]=0;trans.m[1][1]=0;trans.m[1][2]=1;trans.m[1][3]=0;
 			trans.m[2][0]=0;trans.m[2][1]=-1;trans.m[2][2]=0; trans.m[2][3]=0;
 			trans.m[3][0]=0;trans.m[3][1]=0;trans.m[3][2]=0; trans.m[3][3]=1;
 
 			for (int i=0;i<4;i++)
-					for(int j=0;j<4;j++)
+				for(int j=0;j<4;j++)
 					matFinal.m[i][j]=(i==j);
 			for (int i=0;i<3;i++)
 				matFinal.m[i][3]=translations[p%ISOS][i];
 
 			matFinal=MatrixMul(trans, matFinal);
 
-			trans.m[0][0]=0.2;trans.m[0][1]=0;trans.m[0][2]=0; trans.m[0][3]=0;
-			trans.m[1][0]=0;trans.m[1][1]=0.2;trans.m[1][2]=0;trans.m[1][3]=0; 
-			trans.m[2][0]=0;trans.m[2][1]=0;trans.m[2][2]=0.2; trans.m[2][3]=0;
+			trans.m[0][0]=scaling;trans.m[0][1]=0;trans.m[0][2]=0; trans.m[0][3]=0;
+			trans.m[1][0]=0;trans.m[1][1]=scaling;trans.m[1][2]=0;trans.m[1][3]=0; 
+			trans.m[2][0]=0;trans.m[2][1]=0;trans.m[2][2]=scaling; trans.m[2][3]=0;
 			trans.m[3][0]=0;trans.m[3][1]=0;trans.m[3][2]=0; trans.m[3][3]=1;
 			matFinal=MatrixMul(trans, matFinal);
+		}
 			float mat[16];
 			for (int i=0;i<4;i++)
 				for (int j=0;j<4;j++)
@@ -613,7 +669,17 @@ void TreasureHuntRenderer::DrawFrame() {
   }
 
 //	if (animateTimesteps) {
-		currentSet++;
+
+	if (animationspeed>1)
+		currentSet+=animationspeed;
+	else {
+		static float current=0;
+		current+=animationspeed;
+		if (current>1) {
+			currentSet++;
+			current=0;
+		}
+	}
             if (currentSet>TIMESTEPS-1)
                 currentSet=0;
 //	}
@@ -638,9 +704,13 @@ if (animateTimesteps) {
 	float il=1.0/sqrtf(dir2[0]*dir2[0]+dir2[1]*dir2[1]+dir2[2]*dir2[2]);
 	//dir2[2]=-dir2[2];
 	for (int i=0;i<3;i++)
-		UserTranslation[i]+=dir2[i]*il*speed;
+		UserTranslation[i]+=dir2[i]*il*speed*movementspeed;
 }
 
+
+	LOGD("UT=%f, %f, %f\n", UserTranslation[0], UserTranslation[1], UserTranslation[2]);
+LOGD("MovementSpeed=%f\n", movementspeed);
+
   gvr::Mat4f left_eye_matrix = gvr_api_->GetEyeFromHeadMatrix(GVR_LEFT_EYE);
   gvr::Mat4f right_eye_matrix = gvr_api_->GetEyeFromHeadMatrix(GVR_RIGHT_EYE);
   gvr::Mat4f left_eye_view = MatrixMul(left_eye_matrix, head_view_);
@@ -813,53 +883,26 @@ if (curDataPos!=ISOS) {
 	glBindVertexArray(ISOVAO[currentSet*ISOS+curDataPos]);
 	if ((e = glGetError()) != GL_NO_ERROR)
 		eprintf("3 Gl error RenderIsos timestep =%d: %d\n", currentSet, e);
-	eprintf ("Drawing %d vertices, isos", numISOIndices[currentSet*ISOS+curDataPos]);
+	//eprintf ("Drawing %d vertices, isos", numISOIndices[currentSet*ISOS+curDataPos]);
 	glDrawElements(GL_TRIANGLES,numISOIndices[currentSet*ISOS+curDataPos] , GL_UNSIGNED_INT, 0);
 	if ((e = glGetError()) != GL_NO_ERROR)
 		eprintf("4 Gl error RenderIsos timestep =%d: %d\n", currentSet, e);
 } else {
-//transparency; FIXME disabled as I get 1fps, with screen in 4 columns and z-check is incorrect
-/*
-	glDisable(GL_BLEND);
-	glDepthMask(GL_TRUE);
-	//do depth peeling
-	CleanDepthTexture(textDepthPeeling[0], render_size_.width, render_size_.height);
-	GLint dfb;
-	glGetIntegerv(GL_DRAW_FRAMEBUFFER_BINDING, &dfb);
-if ((e = glGetError()) != GL_NO_ERROR)
-	eprintf("Gl error RenderIsos, before zl loop: %d\n", e);
-	for (int zl = 0; zl < ZLAYERS; zl++) {
-		EnableDepthFB(zl, TransP, 
-			peelingFramebuffer, textDepthPeeling);
-		glUniformMatrix4fv(TransMatrixLoc, 1, GL_FALSE, t);
-		for (int i=0;i<ISOS;i++) {
-			glBindVertexArray(ISOVAO[currentSet*ISOS+i]);
-			glDrawElements(GL_TRIANGLES,numISOIndices[currentSet*ISOS+i] , GL_UNSIGNED_INT, 0);	
-		}
-	}
-	glUseProgram(BlendP);
-	glBindFramebuffer(GL_FRAMEBUFFER, dfb);
-	glBindVertexArray(BlendVAO);
-if ((e = glGetError()) != GL_NO_ERROR)
-	eprintf("Gl error RenderIsos, after glBindVertexArray: %d\n", e);
-	BlendTextures(textDepthPeeling, ZLAYERS);
-	glBindVertexArray(0);
-if ((e = glGetError()) != GL_NO_ERROR)
-	eprintf("Gl error RenderIsos, after BlendTextures: %d\n", e);*/
-/* no transparency*/
+/*transparency*/
 	glEnable(GL_BLEND);
 	glBlendFunc(GL_SRC_ALPHA, GL_ONE);
 	glDepthMask(GL_FALSE);
 	for (int i=0;i<ISOS;i++) {
 		glBindVertexArray(ISOVAO[currentSet*ISOS+i]);
-	if ((e = glGetError()) != GL_NO_ERROR)
-		eprintf("5 Gl error RenderIsos timestep =%d: %d\n", currentSet, e);
-		eprintf ("Drawing %d vertices, isos", numISOIndices[currentSet*ISOS+i]);
+		if ((e = glGetError()) != GL_NO_ERROR)
+			eprintf("5 Gl error RenderIsos timestep =%d: %d\n", currentSet, e);
+		//eprintf ("Drawing %d vertices, isos", numISOIndices[currentSet*ISOS+i]);
 		glDrawElements(GL_TRIANGLES,numISOIndices[currentSet*ISOS+i] , GL_UNSIGNED_INT, 0); 
-	if ((e = glGetError()) != GL_NO_ERROR)
-		eprintf("6 Gl error RenderIsos timestep =%d: %d\n", currentSet, e);
+		if ((e = glGetError()) != GL_NO_ERROR)
+			eprintf("6 Gl error RenderIsos timestep =%d: %d\n", currentSet, e);
 	}
 	glDisable(GL_BLEND);
+	glDepthMask(GL_TRUE);
 } //if (curDataPos!=ISOS) 
 //eprintf ("end of RenderIsos");
 glBindVertexArray(0);
@@ -962,15 +1005,14 @@ void TreasureHuntRenderer::RenderAtoms(const float *m) //m[16]
 	} // no tess
 }
 
+
+
 void TreasureHuntRenderer::RenderAtomTrajectories(const gvr::Mat4f eyeViewProjection)
 {
 int e;
 if (!numAtoms)
 	return;
-gvr::Mat4f trans={1,0,0,UserTranslation[0],
-		0,1,0,UserTranslation[1],
-		0,0,1,UserTranslation[2],
-		0,0,0,1};
+gvr::Mat4f trans=TranslationMatrix (UserTranslation);
 					
 //trans.translate(iPos).rotateX(-90).translate(UserPosition);
 gvr::Mat4f transform = MatrixMul(eyeViewProjection,trans);
diff --git a/NOMADVRLib/ConfigFile.cpp b/NOMADVRLib/ConfigFile.cpp
index 549af326797f09b289d8b6eabc3de93bc3f0bf96..c81afb7f2735bac17d6c5d08c6a290a47f316d66 100644
--- a/NOMADVRLib/ConfigFile.cpp
+++ b/NOMADVRLib/ConfigFile.cpp
@@ -28,6 +28,9 @@ std::vector<float> *clonedAtoms;
 std::vector<int> bonds;
 int *numBonds;
 bool displaybonds;
+float bondscolours[4];
+float atomtrajectorycolour[4];
+
 int numClonedAtoms;
 int *basisvectorreps;
 
@@ -40,6 +43,8 @@ bool has_abc = false;
 bool displayunitcell;
 float supercell[3];
 int voxelSize[3];
+float unitcellcolour[4];
+float supercellcolour[4];
 
 int repetitions[3];
 Solid *solid;
@@ -48,6 +53,10 @@ bool saveStereo;
 int screenshotdownscaling;
 bool hapticFeedback;
 bool showcontrollers;
+bool gazenavigation;
+int transparencyquality;
+float nearclip, farclip;
+
 
 //markers such as hole positions and electron positions
 float ** markers;
@@ -135,14 +144,9 @@ while (*file!='\0') {
 }
 }
 
-int loadConfigFile(const char * f)
+void initState()
 {
-	//default values
-	//eprintf ("load config file start");
-	bool nonperiodic=false;
-	char base_url[1024]="http://enc-testing-nomad.esc.rzg.mpg.de/v1.0/materials/";
-	char material[1024]="";
-	BACKGROUND[0] = 0.95f;
+		BACKGROUND[0] = 0.95f;
 	BACKGROUND[1] = 0.95f;
 	BACKGROUND[2] = 0.95f;
 	SCREENSHOT="C:\\temp\\frame";
@@ -166,7 +170,7 @@ int loadConfigFile(const char * f)
 	for (int i=0;i<3;i++)
 		supercell[i] = 1;
 	solid=0;
-	char *token=0;
+
 	markers=nullptr;
 	markercolours=nullptr;
 	displayunitcell=false;
@@ -181,7 +185,42 @@ int loadConfigFile(const char * f)
 	screenshotdownscaling=1;
 	hapticFeedback=false;
 	showcontrollers=false;
+	gazenavigation=false;
 	inv_abc_init=false;
+
+	transparencyquality=12;
+	nearclip=0.2f;
+	farclip=200.f;
+
+	for (int i=0;i<4;i++)
+		unitcellcolour[i]=1.0f;
+	
+	supercellcolour[0]=0.0f;
+	supercellcolour[1]=1.0f;
+	supercellcolour[2]=1.0f;
+	supercellcolour[3]=1.0f;
+
+	bondscolours[0]=0.5f;
+	bondscolours[1]=0.5f;
+	bondscolours[2]=1.0f;
+	bondscolours[3]=1.0f;
+
+	atomtrajectorycolour[0]=1.0f;
+	atomtrajectorycolour[1]=0.0f;
+	atomtrajectorycolour[2]=0.0f;
+	atomtrajectorycolour[3]=1.0f;
+}
+
+int loadConfigFile(const char * f)
+{
+	//default values
+	//eprintf ("load config file start");
+	bool nonperiodic=false;
+	char base_url[1024]="http://enc-testing-nomad.esc.rzg.mpg.de/v1.0/materials/";
+	char material[1024]="";
+	initState();
+	char *token=0;
+
 	//
 	FILE *F = fopen(f, "r");
 	if (F == 0)
@@ -499,11 +538,39 @@ int loadConfigFile(const char * f)
 			hapticFeedback=true;
 		} else if (!strcmp (s, "supercell")) {
 			r=fscanf (F, "%f %f %f", supercell, supercell+1, supercell+2);
+			if (r<3)
+				eprintf ("Error reading supercell value");
 		} else if (!strcmp (s, "showcontrollers")) { 
 			showcontrollers=true;
-		} else if (!strcmp (s, "\x0d")) { //discard windows newline (problem in Sebastian Kokott's phone (?!)
+		} else if (!strcmp (s, "gazenavigation")) { 
+			gazenavigation=true;
+		}else if (!strcmp (s, "\x0d")) { //discard windows newline (problem in Sebastian Kokott's phone (?!)
 			continue;
-		} else {
+		} else if (!strcmp (s, "transparencyquality")) {
+			r=fscanf (F, "%d", &transparencyquality);
+			if (r<1)
+				eprintf ("Error reading transparencyquality value");
+		} else if (!strcmp (s, "clippingplanes")) {
+			r=fscanf (F, "%f %f", &nearclip, &farclip);
+			if (r<2)
+				eprintf ("Error reading clippingplanes values");
+		}else if (!strcmp (s, "bondscolour")) {
+			r=fscanf (F, "%f %f %f", bondscolours, bondscolours+1, bondscolours+2);
+			if (r<3)
+				eprintf ("Error reading bondscolour value");
+		}else if (!strcmp (s, "unitcellcolour")) {
+			r=fscanf (F, "%f %f %f", unitcellcolour, unitcellcolour+1, unitcellcolour+2);
+			if (r<3)
+				eprintf ("Error reading unitcellcolour value");
+		}else if (!strcmp (s, "supercellcolour")) {
+			r=fscanf (F, "%f %f %f", supercellcolour, supercellcolour+1, supercellcolour+2);
+			if (r<3)
+				eprintf ("Error reading supercellcolour value");
+		}else if (!strcmp (s, "atomtrajectorycolour")) {
+			r=fscanf (F, "%f %f %f", atomtrajectorycolour, atomtrajectorycolour+1, atomtrajectorycolour+2);
+			if (r<3)
+				eprintf ("Error reading atomtrajectorycolour value");
+		}else {
 			eprintf( "Unrecognized parameter %s\n", s);
 			for (int i=0;i<strlen(s);i++)
 				eprintf ("<%d>", s[i]);
diff --git a/NOMADVRLib/ConfigFile.h b/NOMADVRLib/ConfigFile.h
index 42b45cd16ca3aad33a61b5abf3739e944acd66cc..55758ecc73670fe669a3684aa936ea95cf85dd79 100644
--- a/NOMADVRLib/ConfigFile.h
+++ b/NOMADVRLib/ConfigFile.h
@@ -22,6 +22,9 @@ extern std::vector<float> *clonedAtoms;
 extern std::vector<int> bonds;
 extern int *numBonds;
 extern bool displaybonds;
+extern float bondscolours[4];
+extern float atomtrajectorycolour[4];
+
 extern int numClonedAtoms;
 extern int *basisvectorreps;
 
@@ -34,6 +37,8 @@ extern bool has_abc;
 extern bool displayunitcell;
 extern float supercell[3];
 extern float markerscaling;
+extern float unitcellcolour[4];
+extern float supercellcolour[4];
 
 extern int repetitions[3];
 
@@ -44,6 +49,10 @@ extern int screenshotdownscaling;
 
 extern bool hapticFeedback;
 extern bool showcontrollers;
+extern bool gazenavigation;
+
+extern int transparencyquality;
+extern float nearclip, farclip;
 
 //markers such as hole positions and electron positions
 extern float ** markers;
diff --git a/OpenVR/TimestepData/hellovr_opengl_main.cpp b/OpenVR/TimestepData/hellovr_opengl_main.cpp
index 2061fd9bd86bbdb56b55e31bbe9ba98cd316f3d7..7d5bf7bab8eda8776e9b0a02dab8393ab125dd03 100644
--- a/OpenVR/TimestepData/hellovr_opengl_main.cpp
+++ b/OpenVR/TimestepData/hellovr_opengl_main.cpp
@@ -55,7 +55,7 @@
 //#define PATH "C:\\Users\\mobile\\Desktop\\openvrDemos\\win64\\data\\CO2-CaO-B\\"
 #endif
 */
-#define ZLAYERS 12
+#define ZLAYERS transparencyquality
 
 
 
@@ -207,9 +207,6 @@ private: // OpenGL bookkeeping
 
 	int m_iSceneVolumeInit;                                  // if you want something other than the default 20x20x20
 
-	float m_fNearClip;
-	float m_fFarClip;
-
 	void SaveScreenshot (char *name);
 
 	GLuint *m_iTexture; //[3+ZLAYERS+1] // white, depth1, depth2, color[ZLAYERS], atomtexture
@@ -347,7 +344,7 @@ void eprintf( const char *fmt, ... )
 	if (numerrors==25) {
 		MessageBoxA(0, "Max messages reached, no further reporting", "Warning", 0);
 	}
-	if (numerrors>15) {
+	if (numerrors>25) {
 		return;
 	}
 	va_list args;
@@ -592,13 +589,10 @@ bool CMainApplication::BInit()
  	m_iSceneVolumeHeight = m_iSceneVolumeInit;
  	m_iSceneVolumeDepth = m_iSceneVolumeInit;
  		
-	m_fScale = 0.04f; //0.15f; //rgh: original too big for room
+	//m_fScale = 0.04f; //0.15f; //rgh: original too big for room
+	m_fScale=scaling;
  	m_fScaleSpacing = 4.0f;
  
- 	m_fNearClip = 0.2f;
- 	m_fFarClip = 200.0f;//rgh: original 30 too small for our skymap
- 
-
  
 // 		m_MillisecondsTimer.start(1, this);
 // 		m_SecondsTimer.start(1000, this);
@@ -996,8 +990,16 @@ bool CMainApplication::HandleInput()
 				else if (unDevice !=firstdevice && seconddevice==-1)
 					seconddevice=unDevice;
 				if (unDevice == firstdevice) {
-					Matrix4 tmp = m_mat4HMDPose;
-					UserPosition += tmp.invert()*Vector3(0, 0, speed);
+					if (gazenavigation) {
+						Matrix4 tmp = m_mat4HMDPose;
+						UserPosition += tmp.invert()*Vector3(0, 0, speed);
+					} else {
+						//vr::VRControllerState_t cs;
+						//vr::TrackedDevicePose_t dp;
+						//m_pHMD->GetControllerStateWithPose( vr::TrackingUniverseStanding, firstdevice, &cs, &dp );
+						const Matrix4 tmp = m_rmat4DevicePose[firstdevice];
+						UserPosition += tmp*Vector3(0, 0, speed);	
+					}
 				}
 				else {
 					float newtime = videospeed*float(SDL_GetTicks());;
@@ -2160,8 +2162,8 @@ void CMainApplication::RenderUnitCell(const vr::Hmd_Eye &nEye)
 					glUniformMatrix4fv(m_nUnitCellMatrixLocation, 1, GL_FALSE, transform.get());
 					if ((e = glGetError()) != GL_NO_ERROR)
 						dprintf("Gl error after glUniform4fv 1 RenderUnitCell: %d, %s\n", e, gluErrorString(e));
-					const float color[4]={1,1,1,1};
-					glUniform4fv(m_nUnitCellColourLocation, 1, color);
+					
+					glUniform4fv(m_nUnitCellColourLocation, 1, unitcellcolour);
 					if ((e = glGetError()) != GL_NO_ERROR)
 						dprintf("Gl error after glUniform4fv 2 RenderUnitCell: %d, %s\n", e, gluErrorString(e));
 					glDrawElements(GL_LINES, 24, GL_UNSIGNED_INT, 0);
@@ -2179,8 +2181,7 @@ void CMainApplication::RenderUnitCell(const vr::Hmd_Eye &nEye)
 	glUniformMatrix4fv(m_nUnitCellMatrixLocation, 1, GL_FALSE, transform.get());
 	if ((e = glGetError()) != GL_NO_ERROR)
 		dprintf("Gl error after glUniform4fv 1 RenderUnitCell, supercell: %d, %s\n", e, gluErrorString(e));
-	const float colorsc[4]={0,1,1,1};
-	glUniform4fv(m_nUnitCellColourLocation, 1, colorsc);
+	glUniform4fv(m_nUnitCellColourLocation, 1, supercellcolour);
 	glDrawElements(GL_LINES, 24, GL_UNSIGNED_INT, (void*) (24 *sizeof(int)));
 	glDisable(GL_LINE_SMOOTH);
 glBindVertexArray(0);
@@ -2240,8 +2241,7 @@ if (numBonds && displaybonds && showAtoms) {
 	glBindVertexArray(m_unAtomVAO[2]);
 	glUseProgram(m_unUnitCellProgramID);
 	glUniformMatrix4fv(m_nUnitCellMatrixLocation, 1, GL_FALSE, transform.get());
-	float color[4]={0.5,0.5,1,1};
-	glUniform4fv(m_nUnitCellColourLocation, 1, color);
+	glUniform4fv(m_nUnitCellColourLocation, 1, bondscolours);
 	if (currentset==0||fixedAtoms)
 		glDrawElements(GL_LINES, numBonds[0],  GL_UNSIGNED_INT, (void*)0);
 	else
@@ -2282,8 +2282,8 @@ for (int i = 0; i < atomtrajectories.size(); i++) {
 glBindVertexArray(m_unAtomVAO[3]);
 glUseProgram(m_unUnitCellProgramID);
 glUniformMatrix4fv(m_nUnitCellMatrixLocation, 1, GL_FALSE, transform.get());
-float color2[4]={1,0,0,1};
-glUniform4fv(m_nUnitCellColourLocation, 1, color2);
+
+glUniform4fv(m_nUnitCellColourLocation, 1, atomtrajectorycolour);
 
 if ((e = glGetError()) != GL_NO_ERROR)
 	dprintf("Gl error after glUniform4fv 2 RenderUnitCell: %d, %s\n", e, gluErrorString(e));
@@ -2419,7 +2419,7 @@ void CMainApplication::RenderScene(vr::Hmd_Eye nEye)
 				dprintf("Gl error after zlayer: %d, %s\n", e, gluErrorString(e));
 
 			glDisable(GL_CULL_FACE);
-			float z = 0.0f; //(m_fNearClip + m_fFarClip) / 2.0f;
+			float z = 0.0f; 
 			const float points[] = {
 				-1, -1, z, 1, 0, 0, -1, 0, 0,
 				-1, 1, z, 1, 0, 0, -1, 0, 1,
@@ -2567,7 +2567,7 @@ Matrix4 CMainApplication::GetHMDMatrixProjectionEye( vr::Hmd_Eye nEye )
 	if ( !m_pHMD )
 		return Matrix4();
 
-	vr::HmdMatrix44_t mat = m_pHMD->GetProjectionMatrix( nEye, m_fNearClip, m_fFarClip, vr::API_OpenGL);
+	vr::HmdMatrix44_t mat = m_pHMD->GetProjectionMatrix( nEye, nearclip, farclip, vr::API_OpenGL);
 
 	return Matrix4(
 		mat.m[0][0], mat.m[1][0], mat.m[2][0], mat.m[3][0],