 	float rightNom = dot(_k2, camNormal);
 	rightNom = (rightNom > tolerance)? tolerance : ((rightNom < -tolerance) ? -tolerance :  rightNom);
 	float nominator = leftNom*rightNom;
-	return dominator / nominator;;
+	return (dominator / nominator);
 }
 
 // assuming we have weigths given foreach lambda in [380nm,700nm] with delta 1nm steps.
-float avgWeighted_XYZ_weight(lambda){
+vec3 avgWeighted_XYZ_weight(float lambda){
 	
 	float lambda_a = floor(lambda); // lower bound current lambda
 	float lambda_b = ceil(lambda); // upper bound current lambda
 	
 	// convex combination of a,b gives us the nearest weight for current:
 	// (L_b-L)f(L_b) + (L-L_a)f(L_a)
-	cie_XYZ_lambda_weight = (lambda_b - lambda)*brdf_weights[lambda_b] + (lambda - lambda_a)*brdf_weights[lambda_a];
+	
+	vec3 cie_XYZ_lambda_weight = (lambda_b - lambda)*brdf_weights[int(lambda_b)] + (lambda - lambda_a)*brdf_weights[int(lambda_a)];
 	return cie_XYZ_lambda_weight;
 }
 

// wave constants
const float lambda_min = 380.0*pow(10.0, -9.0);
const float lambda_max = 700.0*pow(10.0, -9.0);
const float dx = 2.5*pow(10.0, -6.0)

// error constants
const float eps_pq = 0.0001; 

				P = taylorApproximation(coords, k, w, s, w_u, w_v);
				float abs_P_Sq = P.x*P.x + P.y*P.y;
				
				float diffractionCoeff = getFactor(k, F, G, PI, w);			
				vec4 waveColor = vec4(avgWeighted_XYZ_weight(lambda_iter), 1.0); // fix me pls QQ => brdf weights has to be increased and exported to a function- find nearest color
				brdf += vec4(diffractionCoeff * abs_P_Sq * waveColor);
				maxBRDF += vec4(diffractionCoeff * brdfMax * waveColor);
			}
		}
	}
