Misc
Optimized computing the similarities so that the same values are not computed two times.