added some distance matrix helpers