add distance dict, simpler distance function calls