Refactored similarity measures