added comparison to all pairs