modified codes to be used in CMSSW