Add distance from durations frequency
Use general functions and template for frequency distance
Add distance from contours frequency