Can pass distance function to dtw