Refactor PathTracer