changes in the dist function + addition of the normalized xcorrelation metric