renamed distance to dist