Simplified sameOrNotCollides function