Logging of feature histograms, cleaning of distances for clustering