small changes in raytracing procedure