Changes in similarity functions, two new functions, test