Add distance calculation, projection inversion