updated blending code