diff --git a/src/Analyses/Makefile.am b/src/Analyses/Makefile.am
--- a/src/Analyses/Makefile.am
+++ b/src/Analyses/Makefile.am
@@ -1,474 +1,475 @@
 ## Flags for building all plugins
 AM_LDFLAGS = $(LDFLAGS) -module -avoid-version -L$(FASTJETLIBPATH)
 LIBS = $(FASTJETCONFIGLIBADD)
 lib_LTLIBRARIES =
 noinst_LTLIBRARIES =
 
 
 
 if ENABLE_ANALYSES
 
 ##noinst_LTLIBRARIES += libRivetAnalysisTools.la
 ##libRivetAnalysisTools_la_SOURCES = \
-    ##bookScatter2D MC_ParticleAnalysis.cc \
-    ##bookScatter2D MC_JetAnalysis.cc \
-    ##bookScatter2D MC_JetSplittings.cc
+    ##bookScatter2D ##libAnalysisTools MC_ParticleAnalysis.cc \
+    ##bookScatter2D ##libAnalysisTools MC_JetAnalysis.cc \
+    ##bookScatter2D ##libAnalysisTools MC_JetSplittings.cc
 
 
 lib_LTLIBRARIES += RivetALICEAnalyses.la
 RivetALICEAnalyses_la_SOURCES = \
     ALICE_2010_S8624100.cc \
     ALICE_2010_S8625980.cc \
     ALICE_2010_S8706239.cc \
     ##bookScatter2D ALICE_2011_S8909580.cc \
     ALICE_2011_S8945144.cc \
     ##bookScatter2D ALICE_2012_I1181770.cc \
     ALICE_2014_I1300380.cc 
     ##\
     ##bookScatter2D ALICE_2015_I1357424.cc
 
 
 lib_LTLIBRARIES += RivetATLASAnalyses.la
 RivetATLASAnalyses_la_SOURCES = \
     ATLAS_2010_S8591806.cc \
     ##BinnedHisto ATLAS_2010_S8817804.cc \
     ##bookScatter2D ATLAS_2010_S8894728.cc \
     ATLAS_2010_S8914702.cc \
     ATLAS_2010_S8918562.cc \
     ATLAS_2010_S8919674.cc \
     ATLAS_2011_S8924791.cc \
     ##BinnedHisto ATLAS_2011_S8971293.cc \
     ATLAS_2011_S8994773.cc \
     ##BinnedHisto ATLAS_2011_S8983313.cc \
     ##bookScatter2D ATLAS_2011_S9002537.cc \
     ATLAS_2011_S9120807.cc \
     ##BinnedHisto ##bookScatter2D ATLAS_2011_S9126244.cc \
     ##bookScatter2D ATLAS_2011_S9128077.cc \
     ATLAS_2011_S9131140.cc \
     ##BinnedHisto ATLAS_2011_S9212183.cc \
     ##BinnedHisto ATLAS_2011_S9225137.cc \
     ##BinnedHisto ATLAS_2011_S9019561.cc \
     ATLAS_2011_I894867.cc \
     ATLAS_2011_I919017.cc \
     ATLAS_2011_I921594.cc \
     ATLAS_2011_I925932.cc \
     ATLAS_2011_I926145.cc \
     ##BinnedHisto ATLAS_2011_I930220.cc \
     ##bookScatter2D ATLAS_2011_I944826.cc \
     ##bookScatter2D ATLAS_2011_I945498.cc \
     ATLAS_2011_I954993.cc \
     ##bookScatter2D ATLAS_2011_I928289_W.cc \
     ATLAS_2011_I928289_Z.cc \
     ATLAS_2011_S9035664.cc \
     ##BinnedHisto ATLAS_2012_I943401.cc \
     ATLAS_2012_I1082009.cc \
     ##BinnedHisto ATLAS_2012_I1082936.cc \
     ##bookScatter2D ATLAS_2012_I1083318.cc \
     ATLAS_2012_I1084540.cc \
     ATLAS_2012_I1091481.cc \
     ##bookScatter2D ATLAS_2012_I1093734.cc \
     ATLAS_2012_I1093738.cc \
     ##BinnedHisto ATLAS_2012_I1094564.cc \
     ##bookScatter2D ATLAS_2012_I1094568.cc \
     ##BinnedHisto ATLAS_2012_I1112263.cc \
     ##BinnedHisto ATLAS_2012_I1117704.cc \
     ATLAS_2012_I1118269.cc \
     ATLAS_2012_I1119557.cc \
     ATLAS_2012_I1124167.cc \
     ##BinnedHisto ATLAS_2012_I1125575.cc \
     ##BinnedHisto ATLAS_2012_I1125961.cc \
     ATLAS_2012_I1183818.cc \
     ##BinnedHisto ##bookScatter2D ATLAS_2012_I1188891.cc \
     ATLAS_2012_I1199269.cc \
     ATLAS_2012_I1203852.cc \
     ATLAS_2012_I1204447.cc \
     ##BinnedHisto ATLAS_2012_I1204784.cc \
     ATLAS_2013_I1190187.cc \
     ATLAS_2013_I1217867.cc \
     ATLAS_2013_I1219109.cc \
     ##bookScatter2D ATLAS_2013_I1230812.cc \
     ATLAS_2013_I1243871.cc \
     ATLAS_2013_I1263495.cc \
     ##BinnedHisto ATLAS_2014_I1268975.cc \
     ##bookScatter2D ATLAS_2014_I1279489.cc \
     ATLAS_2014_I1282441.cc \
     ATLAS_2014_I1298811.cc \
     ATLAS_2014_I1304688.cc \
     ATLAS_2014_I1307756.cc \
     ATLAS_2014_I1306294.cc \
     ATLAS_2014_I1315949.cc \
     ##BinnedHisto ATLAS_2014_I1325553.cc \
     ##BinnedHisto ATLAS_2014_I1300647.cc \
     ATLAS_2014_I1288706.cc \
     ##BinnedHisto ##bookScatter2D ATLAS_2014_I1307243.cc \
     ##bookScatter2D ATLAS_2014_I1312627.cc \
     ATLAS_2013_I1217863_W.cc \
     ATLAS_2013_I1217863_Z.cc \
     ATLAS_2014_I1306615.cc \
     ATLAS_2013_I1216670.cc \
     ATLAS_2013_I1244522.cc \
     ##bookScatter2D ATLAS_2014_I1282447.cc \
     ATLAS_2014_I1298023.cc \
     ATLAS_2014_I1319490.cc \
     ##BinnedHisto ATLAS_2014_I1326641.cc \
     ATLAS_2014_I1327229.cc \
     ATLAS_2015_I1345452.cc \
     ##bookScatter2D ATLAS_2015_I1351916.cc \
     ATLAS_2015_I1364361.cc \
     ATLAS_2015_I1376945.cc \
     ##bookScatter2D ATLAS_2015_I1387176.cc \
     ##bookScatter2D ATLAS_2015_I1390114.cc \
     ##bookScatter2D ATLAS_2015_I1393758.cc \
     ATLAS_2015_I1394679.cc \
     ATLAS_2015_I1397635.cc \
     ATLAS_2015_I1397637.cc \
     ATLAS_2015_I1404878.cc \
     ATLAS_2015_I1408516.cc \
     ##bookScatter2D ATLAS_2016_I1419070.cc \
     ATLAS_2016_I1419652.cc \
     ATLAS_2016_I1424838.cc \
     ATLAS_2016_I1426695.cc \
     ##bookScatter2D ATLAS_2016_I1444991.cc \
     ATLAS_2016_I1452559.cc \
     ATLAS_2016_I1457605.cc \
     ATLAS_2016_I1458270.cc \
     ATLAS_2016_I1468168.cc
 # PRELIMINARY / OBSOLETE
 RivetATLASAnalyses_la_SOURCES += \
     ##BinnedHisto ATLAS_2012_CONF_2012_001.cc \
     ATLAS_2010_CONF_2010_049.cc
     ##BinnedHisto \
     ##BinnedHisto ATLAS_2011_CONF_2011_090.cc \
     ##BinnedHisto ATLAS_2011_CONF_2011_098.cc \
     ##BinnedHisto ATLAS_2012_CONF_2012_103.cc \
     ##BinnedHisto ATLAS_2012_CONF_2012_104.cc \
     ##BinnedHisto ATLAS_2012_CONF_2012_105.cc \
     ##BinnedHisto ATLAS_2012_CONF_2012_109.cc \
     ##BinnedHisto ATLAS_2012_CONF_2012_153.cc \
     ##bookScatter2D ATLAS_2015_CONF_2015_041.cc 
     ##BinnedHisto \
     ##BinnedHisto ATLAS_2011_S9041966.cc \
     ##BinnedHisto ATLAS_2011_S9212353.cc \
     ##BinnedHisto ATLAS_2012_I946427.cc
 # UNVALIDATED
 ## RivetATLASAnalyses_la_SOURCES += \
     ##BinnedHisto ATLAS_2011_S9108483.cc \
     ##BinnedHisto ATLAS_2012_I1095236.cc \
     ##BinnedHisto ATLAS_2012_I1126136.cc \
     ##BinnedHisto ATLAS_2012_I1180197.cc \
     ##BinnedHisto ATLAS_2012_I1186556.cc \
     ##BinnedHisto ATLAS_2012_I1190891.cc
 
 
 lib_LTLIBRARIES += RivetCMSAnalyses.la
 RivetCMSAnalyses_la_SOURCES = \
     CMS_2010_S8547297.cc \
     CMS_2010_S8656010.cc \
     CMS_2011_S8884919.cc \
     CMS_2011_S8941262.cc \
     ##BinnedHisto CMS_2011_S8950903.cc \
     CMS_2011_S8957746.cc \
     ##BinnedHisto CMS_2011_S8968497.cc \
     CMS_2011_S8973270.cc \
     ##bookScatter2D CMS_2011_S8978280.cc \
     ##BinnedHisto CMS_2011_S9086218.cc \
     ##BinnedHisto ##bookScatter2D CMS_2011_S9088458.cc \
     CMS_2011_S9120041.cc \
     CMS_2011_S9215166.cc \
     CMS_2012_I941555.cc  \
     CMS_2011_I954992.cc  \
     CMS_2012_I1087342.cc \
     ##BinnedHisto CMS_2012_I1090423.cc \
     ##BinnedHisto ##bookScatter2D CMS_2012_I1102908.cc \
     CMS_2012_I1107658.cc \
     CMS_2012_I1184941.cc \
     CMS_2012_I1193338.cc \
     ##BinnedHisto ##bookScatter2D CMS_2013_I1122847.cc \
     ##BinnedHisto CMS_2013_I1208923.cc \
     ##BinnedHisto CMS_2013_I1209721.cc \
     ##bookScatter2D CMS_2013_I1218372.cc \
     CMS_2013_I1224539_DIJET.cc \
     CMS_2013_I1224539_WJET.cc \
     CMS_2013_I1224539_ZJET.cc \
     CMS_2013_I1256943.cc \
     ##BinnedHisto CMS_2013_I1258128.cc \
     CMS_2013_I1261026.cc \
     CMS_2013_I1265659.cc \
     CMS_2013_I1272853.cc \
     CMS_2013_I1273574.cc \
     ##bookScatter2D CMS_2014_I1298810.cc \
     CMS_2014_I1303894.cc \
     CMS_2014_I1305624.cc \
     CMS_2015_I1310737.cc \
     ##BinnedHisto CMS_2015_I1327224.cc \
     CMS_2015_I1346843.cc \
     CMS_2015_I1356998.cc \
     CMS_2015_I1370682.cc \
     CMS_2015_I1384119.cc \
     CMS_2015_I1385107.cc \
     CMS_2015_I1397174.cc \
     CMS_2016_I1473674.cc \
     CMSTOTEM_2014_I1294140.cc \
     TOTEM_2014_I1328627.cc
 # PRELIMINARY
 RivetCMSAnalyses_la_SOURCES += \
     CMS_QCD_10_024.cc \
     CMS_2012_PAS_QCD_11_010.cc
 
 
 lib_LTLIBRARIES += RivetLHCbAnalyses.la
 RivetLHCbAnalyses_la_SOURCES = \
     LHCB_2010_I867355.cc \
     LHCB_2010_S8758301.cc \
     ##bookScatter2D LHCB_2011_I917009.cc \
     ##BinnedHisto LHCB_2011_I919315.cc \
     ##bookScatter2D LHCB_2012_I1119400.cc \
     LHCB_2012_I1208102.cc \
     ##BinnedHisto LHCB_2013_I1218996.cc \
     ##bookScatter2D LHCB_2013_I1208105.cc \
     LHCB_2014_I1281685.cc \
     LHCB_2015_I1333223.cc
 
 
 ##lib_LTLIBRARIES += RivetLHCfAnalyses.la
 ##RivetLHCfAnalyses_la_SOURCES = \
     ##BinnedHisto LHCF_2012_I1115479.cc
 
 
 lib_LTLIBRARIES += RivetTOTEMAnalyses.la
 RivetTOTEMAnalyses_la_SOURCES = \
     TOTEM_2012_I1115294.cc \
     TOTEM_2012_I1220862.cc
 
 
 lib_LTLIBRARIES += RivetCDFAnalyses.la
 RivetCDFAnalyses_la_SOURCES = \
     CDF_1988_S1865951.cc \
     CDF_1990_S2089246.cc \
     ##bookScatter2D CDF_1994_S2952106.cc \
     ##BinnedHisto ##bookScatter2D CDF_1996_S3418421.cc \
     CDF_1998_S3618439.cc \
     CDF_2000_S4155203.cc \
     CDF_2000_S4266730.cc \
     ##BinnedHisto CDF_2001_S4517016.cc \
     CDF_2001_S4751469.cc \
     CDF_2002_S4796047.cc \
     CDF_2004_S5839831.cc \
     CDF_2005_S6080774.cc \
     ##bookScatter2D CDF_2005_S6217184.cc \
     CDF_2006_S6450792.cc \
     CDF_2006_S6653332.cc \
     ##BinnedHisto CDF_2007_S7057202.cc \
     CDF_2008_S7540469.cc \
     ##bookScatter2D CDF_2008_S7541902.cc \
     ##bookScatter2D CDF_2008_S7782535.cc \
     ##BinnedHisto CDF_2008_S7828950.cc \
     CDF_2008_S8093652.cc \
     CDF_2008_S8095620.cc \
     CDF_2009_S8233977.cc \
     CDF_2009_I856131.cc \
     CDF_2009_S8436959.cc \
     CDF_2010_S8591881_DY.cc \
     CDF_2010_S8591881_QCD.cc \
     CDF_2012_I1124333.cc
 # PRELIMINARY
 RivetCDFAnalyses_la_SOURCES += \
     CDF_2009_NOTE_9936.cc \
     CDF_2012_NOTE10874.cc
 # UNVALIDATED
 RivetCDFAnalyses_la_SOURCES += \
     CDF_1993_S2742446.cc \
     CDF_1996_S3108457.cc \
     CDF_1996_S3349578.cc \
     CDF_1997_S3541940.cc \
     CDF_2001_S4563131.cc
 
 
 lib_LTLIBRARIES += RivetD0Analyses.la
 RivetD0Analyses_la_SOURCES = \
     D0_1995_I398175.cc \
     D0_2000_I499943.cc \
     D0_2000_S4480767.cc \
     ##bookScatter2D D0_2001_S4674421.cc \
     D0_2004_S5992206.cc \
     D0_2006_S6438750.cc \
     D0_2007_S7075677.cc \
     D0_2008_S6879055.cc \
     D0_2008_S7554427.cc \
     D0_2008_S7662670.cc \
     ##bookScatter2D D0_2008_S7719523.cc \
     ##bookScatter2D D0_2008_S7837160.cc \
     D0_2008_S7863608.cc \
     D0_2009_S8202443.cc \
     ##BinnedHisto D0_2009_S8320160.cc \
     D0_2009_S8349509.cc \
     ##BinnedHisto D0_2010_S8566488.cc \
     ##BinnedHisto D0_2010_S8570965.cc \
     D0_2010_S8671338.cc \
     ##BinnedHisto D0_2010_S8821313.cc \
     D0_2011_I895662.cc \
     ##BinnedHisto D0_2015_I1324946.cc \
     D0_2000_I503361.cc
 # UNVALIDATED
 RivetD0Analyses_la_SOURCES += \
     D0_1996_S3214044.cc 
     ##\
     ##BinnedHisto D0_1996_S3324664.cc
 
 
 lib_LTLIBRARIES += RivetHERAAnalyses.la
 RivetHERAAnalyses_la_SOURCES = \
     H1_1994_S2919893.cc \
     H1_2000_S4129130.cc
 # UNVALIDATED
 RivetHERAAnalyses_la_SOURCES += \
     ##Scatter2D H1_1995_S3167097.cc \
     ZEUS_2001_S4815815.cc
 
 
 lib_LTLIBRARIES += RivetPetraAnalyses.la
 RivetPetraAnalyses_la_SOURCES = \
     JADE_1998_S3612880.cc \
     TASSO_1990_S2148048.cc
 
 lib_LTLIBRARIES += RivetLEPAnalyses.la
 RivetLEPAnalyses_la_SOURCES = \
     ALEPH_1991_S2435284.cc \
     ALEPH_1995_I382179.cc \
     ALEPH_1996_S3486095.cc \
     ALEPH_1996_S3196992.cc \
     ALEPH_1999_S4193598.cc \
     ALEPH_2001_S4656318.cc \
     ALEPH_2002_S4823664.cc \
     ##bookScatter2D ALEPH_2004_S5765862.cc \
     DELPHI_1995_S3137023.cc \
     DELPHI_1996_S3430090.cc \
     DELPHI_1999_S3960137.cc \
     ##bookScatter2D DELPHI_2000_S4328825.cc \
     DELPHI_2011_I890503.cc \
     L3_1992_I336180.cc \
     OPAL_1993_I342766.cc \
     OPAL_1994_S2927284.cc \
     OPAL_1995_S3198391.cc \
     OPAL_1996_S3257789.cc \
     OPAL_1997_S3396100.cc \
     OPAL_1997_S3608263.cc \
     OPAL_1998_S3702294.cc \
     OPAL_1998_S3749908.cc \
     OPAL_1998_S3780481.cc \
     OPAL_2000_S4418603.cc \
     OPAL_2001_S4553896.cc \
     ##bookScatter2D OPAL_2002_S5361494.cc \
     OPAL_2003_I599181.cc \
     OPAL_2004_S6132243.cc \
     ##bookScatter2D SLD_1996_S3398250.cc \
     ##bookScatter2D SLD_1999_S3743934.cc \
     SLD_2002_S4869273.cc 
     ##\
     ##bookScatter2D SLD_2004_S5693039.cc
 # UNVALIDATED
 RivetLEPAnalyses_la_SOURCES += \
     OPAL_1993_S2692198.cc
 # OBSOLETE
 RivetLEPAnalyses_la_SOURCES += \
     DELPHI_2002_069_CONF_603.cc
 
 
 lib_LTLIBRARIES += RivetRHICAnalyses.la
 RivetRHICAnalyses_la_SOURCES = \
     ##bookScatter2D STAR_2006_S6500200.cc \
     ##bookScatter2D STAR_2006_S6860818.cc \
     STAR_2006_S6870392.cc
 # PRELIMINARY
 RivetRHICAnalyses_la_SOURCES += \
     STAR_2009_UE_HELEN.cc
 # UNVALIDATED
 RivetRHICAnalyses_la_SOURCES += \
     STAR_2008_S7869363.cc \
     STAR_2008_S7993412.cc
 
 
 lib_LTLIBRARIES += RivetSPSAnalyses.la
 RivetSPSAnalyses_la_SOURCES = \
     UA1_1990_S2044935.cc \
     UA5_1982_S875503.cc \
     UA5_1986_S1583476.cc \
     UA5_1987_S1640666.cc \
     ##bookScatter2D UA5_1988_S1867512.cc \
     UA5_1989_S1926373.cc
 
 
 lib_LTLIBRARIES += RivetMiscAnalyses.la
 RivetMiscAnalyses_la_SOURCES = \
     E735_1998_S3905616.cc \
     PDG_HADRON_MULTIPLICITIES.cc \
     PDG_HADRON_MULTIPLICITIES_RATIOS.cc \
     PDG_TAUS.cc \
     JADE_OPAL_2000_S4300807.cc \
     ARGUS_1993_S2653028.cc \
     ##bookScatter2D ARGUS_1993_S2669951.cc \
     ARGUS_1993_S2789213.cc \
     BABAR_2003_I593379.cc \
     BABAR_2005_S6181155.cc \
     BABAR_2007_S6895344.cc \
     ##bookScatter2D BABAR_2007_S7266081.cc \
     BABAR_2013_I1116411.cc \
     BABAR_2013_I1238276.cc \
     BABAR_2015_I1334693.cc \
     BELLE_2001_S4598261.cc \
     BELLE_2008_I786560.cc \
     BELLE_2011_I878990.cc \
     BELLE_2013_I1216515.cc \
     BELLE_2013_I1238273.cc \
     BELLE_2015_I1397632.cc \
     CLEO_2004_S5809304.cc
 # UNVALIDATED
 RivetMiscAnalyses_la_SOURCES += \
     SFM_1984_S1178091.cc
 
 
 lib_LTLIBRARIES += RivetMCAnalyses.la
 RivetMCAnalyses_la_SOURCES = \
     EXAMPLE.cc \
     EXAMPLE_CUTS.cc \
     EXAMPLE_SMEAR.cc \
-    MC_QCD_PARTONS.cc \
+    ##libAnalysisTools MC_QCD_PARTONS.cc \
     MC_DIPHOTON.cc \
-    MC_ELECTRONS.cc \
+    ##libAnalysisTools MC_ELECTRONS.cc \
     ##bookScatter2D MC_GENERIC.cc \
     MC_HINC.cc \
-    MC_HJETS.cc \
-    MC_HHJETS.cc \
-    MC_HKTSPLITTINGS.cc \
+    ##libAnalysisTools MC_HJETS.cc \
+    ##libAnalysisTools MC_HHJETS.cc \
+    ##libAnalysisTools MC_HKTSPLITTINGS.cc \
     MC_IDENTIFIED.cc \
-    MC_JETS.cc \
+    ##libAnalysisTools MC_JETS.cc \
     MC_JETTAGS.cc \
     MC_HFJETS.cc \
     MC_LEADJETUE.cc \
     MC_MET.cc \
-    MC_MUONS.cc \
+    ##libAnalysisTools MC_MUONS.cc \
     MC_PDFS.cc \
     MC_PHOTONINC.cc \
-    MC_PHOTONJETS.cc \
-    MC_PHOTONKTSPLITTINGS.cc \
+    ##libAnalysisTools MC_PHOTONJETS.cc \
+    ##libAnalysisTools MC_PHOTONKTSPLITTINGS.cc \
     MC_PHOTONS.cc \
     MC_PRINTEVENT.cc \
     MC_SUSY.cc \
     MC_TTBAR.cc \
     MC_VH2BB.cc \
     ##bookScatter2D MC_WINC.cc \
-    MC_WJETS.cc \
-    MC_WKTSPLITTINGS.cc \
+    ##libAnalysisTools MC_WJETS.cc \
+    ##libAnalysisTools MC_WKTSPLITTINGS.cc \
     MC_WPOL.cc \
     MC_WWINC.cc \
-    MC_WWJETS.cc \
-    MC_WWKTSPLITTINGS.cc \
+    ##libAnalysisTools MC_WWJETS.cc \
+    ##libAnalysisTools MC_WWKTSPLITTINGS.cc \
     ##bookScatter2D MC_XS.cc \
     MC_ZINC.cc \
-    MC_ZJETS.cc \
-    MC_ZKTSPLITTINGS.cc \
-    MC_ZZINC.cc \
-    MC_ZZJETS.cc \
-    MC_ZZKTSPLITTINGS.cc
+    ##libAnalysisTools MC_ZJETS.cc \
+    ##libAnalysisTools MC_ZKTSPLITTINGS.cc \
+    MC_ZZINC.cc 
+    ##\
+    ##libAnalysisTools MC_ZZJETS.cc \
+    ##libAnalysisTools MC_ZZKTSPLITTINGS.cc
 
 endif
diff --git a/src/Tools/RivetYODA.cc b/src/Tools/RivetYODA.cc
--- a/src/Tools/RivetYODA.cc
+++ b/src/Tools/RivetYODA.cc
@@ -1,282 +1,301 @@
 #include "Rivet/Config/RivetCommon.hh"
 #include "Rivet/Tools/RivetYODA.hh"
 #include "Rivet/Tools/RivetPaths.hh"
 #include "YODA/ReaderYODA.h"
 #include "YODA/ReaderAIDA.h"
 
 using namespace std;
 
 namespace Rivet {
 
 
   string getDatafilePath(const string& papername) {
     /// Try to find YODA otherwise fall back to try AIDA
     const string path1 = findAnalysisRefFile(papername + ".yoda");
     if (!path1.empty()) return path1;
     const string path2 = findAnalysisRefFile(papername + ".aida");
     if (!path2.empty()) return path2;
     throw Rivet::Error("Couldn't find ref data file '" + papername + ".yoda/aida" +
                        " in $RIVET_REF_PATH, '" + getRivetDataPath() + "', or '.'");
   }
 
 
   map<string, YODA::AnalysisObjectPtr> getRefData(const string& papername) {
     const string datafile = getDatafilePath(papername);
 
     // Make an appropriate data file reader and read the data objects
     /// @todo Remove AIDA support some day...
     YODA::Reader& reader = (datafile.find(".yoda") != string::npos) ?   \
       YODA::ReaderYODA::create() : YODA::ReaderAIDA::create();
     vector<YODA::AnalysisObject *> aovec;
     reader.read(datafile, aovec);
 
     // Return value, to be populated
     map<string, YODA::AnalysisObjectPtr> rtn;
     foreach ( YODA::AnalysisObject* ao, aovec ) {
       YODA::AnalysisObjectPtr refdata(ao);
       if (!refdata) continue;
       const string plotpath = refdata->path();
       // Split path at "/" and only return the last field, i.e. the histogram ID
       const size_t slashpos = plotpath.rfind("/");
       const string plotname = (slashpos+1 < plotpath.size()) ? plotpath.substr(slashpos+1) : "";
       rtn[plotname] = refdata;
     }
     return rtn;
   }
 }
 
 namespace {
 
   using Rivet::Fill;
   using Rivet::Fills;
   using Rivet::TupleWrapper;
 
     template <class T>
     double get_window_size(const typename T::Ptr & histo,
                            typename T::BinType x) {
         // the bin index we fall in
         const auto binidx = histo->binIndexAt(x);
         // gaps, overflow, underflow don't contribute
         if ( binidx == -1 ) 
             return 0;
 
 
         const auto & b = histo->bin(binidx);
 
         // if we don't have a valid neighbouring bin,
         // we use infinite width
         typename T::Bin b1(-1.0/0.0, 1.0/0.0);
 
         // points in the top half compare to the upper neighbour
         if ( x > b.xMid() ) {
             int nextidx = binidx + 1;
             if ( nextidx < histo->bins().size() )
                 b1 = histo->bin(nextidx);
         }
         else { // compare to the lower neighbour
             int nextidx = binidx - 1;
             if ( nextidx >= 0 )
                 b1 = histo->bin(nextidx);
         }
         // the factor 2 is arbitrary, could poss. be smaller
         return min( b.width(), b1.width() ) / 2.0;
     }
 
     template <class T>
      typename T::BinType 
      fillT2binT(typename T::FillType a) {
        return a;
     }
 
     template <>
     YODA::Profile1D::BinType 
     fillT2binT<YODA::Profile1D>(YODA::Profile1D::FillType a) {
       return get<0>(a);
     }
 
     template <>
     YODA::Profile2D::BinType 
     fillT2binT<YODA::Profile2D>(YODA::Profile2D::FillType a) {
       return { get<0>(a), get<1>(a) };
     }
 
 
 
   template <class T>
   void commit(vector<typename T::Ptr> & persistent,
               const vector< vector<Fill<T>> > & tuple,
               const vector<vector<double>> & weights ) {
 
+    // TODO check if all the xs are in the same bin anyway!
+    // Then no windowing needed
+
     assert(persistent.size() == weights[0].size());
 
     for ( const auto & x : tuple ) {
       double maxwindow = 0.0;
       for ( const auto & xi : x ) {
         // TODO check for NOFILL here
         // persistent[0] has the same binning as all the other persistent objects
         double window = get_window_size<T>(persistent[0], fillT2binT<T>(xi.first));
         if ( window > maxwindow )
           maxwindow = window;
       }
       const double wsize = maxwindow;
       // all windows have same size
 
       set<double> edgeset;
       // bin edges need to be in here!
       for ( const auto & xi : x ) {
         edgeset.insert(fillT2binT<T>(xi.first) - wsize);
         edgeset.insert(fillT2binT<T>(xi.first) + wsize);
       }
 
       for ( size_t m = 0; m < persistent.size(); ++m ) {
           vector< std::tuple<double,double,double> > hfill;
           double sumf = 0.0;
           auto edgit = edgeset.begin();
           double ehi = *edgit;
           while ( ++edgit != edgeset.end() ) {
             double elo = ehi;
             ehi = *edgit;
             double sumw = 0.0; // need m copies of this
             bool gap = true; // Check for gaps between the sub-windows.
             for ( int i = 0; i < x.size(); ++i  ) {
               // check equals comparisons here!
               if ( fillT2binT<T>(x[i].first) + wsize >= ehi 
                    && 
                    fillT2binT<T>(x[i].first) - wsize <= elo ) {
                 sumw += x[i].second * weights[i][m];
                 gap = false;
               }
             }
             if ( gap ) continue;
             hfill.push_back(make_tuple((ehi + elo)/2.0, sumw, ehi - elo));
             sumf += ehi - elo;
           }
     
           for ( auto f : hfill )
             persistent[m]->fill( get<0>(f), get<1>(f), get<2>(f)/sumf );
             // Note the scaling to one single fill
       }
     }
   }
 
+  template<>
+  void commit<YODA::Histo2D>(vector<YODA::Histo2D::Ptr> & persistent,
+              const vector< vector<Fill<YODA::Histo2D>> > & tuple,
+              const vector<vector<double>> & weights)
+  {}
+
+  template<>
+  void commit<YODA::Profile2D>(vector<YODA::Profile2D::Ptr> & persistent,
+              const vector< vector<Fill<YODA::Profile2D>> > & tuple,
+              const vector<vector<double>> & weights)
+  {}
+
     template <class T>
     double distance(T a, T b) {
       return abs(a - b);
     }
 
     template <>
     double distance<tuple<double,double> >(tuple<double,double> a, tuple<double,double> b) {
       return Rivet::sqr(get<0>(a) - get<0>(b)) + Rivet::sqr(get<1>(a) - get<1>(b));
     }
 
 
 
 }
 
 
 
 
 /// fills is a vector of sub-event with an ordered set of x-values of
 /// the fills in each sub-event. NOFILL should be an "impossible"
 /// value for this histogram. Returns a vector of sub-events with
 /// an ordered vector of fills (including NOFILLs) for each sub-event.
 template <class T>
 vector< vector<Fill<T> > > 
 match_fills(const vector<typename TupleWrapper<T>::Ptr> & evgroup, const Fill<T> & NOFILL) 
 {
   vector< vector<Fill<T> > > matched;
   // First just copy subevents into vectors and find the longest vector.
   unsigned int maxfill = 0; // length of biggest vector
   int imax = 0; // index position of biggest vector
   for ( const auto & it : evgroup ) {
     const auto & subev = it->fills();
     if ( subev.size() > maxfill ) {
       maxfill = subev.size();
       imax = matched.size();
     }
     matched.push_back(vector<Fill<T> >(subev.begin(), subev.end()));
   }
   // Now, go through all subevents with missing fills.
   const vector<Fill<T>> & full = matched[imax]; // the longest one
   for ( auto & subev : matched ) {
     if ( subev.size() == maxfill ) continue;
 
     // Add NOFILLs to the end;
     while ( subev.size() < maxfill ) subev.push_back(NOFILL);
 
     // Iterate from the back and shift all fill values backwards by
     // swapping with NOFILLs so that they better match the full
     // subevent.
     for ( int i = maxfill - 1; i >= 0; --i ) {
       if ( subev[i] == NOFILL ) continue;
       int j = i;
       while ( j + 1 < maxfill && subev[j + 1] == NOFILL &&
-              distance(subev[j].first, full[j].first) > distance(subev[j].first, full[j + 1].first) ) 
+              distance(fillT2binT<T>(subev[j].first), 
+                       fillT2binT<T>(full[j].first)) 
+              > 
+              distance(fillT2binT<T>(subev[j].first), 
+                       fillT2binT<T>(full[j + 1].first)) ) 
       {
             swap(subev[j], subev[j + 1]);
             ++j;
       }
     }
   }
   // transpose
   vector<vector<Fill<T>>> result(maxfill,vector<Fill<T>>(matched.size()));
   for (size_t i = 0; i < matched.size(); ++i)
       for (size_t j = 0; j < maxfill; ++j)
           result.at(j).at(i) = matched.at(i).at(j);
   return result;
 }
 
 
 
 
 
 
 namespace Rivet {
 
   template <class T>
   void Wrapper<T>::pushToPersistent(const vector<vector<double> >& weight) {
 
       // have we had subevents at all?
       const bool have_subevents = _evgroup.size() > 1;
       if ( ! have_subevents ) {
 
         assert( _evgroup.size() == 1 && weight.size() == 1 );
         // simple replay of all tuple entries
         // each recorded fill is inserted into all persistent weightname histos
         for ( size_t m = 0; m < _persistent.size(); ++m )
             for ( const auto & f : _evgroup[0]->fills() )
                 _persistent[m]->fill( f.first, f.second * weight[0][m] );
 
       } else {
 
         assert( _evgroup.size() == weight.size() );
         // outer index is subevent, inner index is jets in the event
         vector<vector<Fill<T>>> linedUpXs
             = match_fills<T>(_evgroup, {typename T::FillType(), 0.0});
         commit<T>( _persistent, linedUpXs, weight );
 
       }
       _evgroup.clear();
       _active.reset();
   }
 
   template <>
   void Wrapper<YODA::Counter>::pushToPersistent(const vector<vector<double> >& weight) {
     for ( size_t m = 0; m < _persistent.size(); ++m ) {
       for ( size_t n = 0; n < _evgroup.size(); ++n ) {
         for ( const auto & f : _evgroup[n]->fills() ) {
           _persistent[m]->fill( f.second * weight[n][m] );
         }
       }
     }
   }
 
   // explicitly instantiate all wrappers
 
   template class Wrapper<YODA::Histo1D>;
-//  template class Wrapper<YODA::Histo2D>;
+  template class Wrapper<YODA::Histo2D>;
   template class Wrapper<YODA::Profile1D>;
-//  template class Wrapper<YODA::Profile2D>;
+  template class Wrapper<YODA::Profile2D>;
   template class Wrapper<YODA::Counter>;
 
 }
diff --git a/test/testApi.cc b/test/testApi.cc
--- a/test/testApi.cc
+++ b/test/testApi.cc
@@ -1,36 +1,34 @@
 #include "Rivet/AnalysisHandler.hh"
 #include "HepMC/GenEvent.h"
 #include "HepMC/IO_GenEvent.h"
 
 using namespace std;
 
 int main() {
   Rivet::AnalysisHandler ah;
   Rivet::Log::setLevel("Rivet", Rivet::Log::TRACE);
 
   // Specify the analyses to be used
   ah.addAnalysis("EXAMPLE");
   ah.addAnalyses({{ "MC_JETS", "EXAMPLE_CUTS", "EXAMPLE_SMEAR" }});
 
   std::ifstream file("testApi.hepmc");
   HepMC::IO_GenEvent hepmcio(file);
   HepMC::GenEvent* evt = hepmcio.read_next_event();
-  double sum_of_weights = 0.0;
   while (evt) {
     // Analyse current event
     ah.analyze(*evt);
-    sum_of_weights += evt->weights()[0];
 
     // Clean up and get next event
     delete evt; evt = nullptr;
     hepmcio >> evt;
   }
   file.close();
 
   ah.setCrossSection(1.0);
-  ah.setSumOfWeights(sum_of_weights); ///< Not necessary, but allowed
+  
   ah.finalize();
   ah.writeData("out.yoda");
 
   return 0;
 }