added distance matrix