Drop self-comparisons

This is split from #132.