make some changes to n-means algorithm, fix an issue with the histogram, and make a histogram script