[new] Added distance function