Implemented findClosestIntersection function and cleaned up calculateColor input