refactored similarity measures