added distance function and rounding to 6 places