Modified similarity calculation