added a distance based choice of k in unknownthru,