adding hist code