Adapting the templates and conditions for histograms