added distance measurement