slow but correct distance metrics