Reorganized hist code. Started stats code.