updated DTW test and function