Added basic distance func and distanceDisp func.