Added sphere intersect function