Refactoring demo code. Adding the code computing similarity scores