added functions for computing distortion and L2 distortion