reduce duplicate codes
generate histogram