diff --git a/.gitignore b/.gitignore
index 77a0a26259debe4a770ffc74e74213b07d78f378..bc0d096a297616a9a6a3b58d748025c180efaaeb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,20 +13,19 @@ core/input/f_cf.cs3r
 core/input/f_dataRegiSolar.cs3r
 core/input/f_emiFgas.cs4r
 core/input/f_gdp.cs3r
-core/input/f_IO_trade.cs4r
 core/input/f_lab.cs3r
 core/input/f_macBaseMagpie.cs4r
 core/input/f_maxProdGradeRegiHydro.cs3r
 core/input/f_maxProdGradeRegiWind.cs3r
 core/input/f_pop.cs3r
+core/input/f_IO_trade.cs4r
 core/input/p_abatparam_CH4.cs4r
 core/input/p_abatparam_N2O.cs4r
 core/input/p_abatparam_CO2.cs4r
 core/input/p_adj_deltacapoffset.cs4r
 core/input/p_boundEmi.cs4r
-core/input/p_boundInvMacro.cs4r
 core/input/pm_NuclearConstraint.cs4r
-core/input/p_costsPEtradeMp.cs4r
+core/input/pm_costsPEtradeMp.cs4r
 core/input/pm_dataccs.cs3r
 core/input/p_earlyRetirementAdjFactor.cs3r
 core/input/p_emiFossilFuelExtr.cs4r
@@ -43,7 +42,6 @@ core/input/p_share_ind_fesos.cs4r
 core/input/p_share_ind_fesos_bio.cs4r
 core/input/pm_boundCapCCS.cs4r
 core/input/pm_boundCapEV.cs4r
-core/input/pm_costsTradePeFinancial.cs3r
 core/input/pm_shPPPMER.cs4r
 core/input/p_inco0.cs4r
 core/input/p_boundCapCCSindicator.cs4r
@@ -55,6 +53,7 @@ core/input/
 core/input/core/input/p_NuclearConstraint.cs4r
 core/input/core/input/pm_inco0.cs4r
 core/input/historical/historical.mif
+modules/01_macro/singleSectorGr/input/p01_boundInvMacro.cs4r
 modules/04_PE_FE_parameters/iea2014/input/f04_IO_input.cs4r
 modules/04_PE_FE_parameters/iea2014/input/f04_IO_output.cs4r
 modules/04_PE_FE_parameters/iea2014/input/
@@ -81,6 +80,8 @@ modules/23_capitalMarket/imperfect/input/pm_ies.cs4r
 modules/23_capitalMarket/imperfect/input/pm_nfa_start.cs4r
 modules/23_capitalMarket/imperfect/input/pm_risk_premium.cs4r
 modules/23_capitalMarket/perfect/input/pm_nfa_start.cs4r
+modules/24_trade/standard/input/pm_costsPEtradeMp.cs4r
+modules/24_trade/standard/input/pm_costsTradePeFinancial.cs3r
 modules/26_agCosts/costs/input/p26_totLUcostLookup.cs4r
 modules/26_agCosts/costs/input/p26_macCostLuLookup.cs4r
 modules/26_agCosts/costs/input/
diff --git a/config/default.cfg b/config/default.cfg
index 0804d4b6101c97f9f9327aefaadd1b332e982389..1306d4315a095088ea60636ae810f8f0b3f55918 100755
--- a/config/default.cfg
+++ b/config/default.cfg
@@ -22,7 +22,7 @@ cfg$title <- "default"
 cfg$regionmapping <- "config/regionmappingH12.csv"
 
 #### Current input data revision (<mainrevision>.<subrevision>) ####
-cfg$revision <- 5.936
+cfg$revision <- 5.937
 
 #### Force the model to download new input data ####
 cfg$force_download <- FALSE
@@ -49,6 +49,10 @@ cfg$gms <- list()
 # ***                           MODULES                   START
 # ***------------------------------------------------------------------------------
 
+# ***---------------------    01_macro    -----------------------------------------
+# * (singleSectorGr): 
+cfg$gms$macro  <- "singleSectorGr"   # def = singleSectorGr
+
 # ***---------------------    02_welfare    ---------------------------------------
 # * (utilitarian): 
 cfg$gms$welfare  <- "utilitarian"   # def = utilitarian
@@ -97,6 +101,9 @@ cfg$gms$subsidizeLearning  <- "off"           # def = off
 # * (perfect):   Perfect capital market (results in large short-term capital flows from North to South)
 cfg$gms$capitalMarket  <- "perfect"           # def = perfect
 
+# ***----------------------    24_trade    ---------------------------------------
+# * (standard):
+cfg$gms$trade  <- "standard"           # def = standard
 
 # ***----------------------   26_agCosts  ----------------------------------------
 # * (off): agricultural costs zero, no trade taken into account
@@ -271,7 +278,7 @@ cfg$gms$c_solscen              <-  1  #  def  <-  1
 
 cfg$gms$cm_bioenergy_tax     <- 1.5     # def <- 1.5
 cfg$gms$cm_bioenergymaxscen  <- 0       # def <- 0
-cfg$gms$c_tradecost_bio      <- 2       # def <- 2
+cfg$gms$cm_tradecost_bio      <- 2       # def <- 2
 cfg$gms$cm_LU_emi_scen       <- "SSP2"  # def <- "SSP2"
 cfg$gms$c_1stgen_phaseout   <- 0       # def <- 0
 cfg$gms$cm_cprice_red_factor <- 0.5  	# def = 0.5
@@ -334,7 +341,7 @@ cfg$gms$cm_esubGrowth         <- "low" #def <- "low"
 
 cfg$gms$cm_cooling_shares               <- "static"   # def <- "static", or "dynamic"
 cfg$gms$cm_techcosts                    <- "REG"      # def <- "REG", or "GLO"
-cfg$gms$c_trdcst                        <- 1.5     # def <- 1.5
+cfg$gms$cm_trdcst                        <- 1.5     # def <- 1.5
 cfg$gms$cm_trdadj                       <- 2.0     # def <- 2.0
 cfg$gms$c_refcapbnd                     <- 0       # def <- 0
 cfg$gms$cm_frac_CCS                     <- 10      # def <- 10
@@ -537,7 +544,7 @@ cfg$RunsUsingTHISgdxAsBAU <- NA
 #  (2): 200 EJ global bioenergy potential (bound in boundsextra.inc)
 #  (3): 300 EJ global bioenergy potential (bound in boundsextra.inc)
 #  (4): 152 EJ global bioenergy potential, i.e. 100 EJ 2nd generation (bound in boundsextra.inc)
-# c_tradecost_bio  "choose financal tradecosts for biomass (purpose grown pebiolc)"
+# cm_tradecost_bio  "choose financal tradecosts for biomass (purpose grown pebiolc)"
 #  (1): low   tradecosts (for other SSP scenarios than SSP2)
 #  (2): high  tradecosts (default and SSP2)
 # cm_LU_emi_scen   "choose emission baseline for CO2, CH4, and N2O land use emissions from MAgPIE"
@@ -732,7 +739,7 @@ cfg$RunsUsingTHISgdxAsBAU <- NA
 # vm_peprod   = "vm_prodPe",
 # v_sedem     = "v_demSe,v_demSe = "vm_demSe"
 # p_nw into p80_nw,c_nucscen into cm_nucscen, q_co2eq into qm_co2eq. qm_co2eq into q_co2eq
-# pm_costsPEtradeMp into p_costsPEtradeMp, vm_welfare into v_welfare
+# pm_costsPEtradeMp into pm_costsPEtradeMp, vm_welfare into v_welfare
 # pm_tau_fe_sub into p21_tau_fe_sub, pm_tau_fe_tax into p21_tau_fe_tax
 # pm_datapop into pm_pop, p_datalab into p_lab, p_lab into pm_lab
 # p80_pvp into pm_pvp, p80_pvpRegi into pm_pvpRegi
@@ -742,7 +749,7 @@ cfg$RunsUsingTHISgdxAsBAU <- NA
 # s_GWP_CH4 into s_gwpCH4, s_GWP_N2O into s_gwpN2O, sm_tgn2pgc into s_tgn_2_pgc, sm_tgch42pg into s_tgch4_2_pgc
 # v_ccs into v_co2CCS, v_co2CCS into vm_co2CCS, vm_costfu into vm_costFu, v_costin into v_costInv, v_costom into v_costOM, vm_costfu_bio into vm_costFuBio, vm_costfu_ex into vm_costFuEx
 # v_adjustteinv into v_costInvTeAdj, v_adj into v_adjFactor, v_adj_glob into v_adjFactorGlob, v_directteinv into v_costInvTeDir
-# vm_capCum into vm_capCum, v_inconvpen into v_inconvPen, v_invest_adjcosts into v_invMacroAdj
+# vm_capCum into vm_capCum, v_inconvpen into v_inconvPen, v_invest_adjcosts into v01_invMacroAdj
 # v_capini into v_INIcap0, v_earlyreti into v_capEarlyReti, v_emi into vm_emiTeDetail, v_gridshare into v_shGrid, v_shareseel into v_shSeEl, v_shSeEl into v32_shSeEl
 # v_investcost into v_costTeCapital, v_storshare into v_shStor, v_shStor into v32_shStor, v_edemini into v_INIdemEn0, vm_esprod into vm_prodEs, vm_forc_os into vm_forcOS
 # vm_fuelex into vm_fuExtr, vm_taxrev into vm_taxRev, v_capEarlyReti into vm_capEarlyReti
@@ -783,8 +790,8 @@ cfg$RunsUsingTHISgdxAsBAU <- NA
 # q_emissengregi into q_emiTe, q_eminegregi into q_emiMacSector, q_co2bioexp into q_macBaseCo2bioexp, q_sumeminegregi into q_emiMac, q_emissions into q_emiAll, q_emissionsGlob into q_emiAllGlob
 # q_emiconst into q_emiCap, q_emibudget1Glob into q_budgetCO2eqGlob, q_ccsbal ionto q_balCCS, q_ccstrans into q_transCCS, q_ccsconst itnto q_limitCCS, q_so2constraint into q_limitSo2
 # q_co2constraint into q_limitCO2, q_eqadj into q_adjFactor, q_operating_reserve into q_operatingReserve, q_operatingReserve into q32_operatingReserve, q_nocoldreserve into q_limitCapEarlyReti, q_smoothphaseout into q_smoothphaseoutCapEarlyReti
-# q_inconvpen into q_inconvPen, q_labbal into q_balLab, q_production into q_cesIO, q_kapmo into q_kapMo, q_invest_adjcosts into q_invMacroAdj, q_limit_ppfen_shares into q_limitShPpfen
-# q_limit_ppfen_ratios into q_limtRatioPpfen, q_limit_seel2fehes into q_limitSeel2fehes, q_min_oil_share into q_limitShOil, q80_tradebal into q80_balTrade, q35_share_espet into q35_shEsPeT
+# q_inconvpen into q_inconvPen, q_labbal into q01_balLab, q_production into q01_cesIO, q_kapmo into q01_kapMo, q_invest_adjcosts into q01_invMacroAdj, q_limit_ppfen_shares into q01_limitShPpfen
+# q_limit_ppfen_ratios into q01_limtRatioPpfen, q_limit_seel2fehes into q_limitSeel2fehes, q_min_oil_share into q_limitShOil, q80_tradebal into q80_balTrade, q35_share_espet into q35_shEsPeT
 # q31_costfu_ex into q31_costFuExPol q31_costfu_ex_step into q31_costFuExGrade, q31_fuelex_cum into q31_fuExtrCum, q31_fuelex_dec into q31_fuExtrDec, q31_fuelex_inc into q31_fuExtrInc,
 # q30_costfu_bio into q30_costFuBio, q30_limit_bioexport into q30_limitXpBio, q30_limit_bio into q30_limitTeBio, p35_bunker_share_in_nonldv_fe into pm_bunker_share_in_nonldv_fe
 # v_tempSlow into v10_tempSlow,f_dataemiglob into fm_dataemiglob, f_dataglob into fm_dataglob, p_dt into pm_dt, p_prodCouple into pm_prodCouple, p_dataeta into pm_dataeta,p_eta_conv into pm_eta_conv
diff --git a/config/old_scenario_config/scenario_config_EMF33.csv b/config/old_scenario_config/scenario_config_EMF33.csv
index 8dd2f9d96d6a5ea2e93f770dbc5ffb159c4737bd..83f74a86d9731423832973e3da7eed90a379456c 100644
--- a/config/old_scenario_config/scenario_config_EMF33.csv
+++ b/config/old_scenario_config/scenario_config_EMF33.csv
@@ -1,4 +1,4 @@
-title;start;cm_iteration_max;c_solver_try_max;cm_bioenergy_tax;cm_SlowConvergence;optimization;cm_postproc;climate;cm_emiscen;cm_iterative_target_adj;cm_gdximport_target;c_budgetCO2FFI;carbonprice;cm_co2_tax_2020;cm_co2_tax_growth;cm_rcp_scen;cm_POPscen;cm_GDPscen;cm_oil_scen;cm_gas_scen;cm_coal_scen;c_feintensscen;c_techAssumptScen;cm_nucscen;c_abtrdy;c_abtcst;cm_ccsscen;c_bioliqscen;c_bioh2scen;c_ccscapratescen;c_biocostscen;c_1stgen_phaseout;cm_bioenergymaxscen;cm_fetaxscen;cm_so2tax_scen;cm_multigasscen;c_EARLYRETIRE;cm_OILRETIRE;cm_LU_emi_scen;c_tradecost_bio;c_SSP_forcing_adjust;cm_APscen;cm_startyear;path_gdx;path_gdx_bau;path_gdx_ref;path_gdx_opt;path_mif_bau
+title;start;cm_iteration_max;c_solver_try_max;cm_bioenergy_tax;cm_SlowConvergence;optimization;cm_postproc;climate;cm_emiscen;cm_iterative_target_adj;cm_gdximport_target;c_budgetCO2FFI;carbonprice;cm_co2_tax_2020;cm_co2_tax_growth;cm_rcp_scen;cm_POPscen;cm_GDPscen;cm_oil_scen;cm_gas_scen;cm_coal_scen;c_feintensscen;c_techAssumptScen;cm_nucscen;c_abtrdy;c_abtcst;cm_ccsscen;c_bioliqscen;c_bioh2scen;c_ccscapratescen;c_biocostscen;c_1stgen_phaseout;cm_bioenergymaxscen;cm_fetaxscen;cm_so2tax_scen;cm_multigasscen;c_EARLYRETIRE;cm_OILRETIRE;cm_LU_emi_scen;cm_tradecost_bio;c_SSP_forcing_adjust;cm_APscen;cm_startyear;path_gdx;path_gdx_bau;path_gdx_ref;path_gdx_opt;path_mif_bau
 SSP2-R1-BASE-0-full;1;6;3;1.5;on;negishi;0;magicc;1;0;0;0;none;-1;1;rcp26;pop_SSP2;gdp_SSP2;2;2;2;0;1;2;2015;1;1;1;1;1;2;0;0;3;2;2;on;on;SSP2;2;forcing_SSP2;SSP2;2005;;;;;
 SSP2-R1-BASE-0-full-nash;1;6;3;1.5;on;nash;0;magicc;1;0;0;0;none;-1;1;rcp26;pop_SSP2;gdp_SSP2;2;2;2;0;1;2;2015;1;1;1;1;1;2;0;0;3;2;2;on;on;SSP2;2;forcing_SSP2;SSP2;2005;;;;;
 SSP2-R1-P-lo-full;1;6;3;1.5;on;negishi;0;magicc;9;0;0;0;exponential;20;1.03;rcp37;pop_SSP2;gdp_SSP2;2;2;2;0;1;2;2015;1;1;1;1;1;2;0;0;3;2;2;on;on;SSP2;2;forcing_SSP2;SSP2;2020;;;;;
diff --git a/config/old_scenario_config/scenario_config_H12.csv b/config/old_scenario_config/scenario_config_H12.csv
index 58cef4f98f0a471c7a808e779d66761a88aa37f7..4627f7d3bbfb0a4cb083ceb638731ebf4c50ce3c 100644
--- a/config/old_scenario_config/scenario_config_H12.csv
+++ b/config/old_scenario_config/scenario_config_H12.csv
@@ -1,15 +1,15 @@
 title;start;cm_iteration_max;regionmapping;cm_techcosts;cm_rcp_scen;cm_iterative_target_adj;c_budgetCO2;carbonprice;cm_co2_tax_2020;climate;optimization;capitalMarket;buildings;cm_co2_tax_growth;cm_emiscen;techpol;cm_multigasscen;cm_startyear;path_gdx;path_gdx_ref;path_gdx_bau
-Base_Negishi;1;15;./config/regionmappingH12.csv;REG;none;0;0;none;-1;off;negishi;perfect;simple;1.05;1;none;2;2005;/p/projects/remind/runs/r8134/output/Base_Negishi_2018-09-23_09.10.05/fulldata.gdx;;
-NDC_Negishi;1;20;./config/regionmappingH12.csv;REG;rcp45;3;0;NDC2018;1;off;negishi;perfect;simple;1.05;9;NDC2018;3;2015;/p/projects/remind/runs/r8134/output/NDC_Negishi_2018-09-23_21.29.47/fulldata.gdx;Base_Negishi;Base_Negishi
-Budg600_Negishi;1;20;./config/regionmappingH12.csv;REG;rcp20;5;600;expoLinear;30;off;negishi;perfect;simple;1.05;9;NDC2018;2;2025;/p/projects/remind/runs/r8264/output/Budg600_Negishi_2019-01-07_23.04.43/fulldata.gdx;NDC_Negishi;Base_Negishi
-Budg950_Negishi;1;20;./config/regionmappingH12.csv;REG;rcp26;5;950;expoLinear;30;off;negishi;perfect;simple;1.05;9;NDC2018;2;2025;/p/projects/remind/runs/r8264/output/Budg950_Negishi_2019-01-07_23.08.02/fulldata.gdx;NDC_Negishi;Base_Negishi
-Budg1300_Negishi;1;20;./config/regionmappingH12.csv;REG;rcp26;5;1300;expoLinear;30;off;negishi;perfect;simple;1.05;9;NDC2018;2;2025;/p/projects/remind/runs/r8264/output/Budg1300_Negishi_2019-01-07_23.11.05/fulldata.gdx;NDC_Negishi;Base_Negishi
-Base;1;1;./config/regionmappingH12.csv;REG;none;0;0;none;-1;off;nash;perfect;simple;1.05;1;none;2;2005;./config/input.gdx;;
-NDC;1;1;./config/regionmappingH12.csv;REG;rcp45;3;0;NDC2018;1;off;nash;perfect;simple;1.05;9;NDC2018;3;2015;./config/input.gdx;Base;Base
-NPi;1;1;./config/regionmappingH12.csv;REG;rcp45;3;0;NPi2018;1;off;nash;perfect;simple;1.05;9;NPi2018;3;2025;./config/input.gdx;NDC;Base
-Budg600;1;1;./config/regionmappingH12.csv;REG;rcp20;5;600;expoLinear;30;off;nash;perfect;simple;1.05;9;NDC2018;2;2025;./config/input.gdx;NDC;Base
-Budg950;1;1;./config/regionmappingH12.csv;REG;rcp26;5;950;expoLinear;30;off;nash;perfect;simple;1.05;9;NDC2018;2;2025;./config/input.gdx;NDC;Base
-Budg1300;1;1;./config/regionmappingH12.csv;REG;rcp26;5;1300;expoLinear;30;off;nash;perfect;simple;1.05;9;NDC2018;2;2025;./config/input.gdx;NDC;Base
+Base_Negishi;0;15;./config/regionmappingH12.csv;REG;none;0;0;none;-1;off;negishi;perfect;simple;1.05;1;none;2;2005;/p/projects/remind/runs/r8134/output/Base_Negishi_2018-09-23_09.10.05/fulldata.gdx;;
+NDC_Negishi;0;20;./config/regionmappingH12.csv;REG;rcp45;3;0;NDC2018;1;off;negishi;perfect;simple;1.05;9;NDC2018;3;2015;/p/projects/remind/runs/r8134/output/NDC_Negishi_2018-09-23_21.29.47/fulldata.gdx;Base_Negishi;Base_Negishi
+Budg600_Negishi;0;20;./config/regionmappingH12.csv;REG;rcp20;5;600;expoLinear;30;off;negishi;perfect;simple;1.05;9;NDC2018;2;2025;/p/projects/remind/runs/r8264/output/Budg600_Negishi_2019-01-07_23.04.43/fulldata.gdx;NDC_Negishi;Base_Negishi
+Budg950_Negishi;0;20;./config/regionmappingH12.csv;REG;rcp26;5;950;expoLinear;30;off;negishi;perfect;simple;1.05;9;NDC2018;2;2025;/p/projects/remind/runs/r8264/output/Budg950_Negishi_2019-01-07_23.08.02/fulldata.gdx;NDC_Negishi;Base_Negishi
+Budg1300_Negishi;0;20;./config/regionmappingH12.csv;REG;rcp26;5;1300;expoLinear;30;off;negishi;perfect;simple;1.05;9;NDC2018;2;2025;/p/projects/remind/runs/r8264/output/Budg1300_Negishi_2019-01-07_23.11.05/fulldata.gdx;NDC_Negishi;Base_Negishi
+tm_Base;1;1;./config/regionmappingH12.csv;REG;none;0;0;none;-1;off;nash;perfect;simple;1.05;1;none;2;2005;./config/input.gdx;;
+tm_NDC;1;1;./config/regionmappingH12.csv;REG;rcp45;3;0;NDC2018;1;off;nash;perfect;simple;1.05;9;NDC2018;3;2015;./config/input.gdx;tm_Base;tm_Base
+tm_Npi;1;1;./config/regionmappingH12.csv;REG;rcp45;3;0;NPi2018;1;off;nash;perfect;simple;1.05;9;NPi2018;3;2025;./config/input.gdx;tm_NDC;tm_Base
+tm_Budg600;0;1;./config/regionmappingH12.csv;REG;rcp20;5;600;expoLinear;30;off;nash;perfect;simple;1.05;9;NDC2018;2;2025;./config/input.gdx;tm_NDC;tm_Base
+tm_Budg950;1;1;./config/regionmappingH12.csv;REG;rcp26;5;950;expoLinear;30;off;nash;perfect;simple;1.05;9;NDC2018;2;2025;./config/input.gdx;tm_NDC;tm_Base
+tm_Budg1300;0;1;./config/regionmappingH12.csv;REG;rcp26;5;1300;expoLinear;30;off;nash;perfect;simple;1.05;9;NDC2018;2;2025;./config/input.gdx;tm_NDC;tm_Base
 Base_imp;0;1;./config/regionmappingH12.csv;REG;none;0;0;none;-1;off;nash;imperfect;simple;1.05;1;none;2;2005;./config/input.gdx;;
 NDC_imp;0;1;./config/regionmappingH12.csv;REG;rcp45;3;0;NDC2018;1;off;nash;imperfect;simple;1.05;9;NDC2018;3;2015;./config/input.gdx;Base_imp;Base_imp
 Budg600_imp;0;1;./config/regionmappingH12.csv;REG;rcp20;5;600;expoLinear;30;off;nash;imperfect;simple;1.05;9;NDC2018;2;2025;./config/input.gdx;NDC_imp;Base_imp
diff --git a/config/old_scenario_config/scenario_config_SSP.csv b/config/old_scenario_config/scenario_config_SSP.csv
index d9fcc67588f755dc0b69a365de24843c2c7b5c9a..4e8a2169774250815e3f5a4a5431ea0c7dafc2d2 100644
--- a/config/old_scenario_config/scenario_config_SSP.csv
+++ b/config/old_scenario_config/scenario_config_SSP.csv
@@ -1,4 +1,4 @@
-title;start;cm_iteration_max;c_solver_try_max;cm_bioenergy_tax;cm_SlowConvergence;climate;cm_iterative_target_adj;cm_gdximport_target;optimization;cm_postproc;cm_emiscen;carbonprice;cm_co2_tax_2020;cm_rcp_scen;cm_POPscen;cm_GDPscen;cm_oil_scen;cm_gas_scen;cm_coal_scen;c_feintensscen;c_techAssumptScen;cm_nucscen;c_ccscapratescen;c_biocostscen;c_1stgen_phaseout;cm_bioenergymaxscen;cm_fetaxscen;cm_so2tax_scen;cm_multigasscen;c_EARLYRETIRE;cm_OILRETIRE;cm_LU_emi_scen;c_tradecost_bio;c_SSP_forcing_adjust;cm_APscen;cm_startyear;cm_stagestart;cm_stageend;c_refcapbnd;c_tau_so2_xmpt;path_gdx;path_gdx_bau;path_gdx_ref;path_gdx_opt;path_mif_bau;path_gdx_SSP2ref
+title;start;cm_iteration_max;c_solver_try_max;cm_bioenergy_tax;cm_SlowConvergence;climate;cm_iterative_target_adj;cm_gdximport_target;optimization;cm_postproc;cm_emiscen;carbonprice;cm_co2_tax_2020;cm_rcp_scen;cm_POPscen;cm_GDPscen;cm_oil_scen;cm_gas_scen;cm_coal_scen;c_feintensscen;c_techAssumptScen;cm_nucscen;c_ccscapratescen;c_biocostscen;c_1stgen_phaseout;cm_bioenergymaxscen;cm_fetaxscen;cm_so2tax_scen;cm_multigasscen;c_EARLYRETIRE;cm_OILRETIRE;cm_LU_emi_scen;cm_tradecost_bio;c_SSP_forcing_adjust;cm_APscen;cm_startyear;cm_stagestart;cm_stageend;c_refcapbnd;c_tau_so2_xmpt;path_gdx;path_gdx_bau;path_gdx_ref;path_gdx_opt;path_mif_bau;path_gdx_SSP2ref
 SSP1-Ref-SPA0;1;8;3;1.75;on;off;0;0;negishi;0;1;none;-1;none;pop_SSP1;gdp_SSP1;1;1;1;1;2;2;1;1;1;0;2;4;2;on;off;SSP1;1;forcing_SSP1;SSP1;2005;2020;2040;0;0;/p/projects/ssp/submission_v15_v16/remind16_v15_r6192/output/rem6192_SSP1-Ref-SPA0-rem-5/fulldata.gdx;;;;;
 SSP1-20-SPA0;1;8;3;1.75;on;magicc;2;1;negishi;0;6;none;-1;rcp20;pop_SSP1;gdp_SSP1;1;1;1;1;2;2;1;1;1;0;2;4;2;on;on;SSP1;1;forcing_SSP1;SSP1;2015;2020;2040;0;0;/p/projects/ssp/submission_v15_v16/remind16_v15_r6192/output/rem6192_SSP1-20-SPA0-rem-5/fulldata.gdx;/p/projects/ssp/submission_v15_v16/remind16_v15_r6192/output/rem6192_SSP1-Ref-SPA0-rem-5/fulldata.gdx;;;;
 SSP1-26-SPA0;1;8;3;1.75;on;magicc;2;1;negishi;0;6;none;-1;rcp26;pop_SSP1;gdp_SSP1;1;1;1;1;2;2;1;1;1;0;2;4;2;on;on;SSP1;1;forcing_SSP1;SSP1;2015;2020;2040;0;0;/p/projects/ssp/submission_v15_v16/remind16_v15_r6192/output/rem6192_SSP1-26-SPA0-rem-5/fulldata.gdx;/p/projects/ssp/submission_v15_v16/remind16_v15_r6192/output/rem6192_SSP1-Ref-SPA0-rem-5/fulldata.gdx;;;;
diff --git a/config/old_scenario_config/scenario_config_SSP_H12.csv b/config/old_scenario_config/scenario_config_SSP_H12.csv
index 5f6da1855b7588e843b3f341c6edb55b59a0d6bf..93ba1fd31bd28503b0b88b9051a80514adf667a2 100644
--- a/config/old_scenario_config/scenario_config_SSP_H12.csv
+++ b/config/old_scenario_config/scenario_config_SSP_H12.csv
@@ -1,4 +1,4 @@
-title;start;regionmapping;CES_parameters;cm_bioenergy_tax;cm_rcp_scen;cm_iterative_target_adj;c_budgetCO2;carbonprice;cm_co2_tax_2020;cm_emiscen;cm_earlyreti_rate;cm_fetaxscen;cm_co2_tax_growth;cm_bioenergymaxscen;c_ccsinjecratescen;techpol;cm_POPscen;cm_GDPscen;cm_oil_scen;cm_gas_scen;cm_coal_scen;c_techAssumptScen;cm_nucscen;cm_multigasscen;cm_OILRETIRE;cm_LU_emi_scen;c_tradecost_bio;c_SSP_forcing_adjust;cm_APscen;cm_startyear;path_gdx;path_gdx_ref;path_gdx_bau
+title;start;regionmapping;CES_parameters;cm_bioenergy_tax;cm_rcp_scen;cm_iterative_target_adj;c_budgetCO2;carbonprice;cm_co2_tax_2020;cm_emiscen;cm_earlyreti_rate;cm_fetaxscen;cm_co2_tax_growth;cm_bioenergymaxscen;c_ccsinjecratescen;techpol;cm_POPscen;cm_GDPscen;cm_oil_scen;cm_gas_scen;cm_coal_scen;c_techAssumptScen;cm_nucscen;cm_multigasscen;cm_OILRETIRE;cm_LU_emi_scen;cm_tradecost_bio;c_SSP_forcing_adjust;cm_APscen;cm_startyear;path_gdx;path_gdx_ref;path_gdx_bau
 SSP1-Base;1;./config/regionmappingH12.csv;load;1.75;none;0;0;none;-1;1;0.09;3;1.05;0;1;none;pop_SSP1;gdp_SSP1;lowOil;lowGas;lowCoal;2;2;2;off;SSP1;1;forcing_SSP1;SSP2;2005;./config/input.gdx;;
 SSP1-NDC;1;./config/regionmappingH12.csv;load;1.75;rcp45;3;0;NDC2018;1;9;0.09;3;1.05;0;1;NDC2018;pop_SSP1;gdp_SSP1;lowOil;lowGas;lowCoal;2;2;3;off;SSP1;1;forcing_SSP1;SSP2;2015;./config/input.gdx;SSP1-Base;SSP1-Base
 SSP1-NPi;0;./config/regionmappingH12.csv;load;1.75;rcp45;3;0;NPi2018;1;9;0.09;3;1.05;0;1;NPi2018;pop_SSP1;gdp_SSP1;lowOil;lowGas;lowCoal;2;2;3;off;SSP1;1;forcing_SSP1;SSP2;2025;./config/input.gdx;SSP1-NDC;SSP1-Base
diff --git a/config/old_scenario_config/scenario_config_Validation2018.csv b/config/old_scenario_config/scenario_config_Validation2018.csv
index 20dedffab9ce62ee65040c7d466090f789539cea..2052302f98fea9008e22fa9a07918bef4630ca1f 100644
--- a/config/old_scenario_config/scenario_config_Validation2018.csv
+++ b/config/old_scenario_config/scenario_config_Validation2018.csv
@@ -1,4 +1,4 @@
-title;start;cm_iteration_max;cm_bioenergy_tax;climate;c_budgetCO2;cm_iterative_target_adj;optimization;transport;buildings;industry;stationary;cm_emiscen;carbonprice;cm_co2_tax_2020;cm_rcp_scen;techpol;cm_multigasscen;cm_POPscen;cm_GDPscen;cm_oil_scen;cm_gas_scen;cm_coal_scen;c_feintensscen;c_techAssumptScen;cm_nucscen;c_ccscapratescen;c_1stgen_phaseout;cm_fetaxscen;cm_so2tax_scen;cm_OILRETIRE;cm_LU_emi_scen;c_tradecost_bio;c_SSP_forcing_adjust;cm_APscen;c_refcapbnd;c_tau_so2_xmpt;cm_startyear;path_gdx;path_gdx_ref;path_gdx_bau;path_gdx_opt
+title;start;cm_iteration_max;cm_bioenergy_tax;climate;c_budgetCO2;cm_iterative_target_adj;optimization;transport;buildings;industry;stationary;cm_emiscen;carbonprice;cm_co2_tax_2020;cm_rcp_scen;techpol;cm_multigasscen;cm_POPscen;cm_GDPscen;cm_oil_scen;cm_gas_scen;cm_coal_scen;c_feintensscen;c_techAssumptScen;cm_nucscen;c_ccscapratescen;c_1stgen_phaseout;cm_fetaxscen;cm_so2tax_scen;cm_OILRETIRE;cm_LU_emi_scen;cm_tradecost_bio;c_SSP_forcing_adjust;cm_APscen;c_refcapbnd;c_tau_so2_xmpt;cm_startyear;path_gdx;path_gdx_ref;path_gdx_bau;path_gdx_opt
 SSP1-Base;0;8;1.75;off;0;0;nash;complex;simple;fixed_shares;off;1;none;-1;none;none;2;pop_SSP1;gdp_SSP1;lowOil;lowGas;lowCoal;1;2;2;1;1;2;4;off;SSP1;1;forcing_SSP1;SSP1;0;0;2005;/p/projects/remind/runs/r7745/output/BAU_Nash_2018-01-18_14.42.32/fulldata.gdx;;;
 SSP1-Ref;0;8;1.75;off;0;3;nash;complex;simple;fixed_shares;off;9;RefPolicies;1;rcp60;RefPolicies;3;pop_SSP1;gdp_SSP1;lowOil;lowGas;lowCoal;1;2;2;1;1;2;4;off;SSP1;1;forcing_SSP1;SSP1;0;0;2025;/p/projects/remind/runs/r7745/output/BAU_Nash_2018-01-18_14.42.32/fulldata.gdx;SSP1-INDC;BAU;
 SSP1-INDC;0;8;1.75;off;0;3;nash;complex;simple;fixed_shares;off;9;NDC;1;rcp45;NDC;3;pop_SSP1;gdp_SSP1;lowOil;lowGas;lowCoal;1;2;2;1;1;2;4;off;SSP1;1;forcing_SSP1;SSP1;0;0;2015;/p/projects/remind/runs/r7745/output/BAU_Nash_2018-01-18_14.42.32/fulldata.gdx;SSP1-Base;REF;
diff --git a/config/old_scenario_config/scenario_config_calibrateSSPs.csv b/config/old_scenario_config/scenario_config_calibrateSSPs.csv
index 5343f274dc22da7b8fd7f5ab20cf89bfcda705d5..4497b436a7bfbe0588afcef1a2a92714bf8c6756 100644
--- a/config/old_scenario_config/scenario_config_calibrateSSPs.csv
+++ b/config/old_scenario_config/scenario_config_calibrateSSPs.csv
@@ -1,4 +1,4 @@
-title;start;CES_parameters;regionmapping;capitalMarket;c_CES_calibration_new_structure;c_CES_calibration_iterations;cm_iteration_max;c_solver_try_max;cm_bioenergy_tax;climate;c_budgetCO2;cm_iterative_target_adj;optimization;transport;buildings;industry;stationary;cm_emiscen;carbonprice;cm_co2_tax_2020;cm_rcp_scen;techpol;cm_multigasscen;cm_POPscen;cm_GDPscen;cm_oil_scen;cm_gas_scen;cm_coal_scen;c_techAssumptScen;cm_nucscen;c_ccscapratescen;c_biocostscen;c_1stgen_phaseout;cm_fetaxscen;cm_so2tax_scen;cm_OILRETIRE;cm_LU_emi_scen;c_tradecost_bio;c_SSP_forcing_adjust;c_refcapbnd;c_tau_so2_xmpt;cm_startyear;path_gdx;path_gdx_ref;path_gdx_bau;path_gdx_opt
+title;start;CES_parameters;regionmapping;capitalMarket;c_CES_calibration_new_structure;c_CES_calibration_iterations;cm_iteration_max;c_solver_try_max;cm_bioenergy_tax;climate;c_budgetCO2;cm_iterative_target_adj;optimization;transport;buildings;industry;stationary;cm_emiscen;carbonprice;cm_co2_tax_2020;cm_rcp_scen;techpol;cm_multigasscen;cm_POPscen;cm_GDPscen;cm_oil_scen;cm_gas_scen;cm_coal_scen;c_techAssumptScen;cm_nucscen;c_ccscapratescen;c_biocostscen;c_1stgen_phaseout;cm_fetaxscen;cm_so2tax_scen;cm_OILRETIRE;cm_LU_emi_scen;cm_tradecost_bio;c_SSP_forcing_adjust;c_refcapbnd;c_tau_so2_xmpt;cm_startyear;path_gdx;path_gdx_ref;path_gdx_bau;path_gdx_opt
 calibrate_SSP1_bit;0;calibrate;config/regionmappingH12.csv;perfect;0;10;8;3;1.75;off;0;0;nash;complex;simple;fixed_shares;off;1;none;-1;none;none;2;pop_SSP1;gdp_SSP1;lowOil;lowGas;lowCoal;2;2;1;1;1;2;4;off;SSP1;1;forcing_SSP1;0;0;2005;/p/tmp/levesque/Remind/r_6651_SSP/output/calibrate_SSP1_postIIASA_2016-09-01_16.46.27/fulldata.gdx;;;
 calibrate_SSP2_bit;1;calibrate;config/regionmappingREMIND.csv;perfect;0;10;8;3;1;off;0;0;nash;complex;simple;fixed_shares;off;1;none;-1;none;none;2;pop_SSP2;gdp_SSP2;medOil;medGas;medCoal;1;2;1;2;0;3;1;off;SSP2;2;forcing_SSP2;0;0;2005;config/input_H12.gdx;;;
 calibrate_SSP2_bit_H12;0;calibrate;config/regionmappingH12.csv;perfect;0;10;8;3;1;off;0;0;nash;complex;simple;fixed_shares;off;1;none;-1;none;none;2;pop_SSP2;gdp_SSP2;medOil;medGas;medCoal;1;2;1;2;0;3;1;off;SSP2;2;forcing_SSP2;0;0;2005;config/input_H12.gdx;;;
diff --git a/config/old_scenario_config/scenario_config_calibrateSSPs_H12.csv b/config/old_scenario_config/scenario_config_calibrateSSPs_H12.csv
index ad52fcd9d267a5b915c4ae02f04699edd5ea5ce8..85de3744ad43269ad43400b0d016ec9588ec5a6f 100644
--- a/config/old_scenario_config/scenario_config_calibrateSSPs_H12.csv
+++ b/config/old_scenario_config/scenario_config_calibrateSSPs_H12.csv
@@ -1,4 +1,4 @@
-title;start;CES_parameters;regionmapping;capitalMarket;c_CES_calibration_new_structure;c_CES_calibration_iterations;cm_iteration_max;c_solver_try_max;cm_bioenergy_tax;climate;c_budgetCO2;cm_iterative_target_adj;optimization;transport;buildings;industry;stationary;cm_emiscen;carbonprice;cm_co2_tax_2020;cm_rcp_scen;techpol;cm_multigasscen;cm_POPscen;cm_GDPscen;cm_oil_scen;cm_gas_scen;cm_coal_scen;c_techAssumptScen;cm_nucscen;c_ccscapratescen;c_1stgen_phaseout;cm_fetaxscen;cm_so2tax_scen;cm_OILRETIRE;cm_LU_emi_scen;c_tradecost_bio;c_SSP_forcing_adjust;c_refcapbnd;c_tau_so2_xmpt;cm_startyear;path_gdx;path_gdx_ref;path_gdx_bau;path_gdx_opt
+title;start;CES_parameters;regionmapping;capitalMarket;c_CES_calibration_new_structure;c_CES_calibration_iterations;cm_iteration_max;c_solver_try_max;cm_bioenergy_tax;climate;c_budgetCO2;cm_iterative_target_adj;optimization;transport;buildings;industry;stationary;cm_emiscen;carbonprice;cm_co2_tax_2020;cm_rcp_scen;techpol;cm_multigasscen;cm_POPscen;cm_GDPscen;cm_oil_scen;cm_gas_scen;cm_coal_scen;c_techAssumptScen;cm_nucscen;c_ccscapratescen;c_1stgen_phaseout;cm_fetaxscen;cm_so2tax_scen;cm_OILRETIRE;cm_LU_emi_scen;cm_tradecost_bio;c_SSP_forcing_adjust;c_refcapbnd;c_tau_so2_xmpt;cm_startyear;path_gdx;path_gdx_ref;path_gdx_bau;path_gdx_opt
 calibrate_SSP1_bit;1;calibrate;config/regionmappingH12.csv;perfect;0;10;8;3;1.75;off;0;0;nash;complex;simple;fixed_shares;off;1;none;-1;none;none;2;pop_SSP1;gdp_SSP1;lowOil;lowGas;lowCoal;2;2;1;1;2;4;off;SSP1;1;forcing_SSP1;0;0;2005;/home/levesque/gdx/r8018_H12_SSP1.gdx;;;
 calibrate_SSP2_bit;1;calibrate;config/regionmappingH12.csv;perfect;0;10;8;3;1;off;0;0;nash;complex;simple;fixed_shares;off;1;none;-1;none;none;2;pop_SSP2;gdp_SSP2;medOil;medGas;medCoal;2;2;1;0;3;1;off;SSP2;2;forcing_SSP2;0;0;2005;/home/levesque/gdx/r8018_H12_SSP2.gdx;;;
 calibrate_SSP5_bit;1;calibrate;config/regionmappingH12.csv;perfect;0;10;8;3;1.75;off;0;0;nash;complex;simple;fixed_shares;off;1;none;-1;none;none;2;pop_SSP5;gdp_SSP5;highOil;highGas;highCoal;3;6;2;1;1;4;off;SSP5;1;forcing_SSP5;1;0.5;2005;/home/levesque/gdx/r8018_H12_SSP5.gdx;;;
diff --git a/config/oneRegi.cfg b/config/oneRegi.cfg
index 6697230e831d956809cfc4daa01a04619d2898b4..eda20deb98c2831e72e864fa550b8d27888a28a3 100644
--- a/config/oneRegi.cfg
+++ b/config/oneRegi.cfg
@@ -268,7 +268,7 @@ cfg$gms$c_solscen              <-  1  #  def  <-  1
 
 cfg$gms$cm_bioenergy_tax     <- 1.5     # def <- 1.5
 cfg$gms$cm_bioenergymaxscen  <- 0       # def <- 0
-cfg$gms$c_tradecost_bio      <- 2       # def <- 2
+cfg$gms$cm_tradecost_bio      <- 2       # def <- 2
 cfg$gms$cm_LU_emi_scen       <- "SSP2"  # def <- "SSP2"
 cfg$gms$c_1stgen_phaseout   <- 0       # def <- 0
 
@@ -330,7 +330,7 @@ cfg$gms$cm_esubGrowth         <- "low" #def <- "low"
 
 cfg$gms$cm_cooling_shares               <- "static"   # def <- "static", or "dynamic"
 cfg$gms$cm_techcosts                    <- "REG"      # def <- "REG", or "GLO"
-cfg$gms$c_trdcst                        <- 1.5     # def <- 1.5
+cfg$gms$cm_trdcst                        <- 1.5     # def <- 1.5
 cfg$gms$cm_trdadj                       <- 2.0     # def <- 2.0
 cfg$gms$c_refcapbnd                     <- 0       # def <- 0
 cfg$gms$cm_frac_CCS                     <- 10      # def <- 10
@@ -524,7 +524,7 @@ cfg$RunsUsingTHISgdxAsBAU <- NA
 #  (2): 200 EJ global bioenergy potential (bound in boundsextra.inc)
 #  (3): 300 EJ global bioenergy potential (bound in boundsextra.inc)
 #  (4): 152 EJ global bioenergy potential, i.e. 100 EJ 2nd generation (bound in boundsextra.inc)
-# c_tradecost_bio  "choose financal tradecosts for biomass (purpose grown pebiolc)"
+# cm_tradecost_bio  "choose financal tradecosts for biomass (purpose grown pebiolc)"
 #  (1): low   tradecosts (for other SSP scenarios than SSP2)
 #  (2): high  tradecosts (default and SSP2)
 # cm_LU_emi_scen   "choose emission baseline for CO2, CH4, and N2O land use emissions from MAgPIE"
@@ -716,7 +716,7 @@ cfg$RunsUsingTHISgdxAsBAU <- NA
 # vm_peprod   = "vm_prodPe",
 # v_sedem     = "v_demSe,v_demSe = "vm_demSe"
 # p_nw into p80_nw,c_nucscen into cm_nucscen, q_co2eq into qm_co2eq. qm_co2eq into q_co2eq
-# pm_costsPEtradeMp into p_costsPEtradeMp, vm_welfare into v_welfare
+# pm_costsPEtradeMp into pm_costsPEtradeMp, vm_welfare into v_welfare
 # pm_tau_fe_sub into p21_tau_fe_sub, pm_tau_fe_tax into p21_tau_fe_tax
 # pm_datapop into pm_pop, p_datalab into p_lab, p_lab into pm_lab
 # p80_pvp into pm_pvp, p80_pvpRegi into pm_pvpRegi
@@ -726,7 +726,7 @@ cfg$RunsUsingTHISgdxAsBAU <- NA
 # s_GWP_CH4 into s_gwpCH4, s_GWP_N2O into s_gwpN2O, sm_tgn2pgc into s_tgn_2_pgc, sm_tgch42pg into s_tgch4_2_pgc
 # v_ccs into v_co2CCS, v_co2CCS into vm_co2CCS, vm_costfu into vm_costFu, v_costin into v_costInv, v_costom into v_costOM, vm_costfu_bio into vm_costFuBio, vm_costfu_ex into vm_costFuEx
 # v_adjustteinv into v_costInvTeAdj, v_adj into v_adjFactor, v_adj_glob into v_adjFactorGlob, v_directteinv into v_costInvTeDir
-# vm_capCum into vm_capCum, v_inconvpen into v_inconvPen, v_invest_adjcosts into v_invMacroAdj
+# vm_capCum into vm_capCum, v_inconvpen into v_inconvPen, v_invest_adjcosts into v01_invMacroAdj
 # v_capini into v_INIcap0, v_earlyreti into v_capEarlyReti, v_emi into vm_emiTeDetail, v_gridshare into v_shGrid, v_shareseel into v_shSeEl, v_shSeEl into v32_shSeEl
 # v_investcost into v_costTeCapital, v_storshare into v_shStor, v_shStor into v32_shStor, v_edemini into v_INIdemEn0, vm_esprod into vm_prodEs, vm_forc_os into vm_forcOS
 # vm_fuelex into vm_fuExtr, vm_taxrev into vm_taxRev, v_capEarlyReti into vm_capEarlyReti
@@ -767,8 +767,8 @@ cfg$RunsUsingTHISgdxAsBAU <- NA
 # q_emissengregi into q_emiTe, q_eminegregi into q_emiMacSector, q_co2bioexp into q_macBaseCo2bioexp, q_sumeminegregi into q_emiMac, q_emissions into q_emiAll, q_emissionsGlob into q_emiAllGlob
 # q_emiconst into q_emiCap, q_emibudget1Glob into q_budgetCO2eqGlob, q_ccsbal ionto q_balCCS, q_ccstrans into q_transCCS, q_ccsconst itnto q_limitCCS, q_so2constraint into q_limitSo2
 # q_co2constraint into q_limitCO2, q_eqadj into q_adjFactor, q_operating_reserve into q_operatingReserve, q_operatingReserve into q32_operatingReserve, q_nocoldreserve into q_limitCapEarlyReti, q_smoothphaseout into q_smoothphaseoutCapEarlyReti
-# q_inconvpen into q_inconvPen, q_labbal into q_balLab, q_production into q_cesIO, q_kapmo into q_kapMo, q_invest_adjcosts into q_invMacroAdj, q_limit_ppfen_shares into q_limitShPpfen
-# q_limit_ppfen_ratios into q_limtRatioPpfen, q_limit_seel2fehes into q_limitSeel2fehes, q_min_oil_share into q_limitShOil, q80_tradebal into q80_balTrade, q35_share_espet into q35_shEsPeT
+# q_inconvpen into q_inconvPen, q_labbal into q01_balLab, q_production into q01_cesIO, q_kapmo into q01_kapMo, q_invest_adjcosts into q01_invMacroAdj, q_limit_ppfen_shares into q01_limitShPpfen
+# q_limit_ppfen_ratios into q01_limtRatioPpfen, q_limit_seel2fehes into q_limitSeel2fehes, q_min_oil_share into q_limitShOil, q80_tradebal into q80_balTrade, q35_share_espet into q35_shEsPeT
 # q31_costfu_ex into q31_costFuExPol q31_costfu_ex_step into q31_costFuExGrade, q31_fuelex_cum into q31_fuExtrCum, q31_fuelex_dec into q31_fuExtrDec, q31_fuelex_inc into q31_fuExtrInc,
 # q30_costfu_bio into q30_costFuBio, q30_limit_bioexport into q30_limitXpBio, q30_limit_bio into q30_limitTeBio, p35_bunker_share_in_nonldv_fe into pm_bunker_share_in_nonldv_fe
 # v_tempSlow into v10_tempSlow,f_dataemiglob into fm_dataemiglob, f_dataglob into fm_dataglob, p_dt into pm_dt, p_prodCouple into pm_prodCouple, p_dataeta into pm_dataeta,p_eta_conv into pm_eta_conv
diff --git a/config/scenario_config_SSPSDP.csv b/config/scenario_config_SSPSDP.csv
index 54dedb928c35bb2f4a4ffab495f042730fdf0e6d..52b781725e20807d9c994072cf16a934a701861b 100644
--- a/config/scenario_config_SSPSDP.csv
+++ b/config/scenario_config_SSPSDP.csv
@@ -1,4 +1,4 @@
-title;start;regionmapping;CES_parameters;cm_bioenergy_tax;cm_rcp_scen;cm_iterative_target_adj;cm_nash_autoconverge;cm_iteration_max;c_budgetCO2;carbonprice;cm_co2_tax_2020;cm_peakBudgYr;cm_taxCO2inc_after_peakBudgYr;cm_CO2priceRegConvEndYr;cm_emiscen;cm_earlyreti_rate;cm_fetaxscen;cm_co2_tax_growth;cm_bioenergymaxscen;c_ccsinjecratescen;c_ccscapratescen;techpol;cm_POPscen;cm_GDPscen;cm_oil_scen;cm_gas_scen;cm_coal_scen;c_techAssumptScen;cm_nucscen;cm_so2tax_scen;cm_multigasscen;cm_OILRETIRE;cm_LU_emi_scen;c_tradecost_bio;c_1stgen_phaseout;c_SSP_forcing_adjust;cm_APscen;cm_startyear;path_gdx;path_gdx_ref;path_gdx_bau
+title;start;regionmapping;CES_parameters;cm_bioenergy_tax;cm_rcp_scen;cm_iterative_target_adj;cm_nash_autoconverge;cm_iteration_max;c_budgetCO2;carbonprice;cm_co2_tax_2020;cm_peakBudgYr;cm_taxCO2inc_after_peakBudgYr;cm_CO2priceRegConvEndYr;cm_emiscen;cm_earlyreti_rate;cm_fetaxscen;cm_co2_tax_growth;cm_bioenergymaxscen;c_ccsinjecratescen;c_ccscapratescen;techpol;cm_POPscen;cm_GDPscen;cm_oil_scen;cm_gas_scen;cm_coal_scen;c_techAssumptScen;cm_nucscen;cm_so2tax_scen;cm_multigasscen;cm_OILRETIRE;cm_LU_emi_scen;cm_tradecost_bio;c_1stgen_phaseout;c_SSP_forcing_adjust;cm_APscen;cm_startyear;path_gdx;path_gdx_ref;path_gdx_bau
 SSP1-calibrate;0;./config/regionmappingH12.csv;calibrate;1.75;none;0;1;1;0;none;-1;2100;3;2050;1;0.09;2;1.025;0;2;1;none;pop_SSP1;gdp_SSP1;lowOil;lowGas;lowCoal;2;2;4;2;off;SSP1;1;1;forcing_SSP1;SSP1;2005;./config/input.gdx;;
 SSP1-Base;1;./config/regionmappingH12.csv;load;1.75;none;0;1;1;0;none;-1;2100;3;2050;1;0.09;2;1.025;0;2;1;none;pop_SSP1;gdp_SSP1;lowOil;lowGas;lowCoal;2;2;4;2;off;SSP1;1;1;forcing_SSP1;SSP1;2005;./config/input.gdx;;
 SSP1-NDC;1;./config/regionmappingH12.csv;load;1.75;rcp45;3;1;1;0;NDC2018;1;2100;3;2050;9;0.09;2;1.025;0;2;1;NDC2018;pop_SSP1;gdp_SSP1;lowOil;lowGas;lowCoal;2;2;4;3;off;SSP1;1;1;forcing_SSP1;SSP1;2015;./config/input.gdx;SSP2-NDC;SSP1-Base
diff --git a/core/bounds.gms b/core/bounds.gms
index 1f37ad4a337c948b3463d33b730d9bfa5072dfd0..caa86b3a1a6d8fa339f2291ccbf95905fcfcefe6 100755
--- a/core/bounds.gms
+++ b/core/bounds.gms
@@ -255,18 +255,6 @@ if (cm_emiscen ne 1,
 );
 
 
-*** -----------------------------------------------------------
-*** no permit trade allowed in BAU and tax scenarios:
-*** -----------------------------------------------------------
-if (cm_emiscen = 1 or cm_emiscen = 9,
-   vm_Xport.fx(t,regi,"perm") = 0;
-   vm_Mport.fx(t,regi,"perm") = 0;
-else
-   vm_Xport.fx("2005",regi,"perm") = 0;
-   vm_Mport.fx("2005",regi,"perm") = 0;
-   vm_Xport.fx("2010",regi,"perm") = 0;
-   vm_Mport.fx("2010",regi,"perm") = 0;
-);
 
 *** -----------------------------------------------------------
 *mh bounds that narrow the solution space to help the conopt solver:
@@ -281,10 +269,7 @@ vm_costTeCapital.lo(t,regi,teLearn) = pm_data(regi,"floorcost",teLearn);
 *cb 20120319 avoid negative adjustment costs in 2005 (they would allow the model to artificially save money)
 v_adjFactor.fx("2005",regi,te)=0;
 
-*nb* lower bounds on CES values
-vm_cesIO.lo(t,regi,in) = 1e-6;
-vm_cesIOdelta.lo(t,regi,in_putty) = 1e-6;
-vm_cons.lo(t,regi)     = 1e-3;
+
 
 vm_emiMacSector.lo(t,regi,enty)    =  0;    
 vm_emiMacSector.lo(t,regi,"co2luc")= -5.0;  !! afforestation can lead to negative emissions
@@ -369,9 +354,6 @@ vm_capEarlyReti.lo(ttot,regi,"tnrs")$(ttot.val gt 2011 AND ttot.val lt 2111) = 0
 *cb 20120301 no early retirement for dot, they are used despite their economic non-competitiveness for various reasons.
 vm_capEarlyReti.fx(ttot,regi,"dot")=0;
 
-*nb fix energy inputs to CES structure in t0 to the parameter values
-vm_cesIO.fx(t0(tall),regi,in)$(ppfEn(in) OR ppfIO_putty(in)) = pm_cesdata(tall,regi,in,"quantity");
-vm_cesIOdelta.fx(t0(tall),regi,in)$(ppfEn(in) OR in_putty(in)) = pm_cesdata_putty(tall,regi,in,"quantity");
 *** -----------------------------------------------------------------------------
 *DK 20100929 Bound on CCS injection rate 
 *** -----------------------------------------------------------------------------
@@ -394,87 +376,9 @@ if ( c_ccsinjecratescen gt 0,
 *AJS*02122014 Exclude this bound in nash cases, as trying to limit global emissions there will lead to infeasibilities
 $ifi %optimization% == "negishi" if( (cm_startyear le 2010 AND cm_emiscen > 1), vm_emiAllGlob.fx('2010','co2') = 8.9 + 1.46; ); !! 8.9 is fossil emissions + cement, 1.4 land use
 
-*** set Mport and Xport positive
-vm_Mport.lo(ttot,regi,tradePe)$(ttot.val ge 2005) = 0;
-vm_Xport.lo(ttot,regi,tradePe)$(ttot.val ge 2005) = 0;
 
-*NB*110625 fix 2005 trade values to historic values
-*RR*Added correction factor to match fossil supply and internal region energy demand in the initial year if necessary
-*SB*190514 Made the correction factor for insufficient imports conditional on the fossil module realization
 
-*** Mports fixing for fossils in the initial year 
-loop( regi,
-    loop (enty$peFos(enty),
-*** if imports minus exports is higher than initial year demand there is a surplus of pe in the region. Correction -> set imports to 80% of the region pe demand plus Xports in the initial year
-        if ( (pm_EN_demand_from_initialcap2(regi,enty) < (1-p_costsPEtradeMp(regi,enty))*pm_IO_trade("2005",regi,enty,"Mport") -  pm_IO_trade("2005",regi,enty,"Xport")),     !!region has more available pe through trade than it needs
-            p_Mport2005correct(regi,enty) = (pm_EN_demand_from_initialcap2(regi,enty) + pm_IO_trade("2005",regi,enty,"Xport")) - pm_IO_trade("2005",regi,enty,"Mport");
-        );
-*** if internal region production (plus trade) is not enough to provide the energy demand. Correction ->  set imports to the difference between region energy demand (pm_EN_demand_from_initialcap2) and the internal production (pm_ffPolyCumEx(regi,enty,"max")) plus the trade balance (Mports-Xports) 
-$iftheni.fossil_realization %cfg$gms$fossil% == "timeDepGrades"
-        if ( pm_prodIni(regi,enty) + (1-p_costsPEtradeMp(regi,enty))*(pm_IO_trade("2005",regi,enty,"Mport")+ p_Mport2005correct(regi,enty)) -  pm_IO_trade("2005",regi,enty,"Xport") < pm_EN_demand_from_initialcap2(regi,enty),     !!region has a unbalance
-            p_Mport2005correct(regi,enty) = pm_EN_demand_from_initialcap2(regi,enty)  - ((1-p_costsPEtradeMp(regi,enty))*pm_IO_trade("2005",regi,enty,"Mport") -  pm_IO_trade("2005",regi,enty,"Xport")) - pm_prodIni(regi,enty) ;  !! SB: use pm_prodIni as an analog for pm_ffPolyCumEx(regi,enty,"max"), which does not exist in timeDepGrades
-        );
-$elseifi.fossil_realization %cfg$gms$fossil% == "grades2poly"
-        if ( (pm_ffPolyCumEx(regi,enty,"max") / (5*4)) + (1-p_costsPEtradeMp(regi,enty))*(pm_IO_trade("2005",regi,enty,"Mport")+ p_Mport2005correct(regi,enty)) -  pm_IO_trade("2005",regi,enty,"Xport") < pm_EN_demand_from_initialcap2(regi,enty),     !!region has a unbalance
-            p_Mport2005correct(regi,enty) = pm_EN_demand_from_initialcap2(regi,enty)  - ((1-p_costsPEtradeMp(regi,enty))*pm_IO_trade("2005",regi,enty,"Mport") -  pm_IO_trade("2005",regi,enty,"Xport")) - pm_ffPolyCumEx(regi,enty,"max") / (5*4) ;  !!pm_ffPolyCumEx(regi,enty,"max") is a 5 years value, so we dived by 5 to get the annual value and additionally we assume that if all the extraction is made in the first years, this would take a t least 4 time steps to completely exhaust the resources 
-        );
-$endif.fossil_realization
-    );
-);
-vm_Mport.fx(t0(tall),regi,peFos(enty)) = pm_IO_trade(t0,regi,enty,"Mport") + p_Mport2005correct(regi,enty);
-
-*** Xports fixing for fossils in the initial year (with added exports to compensate for the Mports corrections above)
-loop( regi,
-    loop (enty$peFos(enty),
-        if ( (p_Mport2005correct(regi,enty) = 0),
-            vm_Xport.fx(t0(tall),regi,peFos(enty)) = pm_IO_trade(t0,regi,enty,"Xport") +
-                   ( pm_IO_trade(t0,regi,enty,"Xport") / sum((regi2)$(NOT (p_Mport2005correct(regi,enty))),pm_IO_trade(t0,regi2,enty,"Xport")) ) !! share of region Xports between regions with no balance problems
-                   * sum((regi2),p_Mport2005correct(regi2,enty)) !! total unbalance problem
-            ;
-        else
-            vm_Xport.fx(t0(tall),regi,peFos(enty)) = pm_IO_trade(t0,regi,enty,"Xport") ;
-        );
-    );
-); 
-
-*** if region has no internal resources, demand must be entirely provided by trade (Switzerland problem). Correction ->  set imports free, exports zero. Warning: if the region is big enough this could cause a trade unbalance. The first best solution would be to calculate the exact imports amount needed and add extra exports to other countries to compensate for this exact amount.
-loop( regi,
-    loop (enty$peFos(enty),
-$iftheni.timeDepGrades %cfg$gms$fossil% == "timeDepGrades"
-        if ( (pm_fuelex_cum("2005",regi,enty,1) = 0),
-            vm_Xport.fx(t0(tall),regi,peFos(enty)) = 0;
-            vm_Mport.up(t0(tall),regi,peFos(enty)) = 1e10;
-            vm_Mport.lo(t0(tall),regi,peFos(enty)) = 1e-6;
-        );
-$elseifi.timeDepGrades %cfg$gms$fossil% == "grades2poly"
-        if ( (pm_ffPolyCumEx(regi,enty,"max") = 0),
-            vm_Xport.fx(t0(tall),regi,peFos(enty)) = 0;
-            vm_Mport.up(t0(tall),regi,peFos(enty)) = 1e10;
-            vm_Mport.lo(t0(tall),regi,peFos(enty)) = 1e-6;
-        );
-$endif.timeDepGrades
-    );
-);
-
-*** bounds on oil exports in 2010 and 2015
-vm_Xport.lo("2010",regi,"peoil") = 0.95 * pm_IO_trade("2010",regi,"peoil","Xport");
-vm_Xport.up("2010",regi,"peoil") = 1.05 * pm_IO_trade("2010",regi,"peoil","Xport");
-vm_Xport.lo("2015",regi,"peoil") = 0.95 * pm_IO_trade("2015",regi,"peoil","Xport");
-vm_Xport.up("2015",regi,"peoil") = 1.05 * pm_IO_trade("2015",regi,"peoil","Xport");
-
-*** upper bounds ( 1% yearly growth rate) on all big oil exporters (more than 15EJ in 2010) in 2020, 2025 and 2030
-loop(regi,
-      if( (pm_IO_trade("2010",regi,"peoil","Xport") ge (15*sm_EJ_2_TWa)),
-        vm_Xport.up("2020",regi,"peoil") = ((1 + 0.02) **  10) * pm_IO_trade("2010",regi,"peoil","Xport");
-        vm_Xport.up("2025",regi,"peoil") = ((1 + 0.02) **  15) * pm_IO_trade("2010",regi,"peoil","Xport");
-        vm_Xport.up("2030",regi,"peoil") = ((1 + 0.02) **  20) * pm_IO_trade("2010",regi,"peoil","Xport");
-      );
-);
 
-*** set macro investments to bound in 2005
-vm_invMacro.fx("2005",regi,"kap") = p_boundInvMacro(regi);
-*cb 2012-05-23 lower bound for capital investment to avoid "zero investment" problem for the conopt solver
-vm_invMacro.lo(t,regi,"kap")$(t.val gt 2005) = 0.01 * vm_invMacro.lo("2005",regi,"kap");
 
 *** strong reliance on coal-to-liquids is not consistent with SSP1 storyline, therefore limit their use in the SSP 1 and SSP2 policy scenarios
 $ifthen %c_SSP_forcing_adjust% == "forcing_SSP1"
diff --git a/core/datainput.gms b/core/datainput.gms
index d363a9618b03797cff28e134a8be06bb0ff6ec85..c66719be62df33cd0bfb19db1afae2f72a9ca7be 100644
--- a/core/datainput.gms
+++ b/core/datainput.gms
@@ -110,18 +110,6 @@ $offdelim
 ;
 p_developmentState(tall,all_regi) = f_developmentState(tall,all_regi,"%c_GDPpcScen%");
 
-*** load data for macro investments in 2005, used as bound
-parameter p_boundInvMacro(all_regi)        "macro investments in 2005"
-/
-$ondelim
-$include "./core/input/p_boundInvMacro.cs4r"
-$offdelim
-/
-;
-p_boundInvMacro(all_regi) = p_boundInvMacro(all_regi) * pm_shPPPMER(all_regi);
-
-*ML* Reintroduction of trade cost for composite good (based on export/import value difference for non-energy goods in GTAP6)
-p_tradecostgood(regi)        = 0.03;
 
 *** Load information from BAU run
 $ifthen.cm_compile_main %cm_compile_main% == "TRUE"
@@ -137,15 +125,12 @@ $endif.cm_compile_main
 *** permit price initilization
 pm_pricePerm(ttot) = 0;
 
-*** depreciation rate of capital
-pm_delta_kap(regi,"kap") = 0.05;
 
 *------------------------------------------------------------------------------------
 *------------------------------------------------------------------------------------
 ***                                ESM
 *------------------------------------------------------------------------------------
 *------------------------------------------------------------------------------------
-pm_Xport0("2005",regi,peFos) = 0;
 
 *** default conversion for energy services
 pm_fe2es(ttot,regi,teEs) = 1;
@@ -342,30 +327,6 @@ loop(emi2te(enty,enty2,te,enty3)$teCCS(te),
 p_boundtmp(ttot,all_regi,te,rlf)$(ttot.val ge 2005)       = 0;
 p_bound_cap(ttot,all_regi,te,rlf)$(ttot.val ge 2005)       = 0;
 
-*** load data on transportation costs
-parameter p_costsPEtradeMp(all_regi,all_enty)         "PE tradecosts (energy losses on import)"
-/
-$ondelim
-$include "./core/input/p_costsPEtradeMp.cs4r"
-$offdelim
-/
-;
-table pm_costsTradePeFinancial(all_regi,char,all_enty)        "Financial costs on import, export and use of primary energy"
-$ondelim
-$include "./core/input/pm_costsTradePeFinancial.cs3r"
-$offdelim
-;
-pm_costsTradePeFinancial(regi,"XportElasticity", tradePe(enty)) = 100;
-pm_costsTradePeFinancial(regi, "tradeFloor", tradePe(enty))     = 0.0125;
-
-*DK* Only for SSP cases other than SSP2: use default trade costs
-if(c_tradecost_bio = 1,
-pm_costsTradePeFinancial(regi,"Xport", "pebiolc") = pm_costsTradePeFinancial(regi,"Xport", "pebiolc")/2;
-);
-
-pm_costsTradePeFinancial(regi,"Xport", "pegas") = c_trdcst * pm_costsTradePeFinancial(regi,"Xport", "pegas") ;
-pm_costsTradePeFinancial(regi,"XportElasticity","pegas") = cm_trdadj *pm_costsTradePeFinancial(regi,"XportElasticity","pegas");
-
 *NB* include data and parameters for upper bounds on fossil fuel transport
 parameter f_IO_trade(tall,all_regi,all_enty,char)        "Energy trade bounds based on IEA data"
 /
diff --git a/core/declarations.gms b/core/declarations.gms
index b8334551080b002c09d949ae5a1d31b57977c610..24c678af81d2a9e61fcf1ed4c81db2fb1a5deb96 100644
--- a/core/declarations.gms
+++ b/core/declarations.gms
@@ -25,8 +25,8 @@ pm_pricePerm(ttot)                                   "permit price in special ca
                                                   
 p_share(ttot,all_regi,all_in,all_in)                 "share of production factors"
 pm_share_trans(tall,all_regi)                        "transportation share"
-pm_gdp_gdx(tall,all_regi)                            "GDP path from gdx, updated iteratively"
-p_inv_gdx(tall,all_regi)                             "macro-investments  path from gdx, updated iteratively"
+pm_gdp_gdx(tall,all_regi)                            "GDP path from gdx, updated iteratively."   
+p_inv_gdx(tall,all_regi)                            "macro-investments path from gdx, updated iteratively."
 pm_taxCO2eq(ttot,all_regi)                           "CO2 tax path in T$/GtC = $/kgC. To get $/tCO2, multiply with 272 [T$/GtC]"
 pm_taxCO2eqHist(ttot,all_regi)                       "Historic CO2 tax path in 2010 and 2015 (also in BAU!) in T$/GtC = $/kgC. To get $/tCO2, multiply with 272 [T$/GtC]"
 pm_taxCO2eq_iteration(iteration,ttot,all_regi)       "save CO2eq tax used in iteration"
@@ -35,10 +35,8 @@ p_taxCO2eq_iterationdiff_tmp(ttot,all_regi)          "help parameter for iterati
 o_taxCO2eq_iterDiff_Itr(iteration,all_regi) "track p_taxCO2eq_iterationdiff over iterations"
 pm_emissionsForeign(tall,all_regi,all_enty)          "total emissions of other regions (nash relevant)"
 pm_co2eqForeign(tall,all_regi)                       "emissions, which are part of the climate policy, of other regions (nash relevant)"
-pm_Xport0(tall,all_regi,all_enty)                    "reference level value of export"
 pm_cesdata(tall,all_regi,all_in,cesParameter)        "parameters of the CES function"
 pm_cesdata_putty(tall,all_regi,all_in,cesParameter)  "quantities for the putty clay factors"
-pm_delta_kap(all_regi,all_in)                        "depreciation rate of capital"
 pm_capital_lifetime_exp(all_regi,all_in)             "number of years for which 25% of the CES capital stocks remains"
 f_pop(tall,all_regi,all_POPscen)                     "population data for all possible scenarios"
 pm_pop(tall,all_regi)                                "population data [bn people]"
@@ -46,10 +44,7 @@ pm_gdp(tall,all_regi)                                "GDP data [trn US$ 2005]"
 p_developmentState(tall,all_regi)                    "level of development based on GDP per capita"
 f_lab(tall,all_regi,all_POPscen)                     "labour data for all possible scenarios"
 pm_lab(tall,all_regi)                                "data for labour [bn people]"
-pm_IO_trade(tall,all_regi,all_enty,char)             "Energy trade bounds based on IEA data"
 pm_esCapCost(tall,all_regi,all_teEs)                 "Capital energy cost per unit of consumption for end-use capital (energy service layer)"
-pm_ppfen_ratios(all_in,all_in)                       "limit ratio of two primary production factors of energy (ppfEn)"
-pm_ppfen_shares(all_in,all_in)                       "limit the share of one ppfEn in total CES nest inputs"
 
 
 pm_cesdata_sigma(ttot,all_in)                        "elasticities of substitution"
@@ -176,7 +171,6 @@ pm_damageGrowthRate(tall,all_regi)                   "damage function for growth
 pm_damageMarginal(tall,all_regi)                     "damage function derivative"
 pm_taxCO2eqSCC(ttot,all_regi)                        "carbon tax component due to damages (social cost of carbon) "
 
-pm_consPC(tall,all_regi)                             "consumption per capita"
 pm_GDPGross(tall,all_regi)                           "gross GDP (before damages)"
 ***----------------------------------------------------------------------------------------
 *** ----- Parameters needed for MAGICC ----------------------------------------------------
@@ -205,9 +199,7 @@ o_negitr_disc_cons_drInt_reg(iteration,all_regi)     "estimated discounted consu
 o_negitr_total_forc(iteration)                       "total forcing in 2100"
 
 ***----------------------------------------------------------------------------------------
-***------------------------------------------------trade module----------------------------
-p_tradecostgood(all_regi)                            "tradecosts (final good)"
-                               
+***------------------------------------------------trade module----------------------------                              
 pm_ttot_val(ttot)                                    "value of ttot set element"
 p_tall_val(tall)                                     "value of tall set element"
 pm_ts(tall)                                          "(t_n+1 - t_n-1)/2 for a timestep t_n"
@@ -223,11 +215,6 @@ p_share_seel_s(ttot,all_regi)                        "Share of electricity used
 p_discountedLifetime(all_te)                         "Sum over the discounted (@6%) depreciation factor (omega)"
 p_teAnnuity(all_te)                                  "Annuity factor of a technology"
 
-pm_cumDeprecFactor_old(ttot,all_regi,all_in)         "investment depreciation within a period, applied to the investment of t -1"
-pm_cumDeprecFactor_new(ttot,all_regi,all_in)         "investment depreciation within a period, applied to the investment of t"
-
-p_Mport2005correct(all_regi,all_enty)                "correction factor to match fossil supply and internal region energy demand in the initial year"
-
 p_histEmiMac(tall,all_regi,all_enty)                 "historical emissions per MAC; from Eurostat and CEDS, to correct CH4 and N2O reporting"
 p_histEmiSector(tall,all_regi,all_enty,emi_sectors,sector_types) "historical emissions per sector; from Eurostat and CEDS, to correct CH4 and N2O reporting"
 ;
@@ -274,19 +261,14 @@ vm_emiFgas(tall,all_regi,all_enty)                   "F-gas emissions by single
 positive variables
 ***----------------------------------------------------------------------------------------
 ***-------------------------------------------------MACRO module---------------------------
-vm_cesIO(tall,all_regi,all_in)                       "production factor"
-vm_invMacro(ttot,all_regi,all_in)                    "investment for capital for ttot"
-vm_cons(ttot,all_regi)                               "consumption"
-v_invMacroAdj(ttot,all_regi,all_in)                  "adjustment costs of macro economic investments"
 vm_effGr(ttot,all_regi,all_in)                       "growth of factor efficiency"
-vm_invInno(ttot,all_regi,all_in)                     "investment into innovation"
-vm_invImi(ttot, all_regi,all_in)                     "investment into imitation"
-vm_cesIOdelta(tall,all_regi,all_in)                  "putty-clay production factor"
 vm_enerSerAdj(tall,all_regi,all_in)                  "adjustment costs for energy service transformations"
 vm_damageFactor(ttot,all_regi)                       "damage factor reducing GDP"
-v_esCapInv(ttot,all_regi,all_teEs)                   "investment for energy end-use capital at the energy service level"
+vm_esCapInv(ttot,all_regi,all_teEs)                   "investment for energy end-use capital at the energy service level"
 ***----------------------------------------------------------------------------------------
 *-----------------------------------------------ESM module---------------------------------
+vm_costEnergySys(ttot,all_regi)                      "energy system costs"
+
 vm_cap(tall,all_regi,all_te,rlf)                     "net total capacities"
 vm_capDistr(tall,all_regi,all_te,rlf)                "net capacities, distributed to the different grades for renewables"
 vm_capFac(ttot,all_regi,all_te)                      "capacity factor of conversion technologies"
@@ -324,12 +306,6 @@ vm_prodSeOth(ttot,all_regi,all_enty,all_te)	         "other sety production from
 *** ES layer variables
 vm_demFeForEs(ttot,all_regi,all_enty,all_esty,all_teEs)     "Final energy which will be used in the ES layer."
 v_prodEs(ttot,all_regi,all_enty,all_esty,all_teEs)          "Energy services (unit determined by conversion factor pm_fe2es)."
-***----------------------------------------------------------------------------------------
-***------------------------------------------------trade module----------------------------
-vm_Xport(tall,all_regi,all_enty)                     "export of traded commodity [TWa]"
-vm_Mport(tall,all_regi,all_enty)                     "import of traded commodity [TWa]"
-*** Adjustment costs for Nash trade algorithm.  Only non-zero in the Nash_test realization of 80_optimization module.
-vm_costAdjNash(ttot,all_regi)                        "adjustment costs for deviation from the trade structure of the last iteration"
 ;
 ***----------------------------------------------------------------------------------------
 ***                                   EQUATIONS
@@ -337,31 +313,13 @@ vm_costAdjNash(ttot,all_regi)                        "adjustment costs for devia
 equations
 ***----------------------------------------------------------------------------------------
 ***------------------------------------------------MACRO module----------------------------
-qm_budget(ttot,all_regi)                             "budget balance"
-q_balLab(ttot,all_regi)                              "labour balance"
-q_cesIO(ttot,all_regi,all_in)                        "production function"
-q_prodCompl(ttot,all_regi,all_in,all_in)             "Constraints for perfect complements in the CES tree"
-
-q_kapMo(ttot,all_regi,all_in)                        "capital motion equation"
-q_kapMo0(t0,all_regi,all_in)                         "initial condition for capital"
-
-q_invMacroAdj(ttot,all_regi,all_in)                  "adjustment costs for macro economic investments"
-*** FIXME q_balFeForCes(ttot,all_regi,all_enty,all_in)         "balance of final energy to couple esm and mgm"
 qm_balFeForCesAndEs(ttot,all_regi,all_enty)          "FE balance coupling ESM and production function either directly (Pathway I) or Indirectly through Energy services (Pathway III)"
-*** perm_restr(ttot,all_regi)                                  "emission permit trade restriction"
-*** multistage(ttot)                                           "calculation of remaining permits in multistage approach"
-q_limtRatioPpfen(ttot,all_regi,all_in,all_in)        "limit the ratio of two ppfEn"
-q_limitShPpfen(ttot,all_regi,all_in,all_in)          "limit the share of one ppfEn in total CES nest inputs"
 q_limitSeel2fehes(ttot,all_regi)                     "equation to limit the share of electricity that can be used for fehes"
-*** putty-clay
-q_cesIO_puttyclay(ttot,all_regi,all_in)              "putty-clay production function"
-q_puttyclay(ttot,all_regi,all_in)                    "putty-clay Correspondance between variations in input and past stocks of input"
-q_prodCompl_putty(ttot,all_regi,all_in,all_in)       "Putty-Clay constraints for perfect complements in the CES tree"
-***q_puttykap(ttot,all_regi,all_in)                            "putty-clay Correspondance between variations in capital and past stocks of capital"
-q_kapMo_putty(ttot,all_regi,all_in)                  "putty-clay capital motion equation"
 q_esCapInv(ttot,all_regi,all_teEs)                   "investment equation for end-use capital investments (energy service layer)"
 ***----------------------------------------------------------------------------------------
 ***-----------------------------------------------ESM module-------------------------------
+q_costEnergySys(ttot,all_regi)                       "energy system costs"
+
 q_costFu(ttot,all_regi)                              "costs of fuels"
 q_costOM(ttot,all_regi)                              "costs of o&m"
 q_costInv(ttot,all_regi)                             "costs of investment"
diff --git a/core/equations.gms b/core/equations.gms
index 5ba731e10dde5310388be8a707682f91f88708be..310c89bd965601911427b71734538226be8e636a 100644
--- a/core/equations.gms
+++ b/core/equations.gms
@@ -387,7 +387,7 @@ q_capCumNet(t0,regi,teLearn)..
 qm_fuel2pe(t,regi,peRicardian(enty))..
   vm_prodPe(t,regi,enty)
   =e=
-  sum(pe2rlf(enty,rlf2),vm_fuExtr(t,regi,enty,rlf2))-(vm_Xport(t,regi,enty)-(1-p_costsPEtradeMp(regi,enty))*vm_Mport(t,regi,enty))$(tradePe(enty)) -
+  sum(pe2rlf(enty,rlf2),vm_fuExtr(t,regi,enty,rlf2))-(vm_Xport(t,regi,enty)-(1-pm_costsPEtradeMp(regi,enty))*vm_Mport(t,regi,enty))$(tradePe(enty)) -
                       sum(pe2rlf(enty2,rlf2), (pm_fuExtrOwnCons(regi, enty, enty2) * vm_fuExtr(t,regi,enty2,rlf2))$(pm_fuExtrOwnCons(regi, enty, enty2) gt 0));
 
 ***---------------------------------------------------------------------------
@@ -753,236 +753,32 @@ q_smoothphaseoutCapEarlyReti(ttot,regi,te)$(ttot.val lt 2120 AND pm_ttot_val(tto
 		+ 0.05$(sameas(te,"biodiesel") or sameas(te, "bioeths")));
 
 
-***---------------------------------------------------------------------------
-*' Usable macroeconomic output - net of climate change damages - is calculated from the macroeconomic output, 
-*' taking into account export and import of the final good, taking specific trade costs into account, 
-*' which are assigned to the importer. The resulting output is used for consumption, 
-*' for investments into the capital stock, and for the energy system cost components investments,
-*' fuel costs and operation & maintenance. 
-*' Other additional costs like non-energy related greenhouse gas abatement costs and
-*' agricultural costs, which are delivered by the land use model MAgPIE, are deduced from disposable output. 
-*' Net tax revenues and adjustment costs converge to zero in the optimal solution (equilibrium point).
-***---------------------------------------------------------------------------
-qm_budget(ttot,regi)$( ttot.val ge cm_startyear ) .. 
-    vm_cesIO(ttot,regi,"inco") * vm_damageFactor(ttot,regi) 
-  - vm_Xport(ttot,regi,"good") 
-  + vm_Mport(ttot,regi,"good") * (1 - p_tradecostgood(regi) - pm_risk_premium(regi))
-  =g=
-    vm_cons(ttot,regi)
-  + sum(ppfKap(in), vm_invMacro(ttot,regi,in))
-  + sum(in, vm_invInno(ttot,regi,in))
-  + sum(in, vm_invImi(ttot,regi,in))
-***   energy system costs
-  + ( v_costFu(ttot,regi) 
+
+*JK* Result of split of budget equation. Sum of all energy related costs. 
+q_costEnergySys(ttot,regi)$( ttot.val ge cm_startyear ) ..
+    vm_costEnergySys(ttot,regi)
+  =e=
+    ( v_costFu(ttot,regi) 
     + v_costOM(ttot,regi) 
     + v_costInv(ttot,regi)
     ) 
-***   agricultural MACs are part of pm_totLUcosts (see module 26_agCosts)
-  + sum(enty$(emiMacSector(enty) AND (NOT emiMacMagpie(enty))), pm_macCost(ttot,regi,enty))  
   + sum(emiInd37, vm_IndCCSCost(ttot,regi,emiInd37))
   + pm_CementDemandReductionCost(ttot,regi)
-  + sum(tradePe(enty), 
-      pm_costsTradePeFinancial(regi,"Mport",enty) 
-    * vm_Mport(ttot,regi,enty)
-    )
-  + sum(tradePe(enty),
-      (pm_costsTradePeFinancial(regi,"Xport",enty) * vm_Xport(ttot,regi,enty))
-    * ( 1
-      + (
-          ( pm_costsTradePeFinancial(regi,"XportElasticity",enty)
-          / sqr(pm_ttot_val(ttot)-pm_ttot_val(ttot-1))
-          * ( vm_Xport(ttot,regi,enty)
-            / ( vm_Xport(ttot-1,regi,enty) 
-              + pm_costsTradePeFinancial(regi, "tradeFloor",enty)
-              )
-            - 1
-            )
-          )$( ttot.val ge max(2010, cm_startyear) )
-        )
-      )
-    )
-  + vm_taxrev(ttot,regi)$(ttot.val ge 2010)
-  + sum(ppfKap(in),v_invMacroAdj(ttot,regi,in))
-  + sum(in_enerSerAdj(in), vm_enerSerAdj(ttot,regi,in))
-*** ES layer costs
-  + sum(teEs, v_esCapInv(ttot,regi,teEs))
-  + vm_costAdjNash(ttot,regi)
-  + vm_costpollution(ttot,regi)
-  + pm_totLUcosts(ttot,regi)
 ;
 
-***---------------------------------------------------------------------------
-*' The labor available in every time step and every region comes from exogenous data. 
-*' It is the population corrected by the population age structure,
-*' which results in the labour force of people agged 15 to 65. 
-*' The labor participation rate is not factored into the labour supply (as it would only imply a
-*' rescaling of parameters without consequences for the model's dynamic). 
-*' The labour market balance equation reads as follows:
-***---------------------------------------------------------------------------
-q_balLab(t,regi)..
-    vm_cesIO(t,regi,"lab") 
-    =e= 
-    pm_lab(t,regi);
-
-***---------------------------------------------------------------------------
-*' The production function is a nested CES (constant elasticity of substitution) production function. 
-*' The macroeconomic output is generated by the inputs capital, labor, and total final energy (as a macro-ecoomic
-*' aggregate in $US units). The generation of total final energy is described
-*' by a CES production function as well, whose input factors are CES function outputs again. 
-*' Hence, the outputs of CES nests are intermediates measured in $US units. 
-*' According to the Euler-equation the value of the intermediate equals the sum of expenditures for the inputs. 
-*' Sector-specific final energy types represent the bottom end of the `CES-tree'. These 'CES leaves' are
-*' measured in physical units and have a price in $US per physical unit. 
-*' The top of the tree is the total economic output measured in $US.
-*' The following equation is the generic form of the production function. 
-*' It treats the various CES nests separately and the nests are inter-connetected via mappings. 
-*' This equation calculates the amount of intermediate output in a time-step and region 
-*' from the associated factor input amounts according to:
-*** Keep in mind to adjust the calculation of derivatives and shares 
-*** in ./core/reswrite.inc if you change the structure of this function.
-***---------------------------------------------------------------------------
-q_cesIO(t,regi,ipf(out))$ ( NOT ipf_putty(out)) ..
-  vm_cesIO(t,regi,out)
-  =e=
-    sum(cesOut2cesIn(out,in),
-      pm_cesdata(t,regi,in,"xi")
-    * ( 
-        pm_cesdata(t,regi,in,"eff")
-      * vm_effGr(t,regi,in)
-      * vm_cesIO(t,regi,in)
-      )
-   ** pm_cesdata(t,regi,out,"rho")
-    )
- ** (1 / pm_cesdata(t,regi,out,"rho"))
-;
-
-***---------------------------------------------------------------------------
-*' Constraints for perfect complements in the CES tree
-***---------------------------------------------------------------------------
-q_prodCompl(t,regi,in,in2) $ (complements_ref(in,in2)
-                                 AND (( NOT in_putty(in2)) OR ppfIO_putty(in2))) ..
-      vm_cesIO(t,regi,in) 
-                              =e= pm_cesdata(t,regi,in2,"compl_coef")
-                                * vm_cesIO(t,regi,in2);
-                                
-***---------------------------------------------------------------------------                                
-*** Start of Putty-Clay equations 
-*' Putty-Clay production function:
-***---------------------------------------------------------------------------
-q_cesIO_puttyclay(t,regi,ipf_putty(out)) ..
-  vm_cesIOdelta(t,regi,out)
-  =e=
-    sum(cesOut2cesIn(out,in),
-      pm_cesdata(t,regi,in,"xi")
-    * ( 
-        pm_cesdata(t,regi,in,"eff")
-      * vm_effGr(t,regi,in)
-      * vm_cesIOdelta(t,regi,in)
-      )
-   ** pm_cesdata(t,regi,out,"rho")
-    )
- ** (1 / pm_cesdata(t,regi,out,"rho"))
-;
-
-*' Putty-Clay constraints for perfect complements in the CES tree:
-q_prodCompl_putty(t,regi,in,in2) $ (complements_ref(in,in2)
-                                 AND ( in_putty(in2) AND  ( NOT ppfIO_putty(in2)))) ..
-      vm_cesIOdelta(t,regi,in) =e=
-                                pm_cesdata(t,regi,in2,"compl_coef")
-                                * vm_cesIOdelta(t,regi,in2);
-
-*' Correspondance between vm_cesIO and vm_cesIOdelta:
-q_puttyclay(ttot,regi,in_putty(in))$(ord(ttot) lt card(ttot)  AND (pm_ttot_val(ttot+1) ge max(2010, cm_startyear)))..
-  vm_cesIO(ttot+1,regi,in)
-  =e=
-  vm_cesIO(ttot,regi,in)*(1- pm_delta_kap(regi,in))**(pm_ttot_val(ttot+1)-pm_ttot_val(ttot))
-           +  pm_cumDeprecFactor_old(ttot+1,regi,in)* vm_cesIOdelta(ttot,regi,in)
-           +  pm_cumDeprecFactor_new(ttot+1,regi,in)* vm_cesIOdelta(ttot+1,regi,in)
-;
 
-*' Capital motion equation for putty clay capital:
-q_kapMo_putty(ttot,regi,in_putty(in))$(ppfKap(in) AND (ord(ttot) le card(ttot)) AND (pm_ttot_val(ttot) ge max(2005, cm_startyear)) AND (pm_cesdata("2005",regi,in,"quantity") gt 0))..
-    vm_cesIOdelta(ttot,regi,in)
-    =e=
-             0
-$ifthen setGlobal END2110
-*gl* short time horizon requires investments to materialize in the same time step
-                  + pm_ts(ttot)*vm_invMacro(ttot,regi,in)*0.94**5 - (0.5*pm_ts(ttot)*vm_invMacro(ttot,regi,in)*0.94**5)$(ord(ttot) eq card(ttot));
-$else
-                  + vm_invMacro(ttot,regi,in)
-                   ;
-$endif
-;
-***---------------------------------------------------------------------------
-*** End of Putty-Clay equations
-***---------------------------------------------------------------------------
 ***---------------------------------------------------------------------------
 *' Investment equation for end-use capital investments (energy service layer):
 ***---------------------------------------------------------------------------
 q_esCapInv(ttot,regi,teEs)$pm_esCapCost(ttot,regi,teEs) ..
-    v_esCapInv(ttot,regi,teEs)
+    vm_esCapInv(ttot,regi,teEs)
     =e=
     sum (fe2es(entyFe,esty,teEs),
     pm_esCapCost(ttot,regi,teEs) * v_prodEs(ttot,regi,entyFe,esty,teEs)
     );
     ;
 
-***---------------------------------------------------------------------------    
-*' The capital stock is claculated recursively. Its amount in the previous time
-*' step is devaluated by an annual depreciation factor and enlarged by investments. 
-*' Both depreciation and investments are expressed as annual values,
-*' so the time step length is taken into account.
-***---------------------------------------------------------------------------
-q_kapMo(ttot,regi,ppfKap(in))$( ( NOT in_putty(in)) AND (ord(ttot) lt card(ttot)) AND (pm_ttot_val(ttot+1) ge max(2010, cm_startyear)) AND (pm_cesdata("2005",regi,in,"quantity") gt 0))..
-    vm_cesIO(ttot+1,regi,in)
-    =e=
-             (1- pm_delta_kap(regi,in))**(pm_ttot_val(ttot+1)-pm_ttot_val(ttot)) * vm_cesIO(ttot,regi,in)
-$ifthen setGlobal END2110
-*gl* short time horizon requires investments to materialize in the same time step
-                  + pm_ts(ttot)*vm_invMacro(ttot,regi,in)*0.94**5 - (0.5*pm_ts(ttot)*vm_invMacro(ttot,regi,in)*0.94**5)$(ord(ttot) eq card(ttot));
-$else
-                  + pm_cumDeprecFactor_old(ttot+1,regi,in) * vm_invMacro(ttot,regi,in)
-                  + pm_cumDeprecFactor_new(ttot+1,regi,in) * vm_invMacro(ttot+1,regi,in) ;
-$endif
-;
 
-***---------------------------------------------------------------------------
-*' Adjustment costs of macro economic investments:
-***---------------------------------------------------------------------------
-v_invMacroAdj.fx("2005",regi,ppfKap(in)) = 0;
-
-q_invMacroAdj(ttot,regi,ppfKap(in))$( ttot.val ge max(2010, cm_startyear))..
-    v_invMacroAdj(ttot,regi,in)
-    =e= 
-    sqr( (vm_invMacro(ttot,regi,in)-vm_invMacro(ttot-1,regi,in)) / (pm_ttot_val(ttot)-pm_ttot_val(ttot-1)) 
-        / (vm_invMacro(ttot,regi,in)+0.0001)
-    )
-    * vm_cesIO(ttot,regi,in) / 11
-*ML/RP* use "kap/11"  instead of "vm_invMacro" for the scaling to remove the "invest=0"-trap that sometimes appeared in delay scenarios; kap/11 corresponds to the global average ratio of investments to capital in 2005.
-*** In some regions the ratio kap:invest is higher, in some it is lower.
-;
-
-***---------------------------------------------------------------------------
-*' Initial conditions for capital:
-***---------------------------------------------------------------------------
-q_kapMo0(t0(t),regi,ppfKap(in))$(pm_cesdata(t,regi,in,"quantity") gt 0)..
-        vm_cesIO(t,regi,in) =e= pm_cesdata(t,regi,in,"quantity");
-
-*' Limit the share of one ppfEn in total CES nest inputs:
-q_limitShPpfen(t,regi,out,in)$( pm_ppfen_shares(out,in) ) ..
-  vm_cesIO(t,regi,in)
-  =l=
-    pm_ppfen_shares(out,in)
-  * sum(cesOut2cesIn(out,in2), vm_cesIO(t,regi,in2))
-;
-
-*' Limit the ratio of two ppfEn:
-q_limtRatioPpfen(t,regi,in,in2)$( pm_ppfen_ratios(in,in2) ) ..
-  vm_cesIO(t,regi,in)
-  =l=
-    pm_ppfen_ratios(in,in2)
-  * vm_cesIO(t,regi,in2)
-;
 
 *' Limit electricity use for fehes to 1/4th of total electricity use:
 q_limitSeel2fehes(t,regi)..
diff --git a/core/input/files b/core/input/files
index 2f62d20117a21f4b79ae254fb86306c5381ef7ad..510d2f10e7971fb8e2c2f99c0e832a94f8a16b72 100644
--- a/core/input/files
+++ b/core/input/files
@@ -2,25 +2,25 @@ f_cf.cs3r
 f_dataRegiSolar.cs3r
 f_emiFgas.cs4r
 f_gdp.cs3r
-f_IO_trade.cs4r
 f_lab.cs3r
 f_macBaseMagpie.cs4r
 f_maxProdGradeRegiHydro.cs3r
 f_maxProdGradeRegiWind.cs3r
 f_pop.cs3r
+f_IO_trade.cs4r
 p_abatparam_CH4.cs4r
 p_abatparam_N2O.cs4r
 p_abatparam_CO2.cs4r
 p_adj_deltacapoffset.cs4r
 p_boundEmi.cs4r
-p_boundInvMacro.cs4r
 pm_NuclearConstraint.cs4r
-p_costsPEtradeMp.cs4r
 pm_dataccs.cs3r
 p_earlyRetirementAdjFactor.cs3r
 p_emiFossilFuelExtr.cs4r
 p_emineg_econometric.cs3r
 p_histCap.cs3r
+p_histEmiMac.cs4r
+p_histEmiSector.cs4r
 p_PE_histCap.cs3r
 p_macBase1990.cs4r
 p_macBase2005.cs4r
@@ -32,7 +32,6 @@ p_share_ind_fesos.cs4r
 p_share_ind_fesos_bio.cs4r
 pm_boundCapCCS.cs4r
 pm_boundCapEV.cs4r
-pm_costsTradePeFinancial.cs3r
 pm_shPPPMER.cs4r
 p_inco0.cs4r
 p_boundCapCCSindicator.cs4r
diff --git a/core/postsolve.gms b/core/postsolve.gms
index d7d13b8280702abec9493fb52fbd4b071a59fe80..986af9aa57486b18c44799ca77abe8040a07a478 100644
--- a/core/postsolve.gms
+++ b/core/postsolve.gms
@@ -566,20 +566,6 @@ display p_bioshare;
 pm_gdp_gdx(ttot,regi)$(ttot.val ge 2005)    = vm_cesIO.l(ttot,regi,"inco");
 p_inv_gdx(ttot,regi)$(ttot.val ge 2005)     = vm_invMacro.l(ttot,regi,"kap");
 
-*consumption per capita
-pm_consPC(ttot,regi)$(ttot.val gt 2005 and ttot.val le 2150 and (pm_SolNonInfes(regi) eq 1) ) =
-    vm_cons.l(ttot,regi)/pm_pop(ttot,regi)
-;
-
-*interpolate years
-loop(ttot$(ttot.val ge 2005),
-	loop(tall$(pm_tall_2_ttot(tall, ttot)),
-		pm_consPC(tall,regi) =
-		    (1- pm_interpolWeight_ttot_tall(tall)) * pm_consPC(ttot,regi)
-		    + pm_interpolWeight_ttot_tall(tall) * pm_consPC(ttot + 1,regi);
-));
-pm_consPC(tall,regi)$(tall.val gt 2150) = pm_consPC("2150",regi);
-
 pm_GDPGross(ttot,regi)$( (pm_SolNonInfes(regi) eq 1) ) =  vm_cesIO.l(ttot,regi,"inco");
 
 
@@ -594,8 +580,6 @@ loop(ttot$(ttot.val ge 2005),
 * assume GDP is flat from 2150 on (only enters damage calculations in the far future)
 pm_GDPGross(tall,regi)$(tall.val ge 2150) = pm_GDPGross("2149",regi); 
 
-pm_Xport0(ttot,regi,tradePe)      = vm_Xport.l(ttot,regi,tradePe);
-
 
 
 ***------------ adjust adjustment costs for advanced vehicles according to CO2 price in the previous time step ----------------------
diff --git a/core/preloop.gms b/core/preloop.gms
index f1306937adb9a445e856771e70d0063126ab35b4..67954a8a93b88ef697d15bc8615475de61b182a0 100644
--- a/core/preloop.gms
+++ b/core/preloop.gms
@@ -6,42 +6,6 @@
 *** |  Contact: remind@pik-potsdam.de
 *** SOF ./core/preloop.gms
 
-loop ((t,counter),
-if ( pm_dt(t) eq 2 * counter.val,
-pm_cumDeprecFactor_old(t,regi,in)$(ppfKap(in) OR in_putty(in)) 
-=   ((1 - pm_delta_kap(regi,in)) ** (pm_dt(t)/2 )
-      - (1 - pm_delta_kap(regi,in)) ** (pm_dt(t) ))
-     /  pm_delta_kap(regi,in)
-    ;
-
-pm_cumDeprecFactor_new(t,regi,in)$(ppfKap(in) OR in_putty(in)) 
-=   ( 1 
-     - (1 - pm_delta_kap(regi,in)) ** (pm_dt(t)/2)
-      )
-     /  pm_delta_kap(regi,in)
-    ;
-
-);
-if ( pm_dt(t) eq (2 * counter.val -1),
-pm_cumDeprecFactor_old(t,regi,in)$(ppfKap(in) OR in_putty(in)) 
-=   ((1 - pm_delta_kap(regi,in)) ** (pm_dt(t)/2 - 0.5)
-      - (1 - pm_delta_kap(regi,in)) ** (pm_dt(t)))
-     /  pm_delta_kap(regi,in)
-    - 1/2 * (1 - pm_delta_kap(regi,in)) ** (pm_dt(t)/2 - 0.5 ) 
-    ;
-
-pm_cumDeprecFactor_new(t,regi,in)$(ppfKap(in) OR in_putty(in)) 
-=   ( 1 
-     - (1 - pm_delta_kap(regi,in)) ** (pm_dt(t)/2 - 0.5 + 1)
-      )
-     /  pm_delta_kap(regi,in)
-    - 1/2 * (1 - pm_delta_kap(regi,in)) ** (pm_dt(t)/2 - 0.5) 
-    ;
-    
-);
-); 
-display "test Deprec", pm_cumDeprecFactor_new,pm_cumDeprecFactor_old;
-
 ***------------------------------------------------------------------------------
 ***------------------------------------------------------------------------------
 ***                   MODEL             HYBRID
diff --git a/core/presolve.gms b/core/presolve.gms
index 65e53a0a46d43105c3d32500df44c8c705b90fa5..4629f60437462b4a5f7260a4d963197da3571245 100644
--- a/core/presolve.gms
+++ b/core/presolve.gms
@@ -8,7 +8,6 @@
 *JeS* calculate share of transport fuels in liquids
 pm_share_trans(ttot,regi)$(ttot.val ge 2005) = sum(se2fe(entySe,entyFe,te)$(seAgg2se("all_seliq",entySe) AND ( sameas(entyFe,"fepet") OR sameas(entyFe,"fedie"))), vm_prodFe.l(ttot,regi,entySe,entyFe,te)) / (sum(se2fe(entySe,entyFe,te)$seAgg2se("all_seliq",entySe), vm_prodFe.l(ttot,regi,entySe,entyFe,te)) + 0.0000001);
 
-pm_Xport0(ttot,regi,tradePe)      = vm_Xport.l(ttot,regi,tradePe);
 *AJS* we need those in nash
 pm_capCum0(ttot,regi,teLearn)$( (ttot.val ge 2005) and  (pm_SolNonInfes(regi) eq 1)) = vm_capCum.l(ttot,regi,teLearn);
 pm_co2eq0(ttot,regi)$( (ttot.val ge 2005) and  (pm_SolNonInfes(regi) eq 1)) = vm_co2eq.l(ttot,regi);
diff --git a/core/sets.gms b/core/sets.gms
index 65c496f587eab7e66b5c7a65ce6c6da13896d796..a582bf12cf961eb051679046901299e4e8dd7124 100755
--- a/core/sets.gms
+++ b/core/sets.gms
@@ -452,148 +452,148 @@ all_exogEmi     " all exogenous emission types"
         GrasslandBurning "Exogenous emissions from Grassland Burning"
 /
 
-  all_in   "all inputs and outputs of the CES function"
-  /
-    inco    "macroeconomic output"  
-
-    lab     "labour input"
-    kap     "capital input"
-    en      "energy input"
-
-    ens     "stationary energy use"
-    ensh    "stationary heat energy use"
-    fesos   "stationary use of solid energy carriers"
-    fehos   "stationary use of liquid energy carriers"
-    fegas   "stationary use of gaseous energy carriers"
-    feh2s   "stationary use of hydrogen"
-    fehes   "stationary use of district heat"
-    feels   "stationary use of electricity"
-
-    enb     "buildings energy use"
-    enhb    "buildings heat energy use"
-    fesob   "buildings use of solid energy carriers"
-    fehob   "buildings use of liquid energy carriers"
-    fegab   "buildings use of gaseous energy carriers"
-    feh2b   "buildings use of hydrogen"
-    feheb   "buildings use of district heat"
-    feelb   "buildings use of electricity"
-
-    eni     "industry energy use"
-    enhi    "industry heat energy use"
-    fesoi   "industry use of solid energy carriers"
-    fehoi   "industry use of liquid energy carriers"
-    fegai   "industry use of gaseous energy carriers"
-    feh2i   "industry use of hydrogen"
-    fehei   "industry use of district heat"
-    feeli   "industry use of electricity"
-
-    fehcsob  "buildings heating and cooking solids final energy"
-    fehcelb  "buildings heating and cooking electricity final energy" 
-    fehcheb  "buildings heating and cooking district heat final energy"
-    fehcgab  "buildings heating and cooking gas final energy"
-    fehchob  "buildings heating and cooking liquids final energy"
-    fealelb  "buildings appliances and light electricity final energy"
-    fecwsob  "buildings cooking and water heating solids final energy"
-    fecwelb  "buildings cooking and water heating electricity final energy" 
-    fecwhpb  "buildings cooking and water heating electricity heat pump final energy" 
-    fecwheb  "buildings cooking and water heating district heat final energy"
-    fecwgab  "buildings cooking and water heating gas final energy"
-    fecwhob  "buildings cooking and water heating liquids final energy"
-    fescelb  "buildings space cooling electricity final energy"
-    feshsob  "buildings space heating solids final energy"
-    feshelb  "buildings space heating electricity final energy" 
-    feshheb  "buildings space heating district heat final energy"
-    feshgab  "buildings space heating gas final energy"
-    feshhob  "buildings space heating liquids final energy"
-    feshhpb  "buildings space heating electricity heat pump final energy"
+all_in   "all inputs and outputs of the CES function"
+/
+  inco                    "macroeconomic output"  
+
+  lab                     "labour input"
+  kap                     "capital input"
+  en                      "energy input"
+
+  ens                     "stationary energy use"
+  ensh                    "stationary heat energy use"
+  fesos                   "stationary use of solid energy carriers"
+  fehos                   "stationary use of liquid energy carriers"
+  fegas                   "stationary use of gaseous energy carriers"
+  feh2s                   "stationary use of hydrogen"
+  fehes                   "stationary use of district heat"
+  feels                   "stationary use of electricity"
+
+  enb                     "buildings energy use"
+  enhb                    "buildings heat energy use"
+  fesob                   "buildings use of solid energy carriers"
+  fehob                   "buildings use of liquid energy carriers"
+  fegab                   "buildings use of gaseous energy carriers"
+  feh2b                   "buildings use of hydrogen"
+  feheb                   "buildings use of district heat"
+  feelb                   "buildings use of electricity"
+
+  eni                     "industry energy use"
+  enhi                    "industry heat energy use"
+  fesoi                   "industry use of solid energy carriers"
+  fehoi                   "industry use of liquid energy carriers"
+  fegai                   "industry use of gaseous energy carriers"
+  feh2i                   "industry use of hydrogen"
+  fehei                   "industry use of district heat"
+  feeli                   "industry use of electricity"
+
+  fehcsob                 "buildings heating and cooking solids final energy"
+  fehcelb                 "buildings heating and cooking electricity final energy" 
+  fehcheb                 "buildings heating and cooking district heat final energy"
+  fehcgab                 "buildings heating and cooking gas final energy"
+  fehchob                 "buildings heating and cooking liquids final energy"
+  fealelb                 "buildings appliances and light electricity final energy"
+  fecwsob                 "buildings cooking and water heating solids final energy"
+  fecwelb                 "buildings cooking and water heating electricity final energy" 
+  fecwhpb                 "buildings cooking and water heating electricity heat pump final energy" 
+  fecwheb                 "buildings cooking and water heating district heat final energy"
+  fecwgab                 "buildings cooking and water heating gas final energy"
+  fecwhob                 "buildings cooking and water heating liquids final energy"
+  fescelb                 "buildings space cooling electricity final energy"
+  feshsob                 "buildings space heating solids final energy"
+  feshelb                 "buildings space heating electricity final energy" 
+  feshheb                 "buildings space heating district heat final energy"
+  feshgab                 "buildings space heating gas final energy"
+  feshhob                 "buildings space heating liquids final energy"
+  feshhpb                 "buildings space heating electricity heat pump final energy"
     
-    esswb   "buildings weatherization energy service"
-    uehcb    "buildings heating and cooking useful energy"
-    uecwb    "buildings cooking and water heating useful energy"
-    uescb    "buildings space cooling useful energy"
-    ueshb    "buildings space heating useful energy"
-    uealb  "buildings appliances and light, useful energy"
-    ueswb   "buildings weatherization"
-    feshh2b  "buildings space heating hydrogen"
-    fecwb    "buildings cooking and water heating FE"
-    fecwh2b  "buildings cooking and water heating hydrogen"
+  esswb                   "buildings weatherization energy service"
+  uehcb                   "buildings heating and cooking useful energy"
+  uecwb                   "buildings cooking and water heating useful energy"
+  uescb                   "buildings space cooling useful energy"
+  ueshb                   "buildings space heating useful energy"
+  uealb                   "buildings appliances and light, useful energy"
+  ueswb                   "buildings weatherization"
+  feshh2b                 "buildings space heating hydrogen"
+  fecwb                   "buildings cooking and water heating FE"
+  fecwh2b                 "buildings cooking and water heating hydrogen"
 *** FIXME this should be reworked with Robert when revising the transport module
-    entrp   "transport energy use"
-    fetf    "transport fuel use"
-    ueLDVt   "transport useful energy light duty vehicles"
-    ueHDVt   "transport useful energy heavy duty vehicles"
-    feh2t   "transport hydrogen use"
-    ueelTt    "transport useful energy for electric trains"
-
-    entrp_pass    "passenger transport"
-    entrp_frgt    "freight transport"
-    entrp_pass_sm    "short-to-medium distance passenger transport"
-    entrp_pass_lo    "long distance passenger transport"
-    entrp_frgt_sm    "short-to-medium distance freight transport"
-    entrp_frgt_lo    "long distance freight transport"
-    fepet_pass_sm    "short-to-medium distance passenger transport, petrol"
-    fedie_pass_sm    "short-to-medium distance passenger transport, diesel"
-    feelt_pass_sm    "short-to-medium distance passenger transport, electricity"
-    fedie_pass_lo    "long distance passenger transport, diesel"
-    fedie_frgt_sm    "short-to-medium distance freight transport, diesel"
-    feelt_frgt_sm    "short-to-medium distance freight transport, electricity"
-    fedie_frgt_lo    "long distance freight transport, diesel"
-
-    kaphc     "buildings capital stock insulation"
-    kapsc     "buildings capital stock space cooling"
-    kapal     "buildings capital stock appliances and light"
+  entrp                   "transport energy use"
+  fetf                    "transport fuel use"
+  ueLDVt                  "transport useful energy light duty vehicles"
+  ueHDVt                  "transport useful energy heavy duty vehicles"
+  feh2t                   "transport hydrogen use"
+  ueelTt                  "transport useful energy for electric trains"
+
+  entrp_pass              "passenger transport"
+  entrp_frgt              "freight transport"
+  entrp_pass_sm           "short-to-medium distance passenger transport"
+  entrp_pass_lo           "long distance passenger transport"
+  entrp_frgt_sm           "short-to-medium distance freight transport"
+  entrp_frgt_lo           "long distance freight transport"
+  fepet_pass_sm           "short-to-medium distance passenger transport, petrol"
+  fedie_pass_sm           "short-to-medium distance passenger transport, diesel"
+  feelt_pass_sm           "short-to-medium distance passenger transport, electricity"
+  fedie_pass_lo           "long distance passenger transport, diesel"
+  fedie_frgt_sm           "short-to-medium distance freight transport, diesel"
+  feelt_frgt_sm           "short-to-medium distance freight transport, electricity"
+  fedie_frgt_lo           "long distance freight transport, diesel"
+
+  kaphc                   "buildings capital stock insulation"
+  kapsc                   "buildings capital stock space cooling"
+  kapal                   "buildings capital stock appliances and light"
     
-    !! production factors of industry with subsectors
-    ue_industry   "useful energy of industry sector"
-
-    ue_cement                "useful energy of cement production"
-    en_cement                "energy use of cement production"
-    kap_cement               "energy efficiency capital of cement production"
-    en_cement_non_electric   "non-electric energy use of cement production"
-    feso_cement              "solids energy use of cement production"
-    feli_cement              "liquids energy use of cement production"
-    fega_cement              "gases energy use of cement production"
-    feh2_cement              "hydrogen energy use of cement production"
-    feel_cement              "electricity energy use of cement production"
+  !! production factors of industry with subsectors
+  ue_industry             "useful energy of industry sector"
+
+  ue_cement               "useful energy of cement production"
+  en_cement               "energy use of cement production"
+  kap_cement              "energy efficiency capital of cement production"
+  en_cement_non_electric  "non-electric energy use of cement production"
+  feso_cement             "solids energy use of cement production"
+  feli_cement             "liquids energy use of cement production"
+  fega_cement             "gases energy use of cement production"
+  feh2_cement             "hydrogen energy use of cement production"
+  feel_cement             "electricity energy use of cement production"
  
 
-    ue_chemicals         "useful energy of chemicals production"
-    en_chemicals         "energy use of chemicals production"
-    kap_chemicals        "energy efficiency capital of chemicals production"
-    en_chemicals_fhth    "feedstock and high temperature heat enery use of chemicals production"
-    feso_chemicals       "solids energy use of cement production"
-    feli_chemicals       "liquids energy use of chemicals production"
-    fega_chemicals       "gases energy use of chemicals production"
-    feh2_chemicals       "hydrogen energy use of chemicals production"
-    feelhth_chemicals    "high temperature heat electricity energy use of chemicals production"
-    feelwlth_chemicals   "work and low temperature heat electricity energy use of chemicals production"
-
-    ue_steel               "useful energy of steel production"
-    ue_steel_primary       "useful energy of primary steel production"
-    ue_steel_secondary     "useful energy of secondary steel production"
-    en_steel_primary       "energy use of primary steel production"
-    kap_steel_primary      "energy efficiency capital of primary steel production"
-    kap_steel_secondary    "energy efficiency capital of secondary steel production"
-    en_steel_furnace       "non-electric energy use of primary steel production"
-    feso_steel             "solids energy use of primary steel production"
-    feli_steel             "liquids energy use of primary steel production"
-    fega_steel             "gases energy use of primary steel production"
-    feh2_steel             "hydrogen energy use of primary steel production"
-    feel_steel_primary     "electricity energy use pf primary steel production"
-    feel_steel_secondary   "electricity energy use of secondary steel production"
-
-    ue_otherInd         "useful energy of other industry production"
-    en_otherInd         "energy use of other industry production"
-    kap_otherInd        "energy efficiency capital of other industry production"
-    en_otherInd_hth     "non-electric energy use of other industry production"
-    feso_otherInd       "solids energy use of other industry production"
-    feli_otherInd       "liquids energy use of other industry production"
-    fega_otherInd       "gases energy use of other industry production"
-    feh2_otherInd       "hydrogen energy use of other industry production"
-    fehe_otherInd       "heat energy use of other industry production"
-    feelhth_otherInd    "high temperature heat electricity energy use of other industry production"
-    feelwlth_otherInd   "work and low temperature heat electricity energy use of other industry production"
-  /
+  ue_chemicals            "useful energy of chemicals production"
+  en_chemicals            "energy use of chemicals production"
+  kap_chemicals           "energy efficiency capital of chemicals production"
+  en_chemicals_fhth       "feedstock and high temperature heat enery use of chemicals production"
+  feso_chemicals          "solids energy use of cement production"
+  feli_chemicals          "liquids energy use of chemicals production"
+  fega_chemicals          "gases energy use of chemicals production"
+  feh2_chemicals          "hydrogen energy use of chemicals production"
+  feelhth_chemicals       "high temperature heat electricity energy use of chemicals production"
+  feelwlth_chemicals      "work and low temperature heat electricity energy use of chemicals production"
+
+  ue_steel                "useful energy of steel production"
+  ue_steel_primary        "useful energy of primary steel production"
+  ue_steel_secondary      "useful energy of secondary steel production"
+  en_steel_primary        "energy use of primary steel production"
+  kap_steel_primary       "energy efficiency capital of primary steel production"
+  kap_steel_secondary     "energy efficiency capital of secondary steel production"
+  en_steel_furnace        "non-electric energy use of primary steel production"
+  feso_steel              "solids energy use of primary steel production"
+  feli_steel              "liquids energy use of primary steel production"
+  fega_steel              "gases energy use of primary steel production"
+  feh2_steel              "hydrogen energy use of primary steel production"
+  feel_steel_primary      "electricity energy use pf primary steel production"
+  feel_steel_secondary    "electricity energy use of secondary steel production"
+
+  ue_otherInd             "useful energy of other industry production"
+  en_otherInd             "energy use of other industry production"
+  kap_otherInd            "energy efficiency capital of other industry production"
+  en_otherInd_hth         "non-electric energy use of other industry production"
+  feso_otherInd           "solids energy use of other industry production"
+  feli_otherInd           "liquids energy use of other industry production"
+  fega_otherInd           "gases energy use of other industry production"
+  feh2_otherInd           "hydrogen energy use of other industry production"
+  fehe_otherInd           "heat energy use of other industry production"
+  feelhth_otherInd        "high temperature heat electricity energy use of other industry production"
+  feelwlth_otherInd       "work and low temperature heat electricity energy use of other industry production"
+/
 
 all_teEs                 "energy service technologies"
 /
@@ -788,6 +788,7 @@ sets
 
        modules "all the available modules"
        /
+       macro
        welfare
        PE_FE_parameters
        initialCap
@@ -798,6 +799,7 @@ sets
        tax
        subsidizeLearning
        capitalMarket
+       trade
        agCosts
        CES_parameters
        biomass
@@ -822,6 +824,7 @@ sets
        /
 
 module2realisation(modules,*) "mapping of modules and active realisations" /
+       macro . %macro%
        welfare . %welfare%
        PE_FE_parameters . %PE_FE_parameters%
        initialCap . %initialCap%
@@ -832,6 +835,7 @@ module2realisation(modules,*) "mapping of modules and active realisations" /
        tax . %tax%
        subsidizeLearning . %subsidizeLearning%
        capitalMarket . %capitalMarket%
+       trade . %trade%
        agCosts . %agCosts%
        CES_parameters . %CES_parameters%
        biomass . %biomass%
@@ -1876,29 +1880,7 @@ s_statusTe   "technology status: how close a technology is to market readiness.
 ***-----------------------------------------------------------------------------
 
 Sets
-  in(all_in)        "all inputs and outputs of the CES function"
-  /
-    inco    "macroeconomic output"  
-    lab     "labour input"
-    kap     "capital input"
-    en      "energy input"
-  /
 
-  ppf(all_in)                "all primary production factors"
-  ipf(all_in)                "all intermediate production factors"
-  ppfKap(all_in)              "primary production factors capital"   / kap /
-  ppfEn(all_in)              "primary production factors energy" /  /
-  in_putty(all_in)               "production factors subject to putty-clay dynamics"
-  ppf_putty(all_in)           "all putty-clay primary production factors"
-  ipf_putty(all_in)           "all putty-clay intermediate production factors"
-  ppfIO_putty(all_in)         "factors treated in the normal CES as ppf and in putty-clay as output"
-  nests_putty(all_in,all_in)  "defines factors which are in the same putty subnest. The first all_in gives the higher factors of the subnest"
-  in_complements(all_in)           "factors which are perfect complements" 
-  //
-  in_enerSerAdj(all_in)                "energy services factors which should be constrained by adjustment costs"
-  //
-  complements_ref(all_in,all_in)    "correspondence between complementary factors. Necessary to have a reference factor for the constraints equations"
- 
   fe_tax_sub_sbi(all_in,all_in) "correspondence between tax and subsidy input data resolution and model sectoral resolution. For FE which takes the pathway I to the CES "
   //
   fe_tax_subEs(all_in,all_esty) "correspondence between tax and subsidy input data resolution and model sectoral resolution. For FE which takes the pathway III to the CES "
@@ -1915,18 +1897,6 @@ Sets
     compl_coef    "coefficients for the perfectly complementary factors"
   /
 
-  trade(all_enty)             "all traded commodities"
-  //
-  tradeMacro(all_enty)      "traded macro-economic commodities"
-  /good, perm/
-  tradePe(all_enty)         "traded primary energy commodities"
-  /
-  peoil, pecoal, pegas, peur, pebiolc
-  /
-  tradeSe(all_enty)         "traded secondary energy commodities"
-  /
-  null
-  /
 
 ***-------------------------------------------------------------------------------
 ***                 SETS for fragmented policy regimes
@@ -1996,10 +1966,7 @@ alias(teEs,teEs2);
 alias(esty,esty2);
 alias(rlf,rlf2);
 alias(regi,regi2);
-alias(in,out);
 alias(steps,steps2);
-alias(in,in2,in3);
-alias(ipf,ipf2);
 
 ***-----------------------------------------------------------------------------
 ***-----------------------------------------------------------------------------
@@ -2540,10 +2507,7 @@ emiRCP2unitsMagicc(emiRCP,unitsMagicc) "match units to emission types"
     (CF4,C2F6,C6F14,HFC23,HFC32,HFC43-10,HFC125,HFC134a,HFC143a,HFC227ea,HFC245fa,SF6) . kt
 /
 
-cesOut2cesIn(all_in,all_in)              "CES tree structure"
-/
-    inco  . (lab, kap, en)
-/
+
 
 ue2ppfen(all_enty,all_in)      "matching UE in ESM to ppfEn in MACRO"
 //
@@ -2551,24 +2515,14 @@ ue2ppfen(all_enty,all_in)      "matching UE in ESM to ppfEn in MACRO"
 es2ppfen(all_esty,all_in)      "matching ES in ESM to ppfEn in MACRO"
 //
 
-cesLevel2cesIO(counter,all_in)   "CES tree structure by level"
-cesRev2cesIO(counter,all_in)   "CES tree structure by level - descending order"
-cesOut2cesIn_below(all_in,all_in) "all elements of the CES below located below the first item given"
-in_below_putty(all_in)            "all elements of the CES below ppf_putty, excluding ppf_putty. Only meaningful in case putty structures are not intertwined"
 ;
 
-in_putty(all_in)    = NO;   
-ppf_putty(all_in)   = NO; 
-ipf_putty(all_in)   = NO; 
-ppfIO_putty(all_in) = NO;  
-
 ***-----------------------------------------------------------------------------
 ***-----------------------------------------------------------------------------
 ***                             Helpful constructs: alias
 ***-----------------------------------------------------------------------------
 ***-----------------------------------------------------------------------------
 
-alias(cesOut2cesIn,cesOut2cesIn2);
 alias(ccs2te,ccs2te2);
 alias(pe2se,pe2se2);
 
diff --git a/main.gms b/main.gms
index 3b1b8b23dd99d908c3895967837d59dee34e7ecc..28d1f96390b904de9ea78836e88eab65fdf265e2 100644
--- a/main.gms
+++ b/main.gms
@@ -72,9 +72,9 @@
 * 
 * Regionscode: 690d3718e151be1b450b394c1064b1c5
 * 
-* Input data revision: 5.936
+* Input data revision: 5.937
 * 
-* Last modification (input data): Mon Jan 13 09:10:28 2020
+* Last modification (input data): Wed Jan 15 14:19:35 2020
 * 
 *###################### R SECTION END (VERSION INFO) ###########################
 
@@ -126,6 +126,8 @@ $setGlobal c_expname  default
 ***                           MODULES
 ***------------------------------------------------------------------------------
 
+***---------------------    01_macro    -----------------------------------------
+$setGlobal macro  singleSectorGr  !! def = singleSectorGr
 ***---------------------    02_welfare    ---------------------------------------
 $setGlobal welfare  utilitarian  !! def = utilitarian
 ***---------------------    04_PE_FE_parameters    ------------------------------
@@ -146,6 +148,8 @@ $setGlobal tax  on                    !! def = on
 $setGlobal subsidizeLearning  off     !! def = off
 ***---------------------    23_capitalMarket    -----------------------------
 $setGlobal capitalMarket  perfect     !! def = perfect
+***---------------------    24_trade    -----------------------------------------
+$setGlobal trade  standard     !! def = standard
 ***---------------------    26_agCosts ------------------------------------------
 $setGlobal agCosts  costs               !! def = costs
 ***---------------------    29_CES_parameters    --------------------------------
@@ -214,7 +218,7 @@ cm_CCS_steel         "CCS for steel sub-sector"
 c_solscen             "solar option choice"
 cm_bioenergy_tax      "level of bioenergy tax in fraction of bioenergy price"
 cm_bioenergymaxscen   "choose bound on global pebiolc production excluding residues"
-c_tradecost_bio       "choose financal tradecosts for biomass (purpose grown pebiolc)"
+cm_tradecost_bio       "choose financal tradecosts for biomass (purpose grown pebiolc)"
 c_1stgen_phaseout    "choose if 1st generation biofuels should phase out after 2030 (vm_deltaCap=0)"
 cm_cprice_red_factor  "reduction factor for price on co2luc when calculating the revenues. Replicates the reduction applied in MAgPIE"
 cm_startyear          "first optimized modelling time step [year]"
@@ -254,7 +258,7 @@ c_abtrdy              "first year in which advanced bio-energy technology are re
 c_abtcst              "scaling of the cost of advanced bio-energy technologies (no unit, 50% increase means 1.5)"
 c_budgetCO2        "carbon budget for all CO2 emissions (in GtCO2)"
 
-c_trdcst              "parameter to scale trade export cost for gas"
+cm_trdcst              "parameter to scale trade export cost for gas"
 cm_trdadj              "parameter scale the adjustment cost parameter for increasing gas trade export"
 
 c_refcapbnd           "switch for fixing refinery capacities to the SSP2 levels in 2010 (if equal zero then no fixing)"
@@ -306,7 +310,7 @@ cm_CCS_steel           = 1;        !! def = 1
 
 cm_bioenergy_tax    = 1.5;       !! def = 1.5
 cm_bioenergymaxscen = 0;         !! def = 0
-c_tradecost_bio     = 2;         !! def = 2
+cm_tradecost_bio     = 2;         !! def = 2
 $setglobal cm_LU_emi_scen  SSP2   !! def = SSP2
 c_1stgen_phaseout  = 0;         !! def = 0
 cm_cprice_red_factor  = 0.5;         !! def = 0.5
@@ -364,7 +368,7 @@ cm_taxCO2inc_after_peakBudgYr = 2;      !! def = 2
 cm_CO2priceRegConvEndYr       = 2050;   !! def = 2050
 
 cm_trdadj            = 2;    !! def = 2.0
-c_trdcst             = 1.5;  !! def = 1.5
+cm_trdcst             = 1.5;  !! def = 1.5
 c_refcapbnd          = 0;    !! def = 0
 cm_frac_CCS          = 10;   !! def = 10
 cm_frac_NetNegEmi    = 0.5;  !! def = 0.5
diff --git a/modules/01_macro/module.gms b/modules/01_macro/module.gms
new file mode 100644
index 0000000000000000000000000000000000000000..b19af80b9c9a55961238bbfa3169b4438805c2fe
--- /dev/null
+++ b/modules/01_macro/module.gms
@@ -0,0 +1,15 @@
+*** |  (C) 2006-2019 Potsdam Institute for Climate Impact Research (PIK)
+*** |  authors, and contributors see CITATION.cff file. This file is part
+*** |  of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of
+*** |  AGPL-3.0, you are granted additional permissions described in the
+*** |  REMIND License Exception, version 1.0 (see LICENSE file).
+*** |  Contact: remind@pik-potsdam.de
+*** SOF ./modules/01_macro/module.gms
+*' @title Macro-Economic Growth Model
+*'
+*' @description The macro module allows for the implementation of different 
+*' macro-economic modules. 
+*###################### R SECTION START (MODULETYPES) ##########################
+$Ifi "%macro%" == "singleSectorGr" $include "./modules/01_macro/singleSectorGr/realization.gms"
+*###################### R SECTION END (MODULETYPES) ############################
+*** EOF ./modules/01_macro/module.gms
diff --git a/modules/01_macro/singleSectorGr/bounds.gms b/modules/01_macro/singleSectorGr/bounds.gms
new file mode 100644
index 0000000000000000000000000000000000000000..1b3fc457c96aacd5daff4958be38534cfb4f1799
--- /dev/null
+++ b/modules/01_macro/singleSectorGr/bounds.gms
@@ -0,0 +1,25 @@
+*** |  (C) 2006-2019 Potsdam Institute for Climate Impact Research (PIK)
+*** |  authors, and contributors see CITATION.cff file. This file is part
+*** |  of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of
+*** |  AGPL-3.0, you are granted additional permissions described in the
+*** |  REMIND License Exception, version 1.0 (see LICENSE file).
+*** |  Contact: remind@pik-potsdam.de
+*** SOF ./modules/01_macro/singleSectorGr/bounds.gms
+
+*nb* lower bounds on CES values
+vm_cons.lo(t,regi)     = 1e-3;
+vm_cesIO.lo(t,regi,in) = 1e-6;
+vm_cesIOdelta.lo(t,regi,in_putty) = 1e-6;
+
+*nb fix energy inputs to CES structure in t0 to the parameter values
+vm_cesIO.fx(t0(tall),regi,in)$(ppfEn(in) OR ppfIO_putty(in)) = pm_cesdata(tall,regi,in,"quantity");
+vm_cesIOdelta.fx(t0(tall),regi,in)$(ppfEn(in) OR in_putty(in)) = pm_cesdata_putty(tall,regi,in,"quantity");
+
+
+*** set macro investments to bound in 2005
+vm_invMacro.fx("2005",regi,"kap") = p01_boundInvMacro(regi);
+*cb 2012-05-23 lower bound for capital investment to avoid "zero investment" problem for the conopt solver
+vm_invMacro.lo(t,regi,"kap")$(t.val gt 2005) = 0.01 * vm_invMacro.lo("2005",regi,"kap");
+
+v01_invMacroAdj.fx("2005",regi,ppfKap(in)) = 0;
+*** EOF ./modules/01_macro/singleSectorGr/bounds.gms
\ No newline at end of file
diff --git a/modules/01_macro/singleSectorGr/datainput.gms b/modules/01_macro/singleSectorGr/datainput.gms
new file mode 100644
index 0000000000000000000000000000000000000000..19be4aa1590349c8f4cee2b98cfd04036f4101a2
--- /dev/null
+++ b/modules/01_macro/singleSectorGr/datainput.gms
@@ -0,0 +1,21 @@
+*** |  (C) 2006-2019 Potsdam Institute for Climate Impact Research (PIK)
+*** |  authors, and contributors see CITATION.cff file. This file is part
+*** |  of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of
+*** |  AGPL-3.0, you are granted additional permissions described in the
+*** |  REMIND License Exception, version 1.0 (see LICENSE file).
+*** |  Contact: remind@pik-potsdam.de
+*** SOF ./modules/01_macro/singleSectorGr/datainput.gms
+
+*** depreciation rate of capital
+pm_delta_kap(regi,"kap") = 0.05;
+
+*** load data for macro investments in 2005, used as bound
+parameter p01_boundInvMacro(all_regi)        "macro investments in 2005" 
+/
+$ondelim
+$include "./modules/01_macro/singleSectorGr/input/p01_boundInvMacro.cs4r"
+$offdelim
+/
+;
+p01_boundInvMacro(all_regi) = p01_boundInvMacro(all_regi) * pm_shPPPMER(all_regi);
+*** EOF ./modules/01_macro/singleSectorGr/datainput.gms
\ No newline at end of file
diff --git a/modules/01_macro/singleSectorGr/declarations.gms b/modules/01_macro/singleSectorGr/declarations.gms
new file mode 100644
index 0000000000000000000000000000000000000000..89604543066b40f0032e857e926940b6c572ecca
--- /dev/null
+++ b/modules/01_macro/singleSectorGr/declarations.gms
@@ -0,0 +1,54 @@
+*** |  (C) 2006-2019 Potsdam Institute for Climate Impact Research (PIK)
+*** |  authors, and contributors see CITATION.cff file. This file is part
+*** |  of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of
+*** |  AGPL-3.0, you are granted additional permissions described in the
+*** |  REMIND License Exception, version 1.0 (see LICENSE file).
+*** |  Contact: remind@pik-potsdam.de
+*** SOF ./modules/01_macro/singleSectorGr/declarations.gms
+***-------------------------------------------------------------------------------
+***                                   PARAMETERS
+***-------------------------------------------------------------------------------
+parameters
+pm_delta_kap(all_regi,all_in)                                   "Depreciation rate of capital."
+pm_cumDeprecFactor_old(ttot,all_regi,all_in)                    "Investment depreciation within a period, applied to the investment of t -1."
+pm_cumDeprecFactor_new(ttot,all_regi,all_in)                    "Investment depreciation within a period, applied to the investment of t."
+pm_ppfen_ratios(all_in,all_in)                                  "Limit ratio of two primary production factors of energy (ppfEn)."
+pm_ppfen_shares(all_in,all_in)                                  "Limit the share of one ppfEn in total CES nest inputs."
+pm_consPC(tall,all_regi)                                        "Consumption per capita"
+;   
+***------------------------------------------------------------ -------------------
+***                                   VARIABLES 
+***------------------------------------------------------------ -------------------
+positive variables  
+vm_cons(ttot,all_regi)                                          "Consumption"  
+vm_cesIO(tall,all_regi,all_in)                                  "Production factor" 
+vm_invMacro(ttot,all_regi,all_in)                               "Investment for capital for ttot"
+v01_invMacroAdj(ttot,all_regi,all_in)                           "Adjustment costs of macro economic investments"
+vm_invRD(ttot,all_regi,all_in)                                  "R&D investments"
+vm_invInno(ttot,all_regi,all_in)                                "Investment into innovation"
+vm_invImi(ttot, all_regi,all_in)                                "Investment into imitation"     
+
+*** putty-clay variables   
+vm_cesIOdelta(tall,all_regi,all_in)                             "Putty-clay production factor"  
+;   
+***------------------------------------------------------------ -------------------
+***                                   EQUATIONS 
+***------------------------------------------------------------ -------------------
+equations   
+qm_budget(ttot,all_regi)                                        "Budget balance"
+q01_balLab(ttot,all_regi)                                       "Labour balance"
+q01_cesIO(ttot,all_regi,all_in)                                 "Production function"
+q01_prodCompl(ttot,all_regi,all_in,all_in)                      "Constraints for perfect complements in the CES tree"
+q01_kapMo(ttot,all_regi,all_in)                                 "Capital motion equation"
+q01_kapMo0(t0,all_regi,all_in)                                  "Initial condition for capital"
+q01_invMacroAdj(ttot,all_regi,all_in)                           "Adjustment costs for macro economic investments"
+q01_limitShPpfen(ttot,all_regi,all_in,all_in)                   "Limit the share of one ppfEn in total CES nest inputs"
+q01_limtRatioPpfen(ttot,all_regi,all_in,all_in)                 "Limit the ratio of two ppfEn"
+
+*** putty-clay equations    
+q01_cesIO_puttyclay(ttot,all_regi,all_in)                       "Putty-clay production function"
+q01_puttyclay(ttot,all_regi,all_in)                             "Putty-clay Correspondance between variations in input and past stocks of input"
+q01_prodCompl_putty(ttot,all_regi,all_in,all_in)                "Putty-Clay constraints for perfect complements in the CES tree"
+q01_kapMo_putty(ttot,all_regi,all_in)                           "Putty-clay capital motion equation"
+;
+*** EOF ./modules/01_macro/singleSectorGr/declarations.gms
\ No newline at end of file
diff --git a/modules/01_macro/singleSectorGr/equations.gms b/modules/01_macro/singleSectorGr/equations.gms
new file mode 100644
index 0000000000000000000000000000000000000000..2dc2b63f5027839cee9ece45fb0da71ea3d1c784
--- /dev/null
+++ b/modules/01_macro/singleSectorGr/equations.gms
@@ -0,0 +1,225 @@
+*** |  (C) 2006-2019 Potsdam Institute for Climate Impact Research (PIK)
+*** |  authors, and contributors see CITATION.cff file. This file is part
+*** |  of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of
+*** |  AGPL-3.0, you are granted additional permissions described in the
+*** |  REMIND License Exception, version 1.0 (see LICENSE file).
+*** |  Contact: remind@pik-potsdam.de
+*** SOF ./modules/01_macro/singleSectorGr/equations.gms
+
+
+***---------------------------------------------------------------------------
+*' Usable macroeconomic output - net of climate change damages - is calculated from the macroeconomic output, 
+*' taking into account export and import of the final good, taking specific trade costs into account, 
+*' which are assigned to the importer. The resulting output is used for consumption, 
+*' for investments into the capital stock, and for the energy system cost components investments,
+*' fuel costs and operation & maintenance. 
+*' Other additional costs like non-energy related greenhouse gas abatement costs and
+*' agricultural costs, which are delivered by the land use model MAgPIE, are deduced from disposable output. 
+*' Net tax revenues and adjustment costs converge to zero in the optimal solution (equilibrium point).
+***---------------------------------------------------------------------------
+qm_budget(ttot,regi)$( ttot.val ge cm_startyear ) .. 
+    vm_cesIO(ttot,regi,"inco") * vm_damageFactor(ttot,regi) 
+  - vm_Xport(ttot,regi,"good") 
+  + vm_Mport(ttot,regi,"good") * (1 - pm_tradecostgood(regi) - pm_risk_premium(regi))
+  =g=
+    vm_cons(ttot,regi)
+  + sum(ppfKap(in), vm_invMacro(ttot,regi,in))
+  + sum(ppfKap(in), v01_invMacroAdj(ttot,regi,in))  
+  + sum(in, vm_invRD(ttot,regi,in))
+  + sum(in, vm_invInno(ttot,regi,in))
+  + sum(in, vm_invImi(ttot,regi,in))
+  + sum(tradePe(enty), pm_costsTradePeFinancial(regi,"Mport",enty) * vm_Mport(ttot,regi,enty))
+  + sum(tradePe(enty),
+      (pm_costsTradePeFinancial(regi,"Xport",enty) * vm_Xport(ttot,regi,enty))
+    * ( 1 
+      + ( pm_costsTradePeFinancial(regi,"XportElasticity",enty)
+        / sqr(pm_ttot_val(ttot)-pm_ttot_val(ttot-1))
+        * ( vm_Xport(ttot,regi,enty) 
+          / ( vm_Xport(ttot-1,regi,enty) + pm_costsTradePeFinancial(regi, "tradeFloor",enty) ) 
+          - 1
+          )
+        )$( ttot.val ge max(2010, cm_startyear) )
+      )
+    )
+  + vm_taxrev(ttot,regi)$(ttot.val ge 2010)
+  + vm_costAdjNash(ttot,regi)
+  + sum(in_enerSerAdj(in), vm_enerSerAdj(ttot,regi,in))
+  + sum(teEs, vm_esCapInv(ttot,regi,teEs))
+  + vm_costpollution(ttot,regi)
+  + pm_totLUcosts(ttot,regi)
+*** agricultural MACs are part of pm_totLUcosts (see module 26_agCosts)
+  + sum(enty$(emiMacSector(enty) AND (NOT emiMacMagpie(enty))), pm_macCost(ttot,regi,enty))  
+  + vm_costEnergySys(ttot,regi)
+;
+
+
+
+***---------------------------------------------------------------------------
+*' The labor available in every time step and every region comes from exogenous data. 
+*' It is the population corrected by the population age structure,
+*' which results in the labour force of people agged 15 to 65. 
+*' The labor participation rate is not factored into the labour supply (as it would only imply a
+*' rescaling of parameters without consequences for the model's dynamic). 
+*' The labour market balance equation reads as follows:
+***---------------------------------------------------------------------------
+q01_balLab(t,regi)..
+    vm_cesIO(t,regi,"lab") 
+  =e= 
+    pm_lab(t,regi)
+;
+
+***---------------------------------------------------------------------------
+*' The production function is a nested CES (constant elasticity of substitution) production function. 
+*' The macroeconomic output is generated by the inputs capital, labor, and total final energy (as a macro-ecoomic
+*' aggregate in $US units). The generation of total final energy is described
+*' by a CES production function as well, whose input factors are CES function outputs again. 
+*' Hence, the outputs of CES nests are intermediates measured in $US units. 
+*' According to the Euler-equation the value of the intermediate equals the sum of expenditures for the inputs. 
+*' Sector-specific final energy types represent the bottom end of the `CES-tree'. These 'CES leaves' are
+*' measured in physical units and have a price in $US per physical unit. 
+*' The top of the tree is the total economic output measured in $US.
+*' The following equation is the generic form of the production function. 
+*' It treats the various CES nests separately and the nests are inter-connetected via mappings. 
+*' This equation calculates the amount of intermediate output in a time-step and region 
+*' from the associated factor input amounts according to:
+*** Keep in mind to adjust the calculation of derivatives and shares 
+*** in ./core/reswrite.inc if you change the structure of this function.
+***---------------------------------------------------------------------------
+q01_cesIO(t,regi,ipf(out))$ ( NOT ipf_putty(out)) ..
+    vm_cesIO(t,regi,out)
+  =e=
+    sum(cesOut2cesIn(out,in),
+      pm_cesdata(t,regi,in,"xi")
+    * ( 
+        pm_cesdata(t,regi,in,"eff")
+      * vm_effGr(t,regi,in)
+      * vm_cesIO(t,regi,in)
+      )
+   ** pm_cesdata(t,regi,out,"rho")
+    )
+  ** (1 / pm_cesdata(t,regi,out,"rho"))
+;
+
+***---------------------------------------------------------------------------
+*' Constraints for perfect complements in the CES tree
+***---------------------------------------------------------------------------
+q01_prodCompl(t,regi,in,in2) $ (complements_ref(in,in2) AND (( NOT in_putty(in2)) OR ppfIO_putty(in2))) ..
+    vm_cesIO(t,regi,in) 
+  =e= 
+    pm_cesdata(t,regi,in2,"compl_coef")
+  * vm_cesIO(t,regi,in2)
+;
+
+
+
+***---------------------------------------------------------------------------    
+*' The capital stock is claculated recursively. Its amount in the previous time
+*' step is devaluated by an annual depreciation factor and enlarged by investments. 
+*' Both depreciation and investments are expressed as annual values,
+*' so the time step length is taken into account.
+***---------------------------------------------------------------------------
+q01_kapMo(ttot,regi,ppfKap(in))$( ( NOT in_putty(in)) AND (ord(ttot) lt card(ttot)) AND (pm_ttot_val(ttot+1) ge max(2010, cm_startyear)) AND (pm_cesdata("2005",regi,in,"quantity") gt 0))..
+    vm_cesIO(ttot+1,regi,in)
+  =e=
+    (1- pm_delta_kap(regi,in))**(pm_ttot_val(ttot+1)-pm_ttot_val(ttot)) * vm_cesIO(ttot,regi,in)
+$ifthen setGlobal END2110
+*gl* short time horizon requires investments to materialize in the same time step
+  + pm_ts(ttot)*vm_invMacro(ttot,regi,in)*0.94**5 - (0.5*pm_ts(ttot)*vm_invMacro(ttot,regi,in)*0.94**5)$(ord(ttot) eq card(ttot));
+$else
+  + pm_cumDeprecFactor_old(ttot+1,regi,in) * vm_invMacro(ttot,regi,in)
+  + pm_cumDeprecFactor_new(ttot+1,regi,in) * vm_invMacro(ttot+1,regi,in) ;
+$endif
+;
+
+***---------------------------------------------------------------------------
+*' Adjustment costs of macro economic investments:
+***---------------------------------------------------------------------------
+q01_invMacroAdj(ttot,regi,ppfKap(in))$( ttot.val ge max(2010, cm_startyear))..
+    v01_invMacroAdj(ttot,regi,in)
+  =e= 
+    sqr( (vm_invMacro(ttot,regi,in)-vm_invMacro(ttot-1,regi,in)) 
+      / (pm_ttot_val(ttot)-pm_ttot_val(ttot-1)) 
+      / (vm_invMacro(ttot,regi,in)+0.0001)
+    )
+  * vm_cesIO(ttot,regi,in) / 11
+*ML/RP* use "kap/11"  instead of "vm_invMacro" for the scaling to remove the "invest=0"-trap that sometimes appeared in delay scenarios; kap/11 corresponds to the global average ratio of investments to capital in 2005.
+*** In some regions the ratio kap:invest is higher, in some it is lower.
+;
+
+***---------------------------------------------------------------------------
+*' Initial conditions for capital:
+***---------------------------------------------------------------------------
+q01_kapMo0(t0(t),regi,ppfKap(in))$(pm_cesdata(t,regi,in,"quantity") gt 0)..
+    vm_cesIO(t,regi,in) 
+  =e= 
+    pm_cesdata(t,regi,in,"quantity");
+
+*' Limit the share of one ppfEn in total CES nest inputs:
+q01_limitShPpfen(t,regi,out,in)$( pm_ppfen_shares(out,in) ) ..
+    vm_cesIO(t,regi,in)
+  =l=
+    pm_ppfen_shares(out,in)
+  * sum(cesOut2cesIn(out,in2), vm_cesIO(t,regi,in2))
+;
+
+*' Limit the ratio of two ppfEn:
+q01_limtRatioPpfen(t,regi,in,in2)$( pm_ppfen_ratios(in,in2) ) ..
+    vm_cesIO(t,regi,in)
+  =l=
+    pm_ppfen_ratios(in,in2)
+  * vm_cesIO(t,regi,in2)
+;
+
+
+***---------------------------------------------------------------------------                                
+*** Start of Putty-Clay equations 
+*' Putty-Clay production function:
+***---------------------------------------------------------------------------
+q01_cesIO_puttyclay(t,regi,ipf_putty(out)) ..
+  vm_cesIOdelta(t,regi,out)
+  =e=
+    sum(cesOut2cesIn(out,in),
+      pm_cesdata(t,regi,in,"xi")
+    * ( 
+        pm_cesdata(t,regi,in,"eff")
+      * vm_effGr(t,regi,in)
+      * vm_cesIOdelta(t,regi,in)
+      )
+   ** pm_cesdata(t,regi,out,"rho")
+    )
+ ** (1 / pm_cesdata(t,regi,out,"rho"))
+;
+
+*' Putty-Clay constraints for perfect complements in the CES tree:
+q01_prodCompl_putty(t,regi,in,in2) $ (complements_ref(in,in2)
+                                 AND ( in_putty(in2) AND  ( NOT ppfIO_putty(in2)))) ..
+      vm_cesIOdelta(t,regi,in) =e=
+                                pm_cesdata(t,regi,in2,"compl_coef")
+                                * vm_cesIOdelta(t,regi,in2);
+
+*' Correspondance between vm_cesIO and vm_cesIOdelta:
+q01_puttyclay(ttot,regi,in_putty(in))$(ord(ttot) lt card(ttot)  AND (pm_ttot_val(ttot+1) ge max(2010, cm_startyear)))..
+  vm_cesIO(ttot+1,regi,in)
+  =e=
+  vm_cesIO(ttot,regi,in)*(1- pm_delta_kap(regi,in))**(pm_ttot_val(ttot+1)-pm_ttot_val(ttot))
+           +  pm_cumDeprecFactor_old(ttot+1,regi,in)* vm_cesIOdelta(ttot,regi,in)
+           +  pm_cumDeprecFactor_new(ttot+1,regi,in)* vm_cesIOdelta(ttot+1,regi,in)
+;
+
+*' Capital motion equation for putty clay capital:
+q01_kapMo_putty(ttot,regi,in_putty(in))$(ppfKap(in) AND (ord(ttot) le card(ttot)) AND (pm_ttot_val(ttot) ge max(2005, cm_startyear)) AND (pm_cesdata("2005",regi,in,"quantity") gt 0))..
+    vm_cesIOdelta(ttot,regi,in)
+    =e=
+             0
+$ifthen setGlobal END2110
+*gl* short time horizon requires investments to materialize in the same time step
+                  + pm_ts(ttot)*vm_invMacro(ttot,regi,in)*0.94**5 - (0.5*pm_ts(ttot)*vm_invMacro(ttot,regi,in)*0.94**5)$(ord(ttot) eq card(ttot));
+$else
+                  + vm_invMacro(ttot,regi,in)
+                   ;
+$endif
+;
+***---------------------------------------------------------------------------
+*** End of Putty-Clay equations
+***---------------------------------------------------------------------------
+*** EOF ./modules/01_macro/singleSectorGr/equations.gms
\ No newline at end of file
diff --git a/modules/01_macro/singleSectorGr/input/files b/modules/01_macro/singleSectorGr/input/files
new file mode 100644
index 0000000000000000000000000000000000000000..d0d00263f496d9af2cf3f6aac80a80d8003196d1
--- /dev/null
+++ b/modules/01_macro/singleSectorGr/input/files
@@ -0,0 +1 @@
+p01_boundInvMacro.cs4r
diff --git a/modules/01_macro/singleSectorGr/postsolve.gms b/modules/01_macro/singleSectorGr/postsolve.gms
new file mode 100644
index 0000000000000000000000000000000000000000..ae9976d3dbd9d8ee35ad6848d4aedf3665216b11
--- /dev/null
+++ b/modules/01_macro/singleSectorGr/postsolve.gms
@@ -0,0 +1,21 @@
+*** |  (C) 2006-2019 Potsdam Institute for Climate Impact Research (PIK)
+*** |  authors, and contributors see CITATION.cff file. This file is part
+*** |  of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of
+*** |  AGPL-3.0, you are granted additional permissions described in the
+*** |  REMIND License Exception, version 1.0 (see LICENSE file).
+*** |  Contact: remind@pik-potsdam.de
+*** SOF ./modules/01_macro/singleSectorGr/postsolve.gms
+*** Consumption per capita
+pm_consPC(ttot,regi)$(ttot.val gt 2005 and ttot.val le 2150 and (pm_SolNonInfes(regi) eq 1) ) =
+    vm_cons.l(ttot,regi)/pm_pop(ttot,regi)
+;
+
+*** Interpolate years
+loop(ttot$(ttot.val ge 2005),
+	loop(tall$(pm_tall_2_ttot(tall, ttot)),
+		pm_consPC(tall,regi) =
+		    (1- pm_interpolWeight_ttot_tall(tall)) * pm_consPC(ttot,regi)
+		    + pm_interpolWeight_ttot_tall(tall) * pm_consPC(ttot + 1,regi);
+));
+pm_consPC(tall,regi)$(tall.val gt 2150) = pm_consPC("2150",regi);
+*** EOF ./modules/01_macro/singleSectorGr/postsolve.gms
\ No newline at end of file
diff --git a/modules/01_macro/singleSectorGr/preloop.gms b/modules/01_macro/singleSectorGr/preloop.gms
new file mode 100644
index 0000000000000000000000000000000000000000..fa850b04d74fc1555a240a7f07767d7fa4c6736f
--- /dev/null
+++ b/modules/01_macro/singleSectorGr/preloop.gms
@@ -0,0 +1,46 @@
+*** |  (C) 2006-2019 Potsdam Institute for Climate Impact Research (PIK)
+*** |  authors, and contributors see CITATION.cff file. This file is part
+*** |  of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of
+*** |  AGPL-3.0, you are granted additional permissions described in the
+*** |  REMIND License Exception, version 1.0 (see LICENSE file).
+*** |  Contact: remind@pik-potsdam.de
+*** SOF ./modules/01_macro/singleSectorGr/preloop.gms
+
+*** Calculate cummulative depreciation factors
+loop ((t,counter),
+if ( pm_dt(t) eq 2 * counter.val,
+pm_cumDeprecFactor_old(t,regi,in)$(ppfKap(in) OR in_putty(in)) 
+=   ((1 - pm_delta_kap(regi,in)) ** (pm_dt(t)/2 )
+      - (1 - pm_delta_kap(regi,in)) ** (pm_dt(t) ))
+     /  pm_delta_kap(regi,in)
+    ;
+
+pm_cumDeprecFactor_new(t,regi,in)$(ppfKap(in) OR in_putty(in)) 
+=   ( 1 
+     - (1 - pm_delta_kap(regi,in)) ** (pm_dt(t)/2)
+      )
+     /  pm_delta_kap(regi,in)
+    ;
+
+);
+if ( pm_dt(t) eq (2 * counter.val -1),
+pm_cumDeprecFactor_old(t,regi,in)$(ppfKap(in) OR in_putty(in)) 
+=   ((1 - pm_delta_kap(regi,in)) ** (pm_dt(t)/2 - 0.5)
+      - (1 - pm_delta_kap(regi,in)) ** (pm_dt(t)))
+     /  pm_delta_kap(regi,in)
+    - 1/2 * (1 - pm_delta_kap(regi,in)) ** (pm_dt(t)/2 - 0.5 ) 
+    ;
+
+pm_cumDeprecFactor_new(t,regi,in)$(ppfKap(in) OR in_putty(in)) 
+=   ( 1 
+     - (1 - pm_delta_kap(regi,in)) ** (pm_dt(t)/2 - 0.5 + 1)
+      )
+     /  pm_delta_kap(regi,in)
+    - 1/2 * (1 - pm_delta_kap(regi,in)) ** (pm_dt(t)/2 - 0.5) 
+    ;
+    
+);
+); 
+display "test Deprec", pm_cumDeprecFactor_new,pm_cumDeprecFactor_old;
+
+*** EOF ./modules/01_macro/singleSectorGr/preloop.gms
diff --git a/modules/01_macro/singleSectorGr/realization.gms b/modules/01_macro/singleSectorGr/realization.gms
new file mode 100644
index 0000000000000000000000000000000000000000..bdbf7f8b83ad173a2cc6e3dbf6a353bd26f98ad6
--- /dev/null
+++ b/modules/01_macro/singleSectorGr/realization.gms
@@ -0,0 +1,21 @@
+*** |  (C) 2006-2019 Potsdam Institute for Climate Impact Research (PIK)
+*** |  authors, and contributors see CITATION.cff file. This file is part
+*** |  of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of
+*** |  AGPL-3.0, you are granted additional permissions described in the
+*** |  REMIND License Exception, version 1.0 (see LICENSE file).
+*** |  Contact: remind@pik-potsdam.de
+*** SOF ./modules/01_macro/singleSectorGr.gms
+
+*' @description The singleSectorGr realization corresponds to a neo-classical, single 
+*' sector growth model.
+
+*####################### R SECTION START (PHASES) ##############################
+$Ifi "%phase%" == "sets" $include "./modules/01_macro/singleSectorGr/sets.gms"
+$Ifi "%phase%" == "declarations" $include "./modules/01_macro/singleSectorGr/declarations.gms"
+$Ifi "%phase%" == "datainput" $include "./modules/01_macro/singleSectorGr/datainput.gms"
+$Ifi "%phase%" == "equations" $include "./modules/01_macro/singleSectorGr/equations.gms"
+$Ifi "%phase%" == "preloop" $include "./modules/01_macro/singleSectorGr/preloop.gms"
+$Ifi "%phase%" == "bounds" $include "./modules/01_macro/singleSectorGr/bounds.gms"
+$Ifi "%phase%" == "postsolve" $include "./modules/01_macro/singleSectorGr/postsolve.gms"
+*######################## R SECTION END (PHASES) ###############################
+*** EOF ./modules/01_macro/singleSectorGr.gms
diff --git a/modules/01_macro/singleSectorGr/sets.gms b/modules/01_macro/singleSectorGr/sets.gms
new file mode 100644
index 0000000000000000000000000000000000000000..9d6c1159bfbad2cda52b02c61dc850f450cfc17e
--- /dev/null
+++ b/modules/01_macro/singleSectorGr/sets.gms
@@ -0,0 +1,54 @@
+*** |  (C) 2006-2019 Potsdam Institute for Climate Impact Research (PIK)
+*** |  authors, and contributors see CITATION.cff file. This file is part
+*** |  of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of
+*** |  AGPL-3.0, you are granted additional permissions described in the
+*** |  REMIND License Exception, version 1.0 (see LICENSE file).
+*** |  Contact: remind@pik-potsdam.de
+*** SOF ./modules/01_macro/singleSectorGr/sets.gms
+
+Sets
+
+cesOut2cesIn(all_in,all_in)           "CES tree structure"
+/
+  inco  . (lab, kap, en)
+/
+
+cesLevel2cesIO(counter,all_in)        "CES tree structure by level"
+cesRev2cesIO(counter,all_in)          "CES tree structure by level - descending order"
+cesOut2cesIn_below(all_in,all_in)     "All elements of the CES below located below the first item given"
+in_below_putty(all_in)                "All elements of the CES below ppf_putty, excluding ppf_putty. Only meaningful in case putty structures are not intertwined"
+
+
+in(all_in)                            "All inputs and outputs of the CES function"
+/
+  inco                                "Macroeconomic output"  
+  lab                                 "Labour input"
+  kap                                 "Capital input"
+  en                                  "Energy input"
+/
+ppf(all_in)                           "All primary production factors"
+ipf(all_in)                           "All intermediate production factors"
+ppfKap(all_in)                        "Primary production factors capital"   / kap /
+ppfEn(all_in)                         "Primary production factors energy" 
+in_putty(all_in)                      "Production factors subject to putty-clay dynamics"
+ppf_putty(all_in)                     "All putty-clay primary production factors"
+ipf_putty(all_in)                     "All putty-clay intermediate production factors"
+ppfIO_putty(all_in)                   "Factors treated in the normal CES as ppf and in putty-clay as output"
+nests_putty(all_in,all_in)            "Defines factors which are in the same putty subnest. The first all_in gives the higher factors of the subnest"
+in_enerSerAdj(all_in)                 "Energy services factors which should be constrained by adjustment costs" //
+in_complements(all_in)                "Factors which are perfect complements"  //
+complements_ref(all_in,all_in)        "Correspondence between complementary factors. Necessary to have a reference factor for the constraints equations"
+;
+
+
+
+in_putty(all_in)    = NO;   
+ppf_putty(all_in)   = NO; 
+ipf_putty(all_in)   = NO; 
+ppfIO_putty(all_in) = NO;  
+
+alias(cesOut2cesIn,cesOut2cesIn2);
+alias(in,out);
+alias(in,in2,in3);
+alias(ipf,ipf2);
+*** EOF ./modules/01_macro/singleSectorGr/sets.gms
\ No newline at end of file
diff --git a/modules/02_welfare/utilitarian/declarations.gms b/modules/02_welfare/utilitarian/declarations.gms
index 49d34a3bc9578743a8e7532b929f133da9daab42..81d70500effb6918f9958b13a12c142f4e85ebc6 100644
--- a/modules/02_welfare/utilitarian/declarations.gms
+++ b/modules/02_welfare/utilitarian/declarations.gms
@@ -29,7 +29,6 @@ vm_welfareGlob                                    "Global welfare"
 $ifthen.inconv %cm_INCONV_PENALTY% == "on" 
 v02_inconvPen(ttot,all_regi)                      "Inconvenience penalty in the welfare function, e.g. for air pollution. Unit: ?Utils?"
 v02_inconvPenCoalSolids(ttot,all_regi)            "Inconvenience penalty in the welfare function, e.g. for air pollution. Unit: ?Utils?"
-v02_inconvPenCoalSolids(ttot,all_regi)            "Inconvenience penalty in the welfare function, e.g. for air pollution. Unit: ?Utils?"
 v02_sesoInconvPenSlack(ttot,all_regi)             "Slack to avoid negative inconvenience penalty for Coal Solids" 
 $endif.inconv
 ;
diff --git a/modules/20_growth/exogenous/not_used.txt b/modules/20_growth/exogenous/not_used.txt
index 32376a1f99c45422b9cdd7db51caf8ef192e9590..5e3f56f027faa08a22fa53692a2f837305704a3e 100644
--- a/modules/20_growth/exogenous/not_used.txt
+++ b/modules/20_growth/exogenous/not_used.txt
@@ -11,3 +11,4 @@ pm_ttot_val, parameter, ???
 pm_ts, parameter, ???
 cm_startyear, switch, ???
 pm_cumEff, parameter, ???
+vm_invRD,input,questionnaire
diff --git a/modules/24_trade/module.gms b/modules/24_trade/module.gms
new file mode 100644
index 0000000000000000000000000000000000000000..65525cc2f90414d3e283743a011a8c163ecf54cf
--- /dev/null
+++ b/modules/24_trade/module.gms
@@ -0,0 +1,14 @@
+*** |  (C) 2006-2019 Potsdam Institute for Climate Impact Research (PIK)
+*** |  authors, and contributors see CITATION.cff file. This file is part
+*** |  of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of
+*** |  AGPL-3.0, you are granted additional permissions described in the
+*** |  REMIND License Exception, version 1.0 (see LICENSE file).
+*** |  Contact: remind@pik-potsdam.de
+*** SOF ./modules/24_trade/module.gms
+*' @title Trade module
+*'
+*' @description This file loads the trade module realization.
+*###################### R SECTION START (MODULETYPES) ##########################
+$Ifi "%trade%" == "standard" $include "./modules/24_trade/standard/realization.gms"
+*###################### R SECTION END (MODULETYPES) ############################
+*** EOF ./modules/24_trade/module.gms
diff --git a/modules/24_trade/standard/bounds.gms b/modules/24_trade/standard/bounds.gms
new file mode 100644
index 0000000000000000000000000000000000000000..2f31953cac48ccd2a51712643253d33cd8048fa5
--- /dev/null
+++ b/modules/24_trade/standard/bounds.gms
@@ -0,0 +1,105 @@
+*** |  (C) 2006-2019 Potsdam Institute for Climate Impact Research (PIK)
+*** |  authors, and contributors see CITATION.cff file. This file is part
+*** |  of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of
+*** |  AGPL-3.0, you are granted additional permissions described in the
+*** |  REMIND License Exception, version 1.0 (see LICENSE file).
+*** |  Contact: remind@pik-potsdam.de
+*** SOF ./modules/24_trade/standard/bounds.gms
+
+*** set Mport and Xport positive
+vm_Mport.lo(ttot,regi,tradePe)$(ttot.val ge 2005) = 0;
+vm_Xport.lo(ttot,regi,tradePe)$(ttot.val ge 2005) = 0;
+
+
+
+*** -----------------------------------------------------------
+*** no permit trade allowed in BAU and tax scenarios:
+*** -----------------------------------------------------------
+if (cm_emiscen = 1 or cm_emiscen = 9,
+   vm_Xport.fx(t,regi,"perm") = 0;
+   vm_Mport.fx(t,regi,"perm") = 0;
+else
+   vm_Xport.fx("2005",regi,"perm") = 0;
+   vm_Mport.fx("2005",regi,"perm") = 0;
+   vm_Xport.fx("2010",regi,"perm") = 0;
+   vm_Mport.fx("2010",regi,"perm") = 0;
+);
+
+
+
+
+*NB*110625 fix 2005 trade values to historic values
+*RR*Added correction factor to match fossil supply and internal region energy demand in the initial year if necessary
+*SB*190514 Made the correction factor for insufficient imports conditional on the fossil module realization
+
+*** Mports fixing for fossils in the initial year 
+loop( regi,
+    loop (enty$peFos(enty),
+*** if imports minus exports is higher than initial year demand there is a surplus of pe in the region. Correction -> set imports to 80% of the region pe demand plus Xports in the initial year
+        if ( (pm_EN_demand_from_initialcap2(regi,enty) < (1-pm_costsPEtradeMp(regi,enty))*pm_IO_trade("2005",regi,enty,"Mport") -  pm_IO_trade("2005",regi,enty,"Xport")),     !!region has more available pe through trade than it needs
+            p24_Mport2005correct(regi,enty) = (pm_EN_demand_from_initialcap2(regi,enty) + pm_IO_trade("2005",regi,enty,"Xport")) - pm_IO_trade("2005",regi,enty,"Mport");
+        );
+*** if internal region production (plus trade) is not enough to provide the energy demand. Correction ->  set imports to the difference between region energy demand (pm_EN_demand_from_initialcap2) and the internal production (pm_ffPolyCumEx(regi,enty,"max")) plus the trade balance (Mports-Xports) 
+$iftheni.fossil_realization %cfg$gms$fossil% == "timeDepGrades"
+        if ( pm_prodIni(regi,enty) + (1-pm_costsPEtradeMp(regi,enty))*(pm_IO_trade("2005",regi,enty,"Mport")+ p24_Mport2005correct(regi,enty)) -  pm_IO_trade("2005",regi,enty,"Xport") < pm_EN_demand_from_initialcap2(regi,enty),     !!region has a unbalance
+            p24_Mport2005correct(regi,enty) = pm_EN_demand_from_initialcap2(regi,enty)  - ((1-pm_costsPEtradeMp(regi,enty))*pm_IO_trade("2005",regi,enty,"Mport") -  pm_IO_trade("2005",regi,enty,"Xport")) - pm_prodIni(regi,enty) ;  !! SB: use pm_prodIni as an analog for pm_ffPolyCumEx(regi,enty,"max"), which does not exist in timeDepGrades
+        );
+$elseifi.fossil_realization %cfg$gms$fossil% == "grades2poly"
+        if ( (pm_ffPolyCumEx(regi,enty,"max") / (5*4)) + (1-pm_costsPEtradeMp(regi,enty))*(pm_IO_trade("2005",regi,enty,"Mport")+ p24_Mport2005correct(regi,enty)) -  pm_IO_trade("2005",regi,enty,"Xport") < pm_EN_demand_from_initialcap2(regi,enty),     !!region has a unbalance
+            p24_Mport2005correct(regi,enty) = pm_EN_demand_from_initialcap2(regi,enty)  - ((1-pm_costsPEtradeMp(regi,enty))*pm_IO_trade("2005",regi,enty,"Mport") -  pm_IO_trade("2005",regi,enty,"Xport")) - pm_ffPolyCumEx(regi,enty,"max") / (5*4) ;  !!pm_ffPolyCumEx(regi,enty,"max") is a 5 years value, so we dived by 5 to get the annual value and additionally we assume that if all the extraction is made in the first years, this would take a t least 4 time steps to completely exhaust the resources 
+        );
+$endif.fossil_realization
+    );
+);
+vm_Mport.fx(t0(tall),regi,peFos(enty)) = pm_IO_trade(t0,regi,enty,"Mport") + p24_Mport2005correct(regi,enty);
+
+*** Xports fixing for fossils in the initial year (with added exports to compensate for the Mports corrections above)
+loop( regi,
+    loop (enty$peFos(enty),
+        if ( (p24_Mport2005correct(regi,enty) = 0),
+            vm_Xport.fx(t0(tall),regi,peFos(enty)) = pm_IO_trade(t0,regi,enty,"Xport") +
+                   ( pm_IO_trade(t0,regi,enty,"Xport") / sum((regi2)$(NOT (p24_Mport2005correct(regi,enty))),pm_IO_trade(t0,regi2,enty,"Xport")) ) !! share of region Xports between regions with no balance problems
+                   * sum((regi2),p24_Mport2005correct(regi2,enty)) !! total unbalance problem
+            ;
+        else
+            vm_Xport.fx(t0(tall),regi,peFos(enty)) = pm_IO_trade(t0,regi,enty,"Xport") ;
+        );
+    );
+); 
+
+*** if region has no internal resources, demand must be entirely provided by trade (Switzerland problem). Correction ->  set imports free, exports zero. Warning: if the region is big enough this could cause a trade unbalance. The first best solution would be to calculate the exact imports amount needed and add extra exports to other countries to compensate for this exact amount.
+loop( regi,
+    loop (enty$peFos(enty),
+$iftheni.timeDepGrades %cfg$gms$fossil% == "timeDepGrades"
+        if ( (pm_fuelex_cum("2005",regi,enty,1) = 0),
+            vm_Xport.fx(t0(tall),regi,peFos(enty)) = 0;
+            vm_Mport.up(t0(tall),regi,peFos(enty)) = 1e10;
+            vm_Mport.lo(t0(tall),regi,peFos(enty)) = 1e-6;
+        );
+$elseifi.timeDepGrades %cfg$gms$fossil% == "grades2poly"
+        if ( (pm_ffPolyCumEx(regi,enty,"max") = 0),
+            vm_Xport.fx(t0(tall),regi,peFos(enty)) = 0;
+            vm_Mport.up(t0(tall),regi,peFos(enty)) = 1e10;
+            vm_Mport.lo(t0(tall),regi,peFos(enty)) = 1e-6;
+        );
+$endif.timeDepGrades
+    );
+);
+
+*** bounds on oil exports in 2010 and 2015
+vm_Xport.lo("2010",regi,"peoil") = 0.95 * pm_IO_trade("2010",regi,"peoil","Xport");
+vm_Xport.up("2010",regi,"peoil") = 1.05 * pm_IO_trade("2010",regi,"peoil","Xport");
+vm_Xport.lo("2015",regi,"peoil") = 0.95 * pm_IO_trade("2015",regi,"peoil","Xport");
+vm_Xport.up("2015",regi,"peoil") = 1.05 * pm_IO_trade("2015",regi,"peoil","Xport");
+
+*** upper bounds ( 1% yearly growth rate) on all big oil exporters (more than 15EJ in 2010) in 2020, 2025 and 2030
+loop(regi,
+      if( (pm_IO_trade("2010",regi,"peoil","Xport") ge (15*sm_EJ_2_TWa)),
+        vm_Xport.up("2020",regi,"peoil") = ((1 + 0.02) **  10) * pm_IO_trade("2010",regi,"peoil","Xport");
+        vm_Xport.up("2025",regi,"peoil") = ((1 + 0.02) **  15) * pm_IO_trade("2010",regi,"peoil","Xport");
+        vm_Xport.up("2030",regi,"peoil") = ((1 + 0.02) **  20) * pm_IO_trade("2010",regi,"peoil","Xport");
+      );
+);
+
+
+*** EOF ./modules/24_trade/standard/bounds.gms
\ No newline at end of file
diff --git a/modules/24_trade/standard/datainput.gms b/modules/24_trade/standard/datainput.gms
new file mode 100644
index 0000000000000000000000000000000000000000..ede5a82b33a7ac1b49ac33c1280c71308bcbc082
--- /dev/null
+++ b/modules/24_trade/standard/datainput.gms
@@ -0,0 +1,42 @@
+*** |  (C) 2006-2019 Potsdam Institute for Climate Impact Research (PIK)
+*** |  authors, and contributors see CITATION.cff file. This file is part
+*** |  of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of
+*** |  AGPL-3.0, you are granted additional permissions described in the
+*** |  REMIND License Exception, version 1.0 (see LICENSE file).
+*** |  Contact: remind@pik-potsdam.de
+*** SOF ./modules/24_trade/standard/datainput.gms
+
+
+pm_Xport0("2005",regi,peFos) = 0;
+
+*ML* Reintroduction of trade cost for composite good (based on export/import value difference for non-energy goods in GTAP6)
+pm_tradecostgood(regi)        = 0.03;
+
+*** load data on transportation costs of imports
+parameter pm_costsPEtradeMp(all_regi,all_enty)                   "PE tradecosts (energy losses on import)"
+/
+$ondelim
+$include "./modules/24_trade/standard/input/pm_costsPEtradeMp.cs4r"
+$offdelim
+/
+;
+
+
+table pm_costsTradePeFinancial(all_regi,char,all_enty)          "PE tradecosts (financial costs on import, export and use)"
+$ondelim
+$include "./modules/24_trade/standard/input/pm_costsTradePeFinancial.cs3r"
+$offdelim
+;
+pm_costsTradePeFinancial(regi,"XportElasticity", tradePe(enty)) = 100;
+pm_costsTradePeFinancial(regi, "tradeFloor", tradePe(enty))     = 0.0125;
+
+*DK* Only for SSP cases other than SSP2: use default trade costs
+if(cm_tradecost_bio = 1,
+pm_costsTradePeFinancial(regi,"Xport", "pebiolc") = pm_costsTradePeFinancial(regi,"Xport", "pebiolc")/2;
+);
+
+pm_costsTradePeFinancial(regi,"Xport", "pegas") = cm_trdcst * pm_costsTradePeFinancial(regi,"Xport", "pegas") ;
+pm_costsTradePeFinancial(regi,"XportElasticity","pegas") = cm_trdadj *pm_costsTradePeFinancial(regi,"XportElasticity","pegas");
+
+
+*** EOF ./modules/24_trade/standard/datainput.gms
\ No newline at end of file
diff --git a/modules/24_trade/standard/declarations.gms b/modules/24_trade/standard/declarations.gms
new file mode 100644
index 0000000000000000000000000000000000000000..5be62a91c5c302d9f6519912c2c88de7cf9e14e4
--- /dev/null
+++ b/modules/24_trade/standard/declarations.gms
@@ -0,0 +1,24 @@
+*** |  (C) 2006-2019 Potsdam Institute for Climate Impact Research (PIK)
+*** |  authors, and contributors see CITATION.cff file. This file is part
+*** |  of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of
+*** |  AGPL-3.0, you are granted additional permissions described in the
+*** |  REMIND License Exception, version 1.0 (see LICENSE file).
+*** |  Contact: remind@pik-potsdam.de
+*** SOF ./modules/24_trade/standard/declarations.gms
+***-------------------------------------------------------------------------------
+***                                   PARAMETERS
+***-------------------------------------------------------------------------------
+parameters
+pm_tradecostgood(all_regi)                  "Trade costs (final good)."
+pm_Xport0(tall,all_regi,all_enty)           "Reference level value of export." 
+pm_IO_trade(tall,all_regi,all_enty,char)    "Energy trade bounds based on IEA data."
+p24_Mport2005correct(all_regi,all_enty)     "Correction factor to match fossil supply and internal region energy demand in the initial year"
+;
+***-------------------------------------------------------------------------------
+***                                   VARIABLES
+***-------------------------------------------------------------------------------
+positive VARIABLES
+vm_Xport(tall,all_regi,all_enty)            "Export of traded commodity."
+vm_Mport(tall,all_regi,all_enty)            "Import of traded commodity."
+;
+*** EOF ./modules/24_trade/standard/declarations.gms
\ No newline at end of file
diff --git a/modules/24_trade/standard/input/files b/modules/24_trade/standard/input/files
new file mode 100644
index 0000000000000000000000000000000000000000..a13305f84dbee860d7445ecc464a1f3e6af3e373
--- /dev/null
+++ b/modules/24_trade/standard/input/files
@@ -0,0 +1,2 @@
+pm_costsPEtradeMp.cs4r
+pm_costsTradePeFinancial.cs3r
diff --git a/modules/24_trade/standard/postsolve.gms b/modules/24_trade/standard/postsolve.gms
new file mode 100644
index 0000000000000000000000000000000000000000..633e1ab68cec709a82b02b36e3d621fc1326d07e
--- /dev/null
+++ b/modules/24_trade/standard/postsolve.gms
@@ -0,0 +1,11 @@
+*** |  (C) 2006-2019 Potsdam Institute for Climate Impact Research (PIK)
+*** |  authors, and contributors see CITATION.cff file. This file is part
+*** |  of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of
+*** |  AGPL-3.0, you are granted additional permissions described in the
+*** |  REMIND License Exception, version 1.0 (see LICENSE file).
+*** |  Contact: remind@pik-potsdam.de
+*** SOF ./modules/24_trade/standard/postsolve.gms
+
+pm_Xport0(ttot,regi,tradePe) = vm_Xport.l(ttot,regi,tradePe);
+
+*** EOF ./modules/24_trade/standard/postsolve.gms
\ No newline at end of file
diff --git a/modules/24_trade/standard/presolve.gms b/modules/24_trade/standard/presolve.gms
new file mode 100644
index 0000000000000000000000000000000000000000..14642b68d6f11a250c9dbe0a1cc851c491693d5a
--- /dev/null
+++ b/modules/24_trade/standard/presolve.gms
@@ -0,0 +1,11 @@
+*** |  (C) 2006-2019 Potsdam Institute for Climate Impact Research (PIK)
+*** |  authors, and contributors see CITATION.cff file. This file is part
+*** |  of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of
+*** |  AGPL-3.0, you are granted additional permissions described in the
+*** |  REMIND License Exception, version 1.0 (see LICENSE file).
+*** |  Contact: remind@pik-potsdam.de
+*** SOF ./modules/24_trade/standard/presolve.gms
+
+pm_Xport0(ttot,regi,tradePe) = vm_Xport.l(ttot,regi,tradePe);
+
+*** EOF ./modules/24_trade/standard/presolve.gms
\ No newline at end of file
diff --git a/modules/24_trade/standard/realization.gms b/modules/24_trade/standard/realization.gms
new file mode 100644
index 0000000000000000000000000000000000000000..9b7a712f6fd5c024e7f102661706b5785e4a6209
--- /dev/null
+++ b/modules/24_trade/standard/realization.gms
@@ -0,0 +1,17 @@
+*** |  (C) 2006-2019 Potsdam Institute for Climate Impact Research (PIK)
+*** |  authors, and contributors see CITATION.cff file. This file is part
+*** |  of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of
+*** |  AGPL-3.0, you are granted additional permissions described in the
+*** |  REMIND License Exception, version 1.0 (see LICENSE file).
+*** |  Contact: remind@pik-potsdam.de
+*** SOF ./modules/24_trade/realization.gms
+
+*####################### R SECTION START (PHASES) ##############################
+$Ifi "%phase%" == "sets" $include "./modules/24_trade/standard/sets.gms"
+$Ifi "%phase%" == "declarations" $include "./modules/24_trade/standard/declarations.gms"
+$Ifi "%phase%" == "datainput" $include "./modules/24_trade/standard/datainput.gms"
+$Ifi "%phase%" == "bounds" $include "./modules/24_trade/standard/bounds.gms"
+$Ifi "%phase%" == "presolve" $include "./modules/24_trade/standard/presolve.gms"
+$Ifi "%phase%" == "postsolve" $include "./modules/24_trade/standard/postsolve.gms"
+*######################## R SECTION END (PHASES) ###############################
+*** EOF ./modules/24_trade/realization.gms
diff --git a/modules/24_trade/standard/sets.gms b/modules/24_trade/standard/sets.gms
new file mode 100644
index 0000000000000000000000000000000000000000..e89929f255e3e789188ff5ff49d2190a3f3202a3
--- /dev/null
+++ b/modules/24_trade/standard/sets.gms
@@ -0,0 +1,35 @@
+*** |  (C) 2006-2019 Potsdam Institute for Climate Impact Research (PIK)
+*** |  authors, and contributors see CITATION.cff file. This file is part
+*** |  of REMIND and licensed under AGPL-3.0-or-later. Under Section 7 of
+*** |  AGPL-3.0, you are granted additional permissions described in the
+*** |  REMIND License Exception, version 1.0 (see LICENSE file).
+*** |  Contact: remind@pik-potsdam.de
+*** SOF ./modules/24_trade/standard/sets.gms
+
+sets
+trade(all_enty)             "All traded commodities"
+/
+/
+
+tradeMacro(all_enty)        "Traded macro-economic commodities"
+/
+    good, 
+    perm
+/
+
+tradePe(all_enty)           "Traded primary energy commodities"
+/
+    peoil, 
+    pecoal, 
+    pegas, 
+    peur, 
+    pebiolc
+/
+
+tradeSe(all_enty)           "Traded secondary energy commodities"
+/
+    null
+/
+;
+
+*** EOF ./modules/24_trade/standard/sets.gms
\ No newline at end of file
diff --git a/modules/29_CES_parameters/calibrate/realization.gms b/modules/29_CES_parameters/calibrate/realization.gms
index d29f587cff862b7dcb911084243697464b92c16b..b332924b223215af929daa715dd6bd69f61d5b51 100644
--- a/modules/29_CES_parameters/calibrate/realization.gms
+++ b/modules/29_CES_parameters/calibrate/realization.gms
@@ -197,7 +197,7 @@
 *'
 *'To implement perfectly complementary factors, you should include the factors in the set `in_complements`. In addition, the elasticity of substitution between these factors should be set to `INF` (which is counter-intuitive). Prices of complementary inputs are set to 1, so that the output is equal to the sum of inputs (reason why the substitution elasticity should be INF), which makes sense for energetic entities. It would however be possible to change this (by choosing another elasticity of substitution) without harming the calibration.
 *'
-*'In the model, the complementary factors are subject to a constraint (`q_prodCompl` or `q_prodCompl_putty`), so that each variable is computed by multiplying a key variable of the CES function by a given factor. The calibration computes this factor for each period.
+*'In the model, the complementary factors are subject to a constraint (`q01_prodCompl` or `q01_prodCompl_putty`), so that each variable is computed by multiplying a key variable of the CES function by a given factor. The calibration computes this factor for each period.
 *'
 *'#### Setup
 *'
diff --git a/modules/80_optimization/nash/declarations.gms b/modules/80_optimization/nash/declarations.gms
index c8cf637184c995e48ea7ff41b26f25c779e26499..72ca65af7c8a74c51803b7b9e48c683108417f10 100644
--- a/modules/80_optimization/nash/declarations.gms
+++ b/modules/80_optimization/nash/declarations.gms
@@ -79,6 +79,10 @@ p80_SolNonOpt(all_regi)                    "solve status"
 pm_fuExtrForeign(ttot,all_regi,all_enty,rlf) "foreign fuel extraction"
 ;
 
+positive variable
+*AJS* Adjustment costs for Nash trade algorithm.  Only non-zero in the Nash_test realization of 80_optimization module.
+vm_costAdjNash(ttot,all_regi)               "Adjustment costs for deviation from the trade structure of the last iteration." 
+;
 
 equations
 q80_budg_intertemp(all_regi)               "interemporal trade balance (Nash mode only)"
diff --git a/modules/80_optimization/negishi/declarations.gms b/modules/80_optimization/negishi/declarations.gms
index 1fe0b0dfd7539eaf4cce03df7712221c21d26332..34270569be7f74e8000323e607bceeddda3a558d 100644
--- a/modules/80_optimization/negishi/declarations.gms
+++ b/modules/80_optimization/negishi/declarations.gms
@@ -23,6 +23,11 @@ pm_cumEff(tall,all_regi,all_in)          "parameter for spillover externality (a
 pm_fuExtrForeign(ttot,all_regi,all_enty,rlf) "foreign fuel extraction"
 ;
 
+positive variable
+*AJS* Adjustment costs for Nash trade algorithm.  Only non-zero in the Nash_test realization of 80_optimization module.
+vm_costAdjNash(ttot,all_regi)               "Adjustment costs for deviation from the trade structure of the last iteration." 
+;
+
 equations
 q80_balTrade(ttot,all_enty)              "trade balance equation"
 q80_budget_helper(ttot,all_regi)         "Helper declaration for import from gdx"
diff --git a/modules/80_optimization/testOneRegi/declarations.gms b/modules/80_optimization/testOneRegi/declarations.gms
index 926068c18fa41e1875fd7c07caf22c0221e841a1..a50a35efdf79e00813509ed11bb10f5e06aa7430 100644
--- a/modules/80_optimization/testOneRegi/declarations.gms
+++ b/modules/80_optimization/testOneRegi/declarations.gms
@@ -16,6 +16,11 @@ pm_cumEff(tall,all_regi,all_in)                     "parameter for spillover ext
 pm_fuExtrForeign(ttot,all_regi,all_enty,rlf)        "foreign fuel extraction"
 ;
 
+positive variable
+*AJS* Adjustment costs for Nash trade algorithm.  Only non-zero in the Nash_test realization of 80_optimization module.
+vm_costAdjNash(ttot,all_regi)               "Adjustment costs for deviation from the trade structure of the last iteration." 
+;
+
 equations
 q80_budg_intertemp(all_regi)                        "interemporal trade balance (Nash mode only)"
 q80_costAdjNash(ttot,all_regi)                      "plays a dummy role for now, allowing fixing to Nash GDX files"
diff --git a/modules/include.gms b/modules/include.gms
index a8b8e01c987e76da5314bf6283f2dbf72105e5fb..36718534b4d0953b69654a6f5d783bab3459c3c9 100644
--- a/modules/include.gms
+++ b/modules/include.gms
@@ -9,6 +9,7 @@
 $setglobal phase %1
 
 *######################## R SECTION START (MODULES) ############################
+$include "./modules/01_macro/module.gms"
 $include "./modules/02_welfare/module.gms"
 $include "./modules/04_PE_FE_parameters/module.gms"
 $include "./modules/05_initialCap/module.gms"
@@ -19,6 +20,7 @@ $include "./modules/20_growth/module.gms"
 $include "./modules/21_tax/module.gms"
 $include "./modules/22_subsidizeLearning/module.gms"
 $include "./modules/23_capitalMarket/module.gms"
+$include "./modules/24_trade/module.gms"
 $include "./modules/26_agCosts/module.gms"
 $include "./modules/29_CES_parameters/module.gms"
 $include "./modules/30_biomass/module.gms"
diff --git a/scripts/utils/gdx_rename.sh b/scripts/utils/gdx_rename.sh
index 7f7f2411b48c434392ac49e849f3465cd0792c9a..728cf5a12c401c09becab5ea9ffcf19a5a9e15e1 100644
--- a/scripts/utils/gdx_rename.sh
+++ b/scripts/utils/gdx_rename.sh
@@ -85,7 +85,7 @@ if (length(args) == 1) {
     p_nw                   = 'p80_nw',
     c_nucscen              = 'cm_nucscen',
     q_co2eq                = 'q_co2eq',
-    pm_costsPEtradeMp      = 'p_costsPEtradeMp', 
+    pm_costsPEtradeMp      = 'pm_costsPEtradeMp', 
     vm_welfare             = 'v_welfare',
     pm_tau_fe_sub          = 'p21_tau_fe_sub', 
     pm_tau_fe_tax          = 'p21_tau_fe_tax',
diff --git a/standalone/MOFEX/MOFEX.gms b/standalone/MOFEX/MOFEX.gms
index 0422399b3d6c91fb9a22bc2ac8c0fe061921ae9c..085e2dae678de1597e0ca472278e2f69ef012721 100644
--- a/standalone/MOFEX/MOFEX.gms
+++ b/standalone/MOFEX/MOFEX.gms
@@ -131,7 +131,7 @@ cm_CCS_steel         "CCS for steel sub-sector"
 c_solscen             "solar option choice"
 cm_bioenergy_tax      "level of bioenergy tax in fraction of bioenergy price"
 cm_bioenergymaxscen   "bound on global pebiolc production excluding residues"
-c_tradecost_bio       "choose financal tradecosts for biomass (purpose grown pebiolc)"
+cm_tradecost_bio       "choose financal tradecosts for biomass (purpose grown pebiolc)"
 c_1stgen_phaseout    "choose if 1st generation biofuels should phase out after 2030 (vm_deltaCap=0)"
 cm_startyear          "first optimized modelling time step"
 c_start_budget        "start of GHG budget limit"
@@ -170,7 +170,7 @@ c_abtrdy              "first year in which advanced bio-energy technology are re
 c_abtcst              "scaling of the cost of advanced bio-energy technologies (no unit, 50% increase means 1.5)"
 c_budgetCO2        "carbon budget for all CO2 emissions (in GtCO2)"
 
-c_trdcst              "parameter to scale trade export cost for gas"
+cm_trdcst              "parameter to scale trade export cost for gas"
 cm_trdadj              "parameter scale the adjustment cost parameter for increasing gas trade export"
 
 c_refcapbnd           "switch for fixing refinery capacities to the SSP2 levels in 2010 (if equal zero then no fixing)"
@@ -217,7 +217,7 @@ cm_CCS_steel           = 1;        !! def = 1
 
 cm_bioenergy_tax    = 1.5;       !! def = 1.5
 cm_bioenergymaxscen = 0;         !! def = 0
-c_tradecost_bio     = 2;         !! def = 2
+cm_tradecost_bio     = 2;         !! def = 2
 $setglobal cm_LU_emi_scen  SSP2   !! def = SSP2
 c_1stgen_phaseout  = 0;         !! def = 0
 
@@ -271,7 +271,7 @@ c_budgetCO2              = 0;   !! def = 1300
 $setGlobal cm_regiCO2target  off     !! def = off
 
 cm_trdadj            = 2;    !! def = 2.0
-c_trdcst             = 1.5;  !! def = 1.5
+cm_trdcst             = 1.5;  !! def = 1.5
 c_refcapbnd          = 0;    !! def = 0
 cm_frac_CCS          = 10;   !! def = 10
 cm_frac_NetNegEmi    = 0.5;  !! def = 0.5
diff --git a/standalone/template.gms b/standalone/template.gms
index 598d8baf2ac589c84bf13ca48aad2ea4d7c09177..c507c11a06e8fae6677fda2487a09781a2b42318 100644
--- a/standalone/template.gms
+++ b/standalone/template.gms
@@ -139,7 +139,7 @@ cm_CCS_steel         "CCS for steel sub-sector"
 c_solscen             "solar option choice"
 cm_bioenergy_tax      "level of bioenergy tax in fraction of bioenergy price"
 cm_bioenergymaxscen   "bound on global pebiolc production excluding residues"
-c_tradecost_bio       "choose financal tradecosts for biomass (purpose grown pebiolc)"
+cm_tradecost_bio       "choose financal tradecosts for biomass (purpose grown pebiolc)"
 c_1stgen_phaseout    "choose if 1st generation biofuels should phase out after 2030 (vm_deltaCap=0)"
 cm_startyear          "first optimized modelling time step"
 c_start_budget        "start of GHG budget limit"
@@ -178,7 +178,7 @@ c_abtrdy              "first year in which advanced bio-energy technology are re
 c_abtcst              "scaling of the cost of advanced bio-energy technologies (no unit, 50% increase means 1.5)"
 c_budgetCO2        "carbon budget for all CO2 emissions (in GtCO2)"
 
-c_trdcst              "parameter to scale trade export cost for gas"
+cm_trdcst              "parameter to scale trade export cost for gas"
 cm_trdadj              "parameter scale the adjustment cost parameter for increasing gas trade export"
 
 c_refcapbnd           "switch for fixing refinery capacities to the SSP2 levels in 2010 (if equal zero then no fixing)"
@@ -225,7 +225,7 @@ cm_CCS_steel           = 1;        !! def = 1
 
 cm_bioenergy_tax    = 1.5;       !! def = 1.5
 cm_bioenergymaxscen = 0;         !! def = 0
-c_tradecost_bio     = 2;         !! def = 2
+cm_tradecost_bio     = 2;         !! def = 2
 $setglobal cm_LU_emi_scen  SSP2   !! def = SSP2
 c_1stgen_phaseout  = 0;         !! def = 0
 
@@ -279,7 +279,7 @@ c_budgetCO2              = 1350;   !! def = 1300
 $setGlobal cm_regiCO2target  off     !! def = off
 
 cm_trdadj            = 2;    !! def = 2.0
-c_trdcst             = 1.5;  !! def = 1.5
+cm_trdcst             = 1.5;  !! def = 1.5
 c_refcapbnd          = 0;    !! def = 0
 cm_frac_CCS          = 10;   !! def = 10
 cm_frac_NetNegEmi    = 0.5;  !! def = 0.5
diff --git a/tutorials/2_RunningREMIND.md b/tutorials/2_RunningREMIND.md
index 7f0150565b9bdb5e6974ea767d9706a99901feb7..e5e251c6e179fc9256ef95b73c8e6532f1e8310f 100644
--- a/tutorials/2_RunningREMIND.md
+++ b/tutorials/2_RunningREMIND.md
@@ -16,7 +16,8 @@ Felix Schreyer (<felix.schreyeru@pik-potsdam.de>), Lavinia Baumstark (<baumstark
 
 1. Your first run
 ==================
-   	
+   
+
 This section will explain how you start your first run in REMIND.
 
 Default Configurations (config/default.cfg)
@@ -28,7 +29,7 @@ a. The first part, MODULES, contains the various modules used in REMIND and vari
 
 ``` bash
 cfg$gms$<module name
-``` 
+```
 
 b. The SWITCHES and FLAGS section are various settings to control, for e.g., how many iterations to run, which technologies to run, which SSP to use, start and end year of model run etc. See the fourth section, explanations of switches and flags, to know more. 
 
@@ -47,7 +48,7 @@ Your config file should look like this:
 <p class="caption">
 Example for a scenario_config of REMIND
 </p>
-	
+
 Save the config file as a csv file with `;` as delimiter. You can check that, for example, by opening the csv in a text editor. If the delimiter is not `;`, change it in Windows under ***Control Panel*** ->  ***Region***  -> ***Additional Settings*** -> ***List separator***. 
 
 To finally start REMIND with this config file, you need to run the R-script ***start_bundle.R*** on the cluster on this config file. For this:
@@ -67,7 +68,7 @@ For starting one single or a bundle of runs via scenario_config.csv you use the
 
 ``` r
 nohup Rscript start_bundle.R config/scenario_config.csv &
-```		
+```
 Now, keep your fingers crossed that everything works as it should.The process of your job submission is documented in the file nohup.out that you created with the nohup command. After a couple of minutes, you should see something like `Submitted Batch Job ...` in the nohup.out file. This means that your run has been started. To see how far your run is or whether it was stopped due to some problems, go to the `Output` folder and type 
 
 ``` bash
@@ -97,13 +98,14 @@ in the terminal.
 2. What happens during a REMIND run?
 =====================================
 	
+
 This section will give some technical introduction into what happens after you have started a run. It will not be a tutorial, but rather an explanation of the different parts in the modeling routine. The whole routine is illustrated in Figure 1. The core of the model is the optimization written in GAMS. However, there is some pre-processing of the input data and some post-processing of the output data using R scripts.
 
 <img src="figures/REMIND_flow.png" alt="REMIND modeling routine" width="100%" />
 <p class="caption">
 REMIND modeling routine
 </p>
-	
+​	
 
 3. What happens once you start REMIND on the Cluster? 
 =======================================================
@@ -117,8 +119,8 @@ The optimization in REMIND requires a lot of input data. For example, the model
 ``` bash
 /p/projects/rd3mod/inputdata/sources.
 ```
-		
-The data are mostly in csv files. During the input data preparation, these files are read and processed, using functions from the *moinput* library. Input data are available on country-level. Then, depending on the regionmapping file you chose in the config file of your run, the country-level data are aggregated into regions, e.g. to LAM (Latin America), EUR (Europe) and so on. Finally, the data are stored as .cs3r or .cs4r files in various input folders of your REMIND directory. These files are basically tables, too, that you can open with a text editor or Excel. For example, you find the input file `p_histCap.cs3r` in your REMIND directory under `core/input`. It provides the model with historically observed values of installed capacities of some technologies in the respective regions. 
+
+The data are mostly in csv files. During the input data preparation, these files are read and processed, using functions from the *moinput* package. Input data are available on country-level. Then, depending on the regionmapping file you chose in the config file of your run, the country-level data are aggregated into regions, e.g. to LAM (Latin America), EUR (Europe) and so on. Finally, the data are stored as .cs3r or .cs4r files in various input folders of your REMIND directory. These files are basically tables, too, that you can open with a text editor or Excel. For example, you find the input file `p_histCap.cs3r` in your REMIND directory under `core/input`. It provides the model with historically observed values of installed capacities of some technologies in the respective regions. 
 The regional resolution of the run is set in the config/default.cfg by 
 ``` bash
 cfg$regionmapping
@@ -135,7 +137,7 @@ The actual REMIND is written in GAMS, a programming software to numerically solv
 		 
 c) Output Processing
 ----------------------
-The output processing works with a number of R functions from the **remind** library (most of them start with `report... .R`). The wrapper function **convGDX2MIF.R** writes the most relevant output into the so-called **.mif** file. Again, it is a table that you can open in Excel for example. You find under `output` in the folder of your REMIND run as 
+The output processing works with a number of R functions from the **remind** package (most of them start with `report... .R`). The wrapper function **convGDX2MIF.R** writes the most relevant output into the so-called **.mif** file. Again, it is a table that you can open in Excel for example. You find under `output` in the folder of your REMIND run as 
 
 ``` bash
 REMIND_generic_YourRun.mif
diff --git a/tutorials/5_AnalysingModelOutputs.md b/tutorials/5_AnalysingModelOutputs.md
index 1940ce2a697e159e52d5980e7c42b93ae51fb649..4790c82a26f32af36523adad9844d995367289de 100755
--- a/tutorials/5_AnalysingModelOutputs.md
+++ b/tutorials/5_AnalysingModelOutputs.md
@@ -22,23 +22,23 @@ Felix Scheyer (<felix.schreyer@pik-potsdam.de>), Isabelle Weindl (<weindl@pik-po
 1. Introduction
 ===============
 
-After having successfully started and accomplished a simulation run, the next step is to evaluate the simulation results. 
+After having successfully started and completed a scenario run, the next step is to evaluate the results. 
 
 There are plentiful ways to look at and analyze REMIND results. This tutorial gives an overview on different tools and options that can be used.
 
-For each simulation, results are written to a folder that is created automatically as a combination of **model title** name and the **current date** inside the **output** folder of the model.
+For each scenario, results are written to a folder that is created automatically as a combination of **scenario title** name and the **current date** inside the **output** folder of the model.
 
 2. Model output files
 =====================
 
-As mentioned in section 2, the two main output files you will typically care about are the *fulldata.gdx* and the *REMIND_generic_NameofYourRun.mif* files in the *output* folder of your run. The *fulldata.gdx* is the actual technical output of the GAMS optimization and contains all the variables, parameters, sets etc. (the differences between these GAMS objects are explained in tutorial 2) of the REMIND model. However, this gdx-file ia mainly interesting once you actually work on the GAMS code and want to check specific the variables and their values. If you simply want to look at REMIND results of your run or use it for further data analysis and plotting, you would open the *REMIND_generic_NameofYourRun.mif* which is basically a csv-file in a certain standardized format used in the Integrated Assessment Modeling community. 
+As mentioned in tutorial 2, the two main output files you will typically care about are the *fulldata.gdx* and the *REMIND_generic_NameofYourRun.mif* files in the *output* folder of your run. The *fulldata.gdx* is the actual technical output of the GAMS optimization and contains all the variables, parameters, sets etc. (the differences between these GAMS objects are explained in tutorial 2) of the REMIND model. However, this gdx-file is mainly interesting once you actually work on the GAMS code and want to check specific the variables and their values. If you simply want to look at REMIND results of your run or use it for further data analysis and plotting, you would open the *REMIND_generic_NameofYourRun.mif* which is basically a csv-file in a certain standardized format used in the Integrated Assessment Modeling community. 
 
-Looking at the *REMIND_generic_NameofYourRun.mif*, the column **scenario** gives the name of the run (that you specified in the first column of your config file when starting the run). The column **region** provides an three-letter acronym of the region (e.g. EUR -> EU, SSA -> Sub-Saharan Africa). The column **variable** represents the variable you are looking at (To avoid confusion with the above: It does not necessarily represent a variable in the GAMS code of REMIND. The mif-file is a synthetized output generated from *fulldata.gdx* by post-processing Rscripts from the *remind* library). Scrolling through the **variable** column, you will get an impression of the myriad of outputs the REMIND model permits you to explore. 
+Looking at the *REMIND_generic_NameofYourRun.mif*, the column **scenario** gives the name of the run (that you specified in the first column of your config file when starting the run). The column **region** provides an three-letter acronym of the region (e.g. EUR -> EU, SSA -> Sub-Saharan Africa). The column **variable** represents the variable you are looking at (To avoid confusion with the above: It does not necessarily represent a variable in the GAMS code of REMIND. The mif-file is a synthetized output generated from *fulldata.gdx* by post-processing Rscripts from the *remind* package). Scrolling through the **variable** column, you will get an impression of the outputs the REMIND model permits you to explore. 
 
 3. Loading and analyzing model output in R
 ==============================
 
-### 3.1 Access Cluster
+### 3.1 Access the Cluster
 
 To analyze your model results, you can load the output of the mif-file into a local session in RStudio. To get the file from the cluster, you can download the mif-file, for example, via WinSCP. You can read more details on how to access the cluster here:
 
@@ -46,9 +46,9 @@ To analyze your model results, you can load the output of the mif-file into a lo
 https://redmine.pik-potsdam.de/projects/mo/wiki/Getting_ready_to_use_the_Cluster
 
 
-### 3.2 Load mif file as Magpie Object
+### 3.2 Load a mif file as a Magpie Object
 
-You can load the mif-file of your run into a magpie object from the **magclass** R library by
+You can load the mif-file of your run into a magpie object from the **magclass** R package by
 
 ``` r
 out <- read.report("Path/to/your/mif-file", as.list = F)
@@ -63,14 +63,14 @@ you see the dimension of the magpie object. Magpie objects are basically arrays,
 ``` r
 out["EUR", c("y2020","y2050"), "FE|Transport (EJ/yr)"]
 ```
-Instead of these objects from the R library **magclass**, you can also use dataframes from the R library **quitte**. Arrays are generally better for doing calculations, while dataframes are better for plotting. You will find out after a while which way works best for you. The **quitte** dataframes are probably better for output analysis because this is a lot about plotting. For reading in the *.mif* file as a dataframe, you have to load the library **quitte** and then run the command
+Instead of these objects from the R package **magclass**, you can also use data frames from the R package **quitte**. Arrays are generally better for doing calculations, while data frames are better for plotting. You will find out after a while which way works best for you. The **quitte** data frames are probably better for output analysis because this is a lot about plotting. For reading in the *.mif* file as a data frame, you have to load the package **quitte** and then run the command
 
-### 3.3 Load mif file as quitte Object	
+### 3.3 Load a mif file as a quitte Object	
 
 ``` r
-mifdata <- read.quitte(PathtoYourMifFile.mif)
+mifdata <- read.quitte('PathtoYourMifFile.mif')
 ```
-The data is now stored in the *quitte* object *mifdata*. In RStudio, selecting it and hitting F2 will show you its content. Usually, you will want to filter for some regions, variables, periods that you are interested in. For example, like this: 
+The data is now stored in the *quitte* object *mifdata*. In RStudio, selecting it (the text *mifdata* in the editor window) and hitting F2 will show you its content. Usually, you will want to filter for some regions, variables, periods that you are interested in. For example, like this: 
 	
 ``` r
 df <- filter(mifdata,
@@ -79,9 +79,9 @@ df <- filter(mifdata,
 			scenario %in% c('BAU'),
 			period %in% c(2005,2030,2050)) 
 ```
-### 3.4 Load gdx file as magpie object
+### 3.4 Load a gdx file as a Magpie Object
 
-Finally, you can also load the content of the **fulldata.gdx** via the function **readGDX** of the **gdx library** (<https://github.com/pik-piam/gdx>) into a magpie file to directly access the GAMS output. Here is an example of how **readGDX** is used:
+Finally, you can also load the content of the **fulldata.gdx** via the function **readGDX** of the **gdx** package  (<https://github.com/pik-piam/gdx>) into a magpie file to directly access the GAMS output. Here is an example of how **readGDX** is used:
 
 ``` r
 pe2se  <- readGDX(gdx,"pe2se")
@@ -105,7 +105,7 @@ The automated model analysis (summary and validation) is an important example of
 For a first overview and for not getting lost in the huge amount of variables you can look at the *REMIND_summary_[title].pdf*. This .pdf-file will give you an overview on the model results and guides you through the story. 
 
 ### 4.3 The Whole Range of Validation
-A standard validation PDF *REMIND_validation_[title].pdf* consists of hundreds of evaluation outputs. By evaluating the model outputs on such a broad level rather than focusing only on key outputs, it allows getting a more complete picture of the corresponding simulation. The table of contents of the validation pdf gives a good overview about the breadth of model outputs that can be simulated with a REMIND standard simulation, even though the validation pdf only shows a subset of possible model outputs.
+A standard validation PDF *REMIND_validation_[title].pdf* consists of hundreds of evaluation outputs. By evaluating the model outputs on such a broad level rather than focusing only on key outputs, it allows getting a more complete picture of the corresponding scenario. The table of contents of the validation pdf gives a good overview about the breadth of model outputs that can be generated with a REMIND standard scenario, even though the validation pdf only shows a subset of possible model outputs.
 
 
 5. Interactive scenario analysis
@@ -115,20 +115,21 @@ The automated model validation is a good tool for visually evaluating a broad ra
 
 ### 5.1. AppResults
 
-To overcome this issue, we developed the interactive scenario analysis and evaluation tools appResults and appResultsLocal as part of the library **shinyresults** (<https://github.com/pik-piam/shinyresults>), which show evaluation plots for multiple scenarios including historical data and other projections based on an interactive selection of regions and variables. You can use this tool by running the following R command, which will automatically collect all runs and visualize them:
+To overcome this issue, we developed the interactive scenario analysis and evaluation tools appResults and appResultsLocal as part of the package **shinyresults** (<https://github.com/pik-piam/shinyresults>), which show evaluation plots for multiple scenarios including historical data and other projections based on an interactive selection of regions and variables. You can use this tool by running the following R command, which will automatically collect all runs and visualize them:
 
 ``` r
 shinyresults::appResults()
 ```
 
-This command opens an interactive window, where you can select the simulations that you want to evaluate.
+This command opens an interactive window, where you can select the scenarios that you want to evaluate.
 
 <img src="figures/appResults_window.png" alt="Interactive Results app" width="70%" />
+
 <p class="caption">
 Interactive Results app
 </p>
 
-You can use filters to select a subset of all runs stored in the output folder of the model, for example by searching for runs that have been finished at a certain day or by searching for keywords in the title of the simulation runs:
+You can use filters to select a subset of all runs stored in the output folder of the model, for example by searching for runs that have been finished at a certain day or by searching for keywords in the title of the scenarios:
 
 <img src="figures/appResults_runselection.png" alt="Run selection by using a filter" width="70%" />
 <p class="caption">
@@ -139,7 +140,7 @@ If you run the following command in the output folder of your local computer you
 ``` r
 shinyresults::appResultsLocal()
 ```
-Another tool for analyzing model output on your local computer is the scneario tool from the mip library. You can open it from the R console by: 
+Another tool for analyzing model output on your local computer is the scenario tool from the mip package. You can open it from the R console by: 
 
 ``` r
 mip::scenTool()
@@ -158,7 +159,7 @@ cfg$output <- c("reporting","validation","rds_report","validationSummary","dashb
 
 ### 6.2. Execution of model-internal output scripts in the command window
 
-Output scripts that are included in the folders **scripts/output/single** and **scripts/output/comparison** can also be executed via command window. To do so, windows users can open a command line prompt in the REMIND model folder by using **shift** + **right click** and then selecting *open command window here* option.
+Output scripts that are included in the folders **scripts/output/single** and **scripts/output/comparison** can also be executed via a command window. To do so, windows users can open a command line prompt in the REMIND model folder by using **shift** + **right click** and then selecting *open command window here* option.
 
 In the command prompt, use the following command:
 
@@ -173,23 +174,23 @@ You are now asked to choose the output mode: 1: Output for single run 2: Compari
 Executing output scripts via command window
 </p>
 
-In both cases, you can choose from the list of available model simulations, for which runs you want to conduct the model output analysis.In the next step, you can interactively indicate which model-internal output scripts you want to execute.
+In both cases, you can choose from the list of available model scenarios, for which runs you want to conduct the model output analysis. In the next step, you can interactively indicate which model-internal output scripts you want to execute.
 
-Now, the selected scripts are executed. After completion, the results are written in the respective folder of the simulation run (combination of **model title** name and the **current date** inside the **output** folder of the model).
+Now, the selected scripts are executed. After completion, the results are written in the respective folder of the run (combination of **model title** name and the **current date** inside the **output** folder of the model).
 
 
-7. Analysis of outputs with the remind library
+7. Analysis of outputs with the remind package
 ===============================================
 
-If you want to go beyond visual output analysis and predefined output evaluation facilitated by scripts in the model folders **scripts/output/single** and **scripts/output/comparison**, you can use the functionality of the R package *remind*. This library contains a list of common functions for extracting outputs from the REMIND model which are also the basis for the generation of the automated validation pdf. For a quick overview on the functions which are included in the library, you can scan the folder **remind/R**. 
+If you want to go beyond visual output analysis and predefined output evaluation facilitated by scripts in the model folders **scripts/output/single** and **scripts/output/comparison**, you can use the functionality of the R package *remind*. This package contains a list of common functions for extracting outputs from the REMIND model which are also the basis for the generation of the automated validation pdf. For a quick overview on the functions which are included in the package, you can scan the folder **remind/R**. 
 
-For making yourself familiar with this library, you can open a R/RStudio session and set the REMIND model folder as working directory. This can be done by using the following command:
+For making yourself familiar with this package, you can open a R/RStudio session and set the REMIND model folder as working directory. This can be done by using the following command:
 
 ``` r
 setwd("/path/to/your/remind/model/folder")
 ```
 
-Then, load the library and call the help pages:
+Then, load the package and call the help pages:
 
 ``` r
 library(remind)
diff --git a/tutorials/6_Advanced_ChangeInputs.md b/tutorials/6_Advanced_ChangeInputs.md
index 9c40f9530c64292afa2ac3ef3b0f9c4e6def8d10..fa83939142e305ce1f503e7714cbfea1e165a2eb 100644
--- a/tutorials/6_Advanced_ChangeInputs.md
+++ b/tutorials/6_Advanced_ChangeInputs.md
@@ -36,11 +36,11 @@ ssh-keygen -p
 ```
 It is recommended to first copy the existing key (e.g. id_dsa into id_dsa-local) and remove the passphrase of this copy and copy it to your machine.
 
-If you plan to run REMIND not with the default regional resolution you have to take care that REMIND starts from a gdx with the correct regional resolution. Either you can use one from an older run with the corresponding regional resolution or you can construct a new gdx with the correct regional resolution from a gdx in a different regional resolution by using the function gdx_rename from the library(gdx) (e.g. gdx_rename("input.gdx",set_name="all_regi",c(REF="RUS",CAZ="ROW",...,MEA="MEA",USA="USA"))).
+If you plan to run REMIND not with the default regional resolution you have to take care that REMIND starts from a gdx with the correct regional resolution. Either you can use one from an older run with the corresponding regional resolution or you can construct a new gdx with the correct regional resolution from a gdx in a different regional resolution by using the function gdx_rename from the package (gdx) (e.g. gdx_rename("input.gdx",set_name="all_regi",c(REF="RUS",CAZ="ROW",...,MEA="MEA",USA="USA"))).
 
 
 Adding New Input Data
 ======================
 
-The input data for REMIND are generated by using the R-libraries *moinput* and *madrat* (https://github.com/pik-piam/madrat). While *moinput* contains all calculations tailored to REMIND-input-data, the library *madrat* provides the general wrapper functions and helpful tools. For further information read the vignettes part of the R-packages.
+The input data for REMIND are generated by using the R-libraries *moinput* and *madrat* (https://github.com/pik-piam/madrat). While *moinput* contains all calculations tailored to REMIND-input-data, the package *madrat* provides the general wrapper functions and helpful tools. For further information read the vignettes part of the R-packages.
 
diff --git a/tutorials/7_Advanced_ChangeCode.md b/tutorials/7_Advanced_ChangeCode.md
index fc5e52cabae448504358219f8bd38de1e0a4960e..295053c604f6d5cd19f9b26b84f7437c16be33c9 100644
--- a/tutorials/7_Advanced_ChangeCode.md
+++ b/tutorials/7_Advanced_ChangeCode.md
@@ -92,7 +92,7 @@ How to make a new module or realization in REMIND
 
 If you want to create a **new module** in REMIND first think about the interfaces between the core code and your new module. This helps you to design your module. 
 
-For creating a new module you can use the function **module_skeleton** from the R library "lucode". Start R and set the working directory to the folder of your REMIND version you want to make the changes (e.g. setwd(../../remind_20/trunk)). 
+For creating a new module you can use the function **module_skeleton** from the R package "lucode". Start R and set the working directory to the folder of your REMIND version you want to make the changes (e.g. setwd(../../remind_20/trunk)). 
 
 ``` r
 library(lucode)
@@ -101,7 +101,7 @@ module.skeleton(100,"bla",c("on","off"))
 
 It creates all folders and gams files for your new module "100_bla" with the realizations "on" and "off". More information about the function module_skeleton you can find at the help desk of R. 
 
-For creating a **new realization** of an existing module you can also use the function module_skeleton of the R library "lucode". Go into the folder "module" of your REMIND version and there in the folder of the module you want to make a new realization for (e.g. "module/100_bla", "module/10_climate"). Now you can start R and set the working directory to the head folder of your REMIND version you want to introduce the new realization. 
+For creating a **new realization** of an existing module you can also use the function module_skeleton of the R package "lucode". Go into the folder "module" of your REMIND version and there in the folder of the module you want to make a new realization for (e.g. "module/100_bla", "module/10_climate"). Now you can start R and set the working directory to the head folder of your REMIND version you want to introduce the new realization. 
 
 ``` r
 library(lucode)