parsing header, histograms, and map