added the distance matrices