rewrite pathTracer