Improved distance metric