Add histogramming (#13), also fix parsing issues #16 and #17