fixing edge distance calculation. not done yet