 
 
         legion::ONB onb( p.shading_normal );
-        float3 H = onb.inverseTransform( make_float3( x, y, z ) );
+        const float3 H    = onb.inverseTransform( make_float3( x, y, z ) );
+        sample.w_in       = optix::reflect( -w_out, H );
         
-        sample.w_in = optix::reflect( -w_out, H );
-        
-        const float3 N = p.shading_normal;
-        const float  diffuse_pdf  = diffusePDF( w_out, N, sample.w_in );
-        const float  specular_pdf = specularPDF( w_out, N, sample.w_in );
-        sample.pdf = optix::lerp( specular_pdf, diffuse_pdf, diffuse_weight );
-
-        const float3 diff_val = diffuseEval( w_out, N, sample.w_in );
-        const float3 spec_val = specularEval( w_out, N, sample.w_in );
+        const float3 N    = p.shading_normal;
+        const float4 ward = wardEvalPDF( w_out, N, sample.w_in, diffuse_weight);
+        sample.pdf        = ward.w;
         sample.f_over_pdf = sample.pdf > 0.00001f            ? 
-                            (diff_val+spec_val) / sample.pdf :
+                            make_float3( ward )/ sample.pdf  :
                             make_float3( 0.0f );
         sample.is_specular  = 1u; 
-
     }
         
     return sample;

        else if (xi1 < 0.5f)
        {
            xi1 = 4.0f * (xi1 - 0.25f);
            phi_h = legion::PI - atanf(alpha_v * tanf(0.5f * legion::PI * xi1) / alpha_u);
        }
        else if (xi1 < 0.75f)
        {
            xi1 = 4.0f * (xi1 - 0.5f);
            phi_h = legion::PI + atanf(alpha_v * tanf(0.5 * legion::PI * xi1) / alpha_u);
        }
        else
        {
            xi1 = 4.0f * (xi1 - 0.75f);
            phi_h = legion::PI*2.0f - atanf(alpha_v * tanf( 0.5f * legion::PI * xi1) / alpha_u);
        }

        float cos_phi_h = cosf( phi_h );

    const float3 H           = optix::normalize( w_out + w_in );
    const float  inv_alpha_u = 1.0f / alpha_u;
    const float  inv_alpha_v = 1.0f / alpha_v;
    const float  spec_coeff = 
        cos_in * legion::ONE_DIV_PI *
        0.25f * inv_alpha_u * inv_alpha_v / sqrtf( cos_in*cos_out ) *
        wardExpTerm( inv_alpha_u, inv_alpha_v, H, onb );

    return spec_coeff * spec_reflectance;
}
