mchmara: Added DistCalculator and modified Grid(ArrayGrid).