refactored computation of proximity matrices in a separate file