Comments and changes for calculating similarity