Work on R side of things for new distance stuff