Changed distance to absolute value of the distance