Add sorted for historgram output and read data