Working on the dist function.