added median absolute distance
added median absolute distance