Working stats script with histogram