Added intersection comparator instead of janky while loop