more work on scalable version, and fix for remembering distances, so repeated runs of same level-dist metric go faster