Use matrices to store distances.
Clean UP tactics