Refactor and debug 3D intersection class