Updated intersect function so that it returns boolean and passes pointer to t