Ray and parts of util.cpp