improved histogram
added diff mode to detect_duplicates
multipass for different orderings
fixed broken pipe error in stats