Did some refactoring. Add Raytracing functions