diff --git a/pure code not instalable as environment/PDF_generator.py b/pure code not instalable as environment/PDF_generator.py
index 91ff64401ffdcdc1eb543474503e91c0a76c2313..709fb4afcabd368de21c7a4bf79f2af2403b0336 100644
--- a/pure code not instalable as environment/PDF_generator.py	
+++ b/pure code not instalable as environment/PDF_generator.py	
@@ -122,15 +122,14 @@ endScan = bg.platoend_index
 # Save the files for the BG subtration as .dat
 bg.outputDatFile(rootdir + '/processed/' + meas_sampleName + '/Dat_files/bg_Dat/')
 
-# Here we extract some of the data from the class to use it later, 
-# when we work with the sample and not the BG
+# Here we extract some of the data from the background subtraction in the sample section.
 bg.getRampPlatoLists(bg_heat_ranges)
-bg_plato_list = bg.plato_list
-bg_ramp_list = bg.ramp_list
 
 # Save everthing done to a log file.
 bg.PrintLogFile(rootdir + '/processed/' + meas_sampleName + '/Log_files/bg_Log/')
 
+
+
 # Finish for the BG part: Now to the real sample
 #-----------------------------------------------------------------------------------------#
 
@@ -152,7 +151,6 @@ endScan = meas.platoend_index
 
 # Also here we process and save to .dat
 meas.outputDatFile(rootdir + '/processed/' + meas_sampleName + '/Dat_files/meas_type1_uncorrected_Dat/')
-original = meas.I
 
 # Finish loading the sample: Now to the BG subtraction and PDF generation
 #-----------------------------------------------------------------------------------------#
@@ -168,10 +166,11 @@ original = meas.I
 
 #Background subtraction, filtering and baseline correction
 meas.getRampPlatoLists(meas_heat_ranges)
-meas.bgSubtraction(bg_plato_list,bg_ramp_list,meas_heat_ranges,bg_sampleName,FactorMax=FactorMax, Qmaxinst=Qmaxinst, 
+meas.bgSubtraction(bg.plato_list,bg.ramp_list,meas_heat_ranges,bg_sampleName,FactorMax=FactorMax, Qmaxinst=Qmaxinst, 
                    empty_glas_int=empty_glas_int, empty_glas=empty_glas, Qmin=Qmin, use_PDF_maximization=use_PDF_maximization,
                    outputPath=rootdir + '/processed/' + meas_sampleName + '/PDF_files/meas_type1_uncorrected_PDF/',
                    single_BG_file=r'C:/Users/admin/Nextcloud/MyData/bt_1222/in_situ_reactions/varex/data/Normed_and_Averaged/lk_zns_background_insitu_oaws_1_00001_002-n=None/lk_zns_background_insitu_oaws_1_00001-17040.chi')
+
 meas.outputMatFile(rootdir + '/processed/' + meas_sampleName + '/Mat_files/meas_type1_uncorrected_Mat/')
 meas.PrintLogFile(rootdir + '/processed/' + meas_sampleName + '/Log_files/meas_type1_uncorrected_Log/')
 
@@ -190,30 +189,5 @@ meas.checkPhases(check_phases_at_scan,references=references,savefig='png',output
 # In addition 2D and 1D plots of the data over time can be plottet
 meas.plot2dTemp(savefig='svg',outputPath=rootdir + '/processed/' + meas_sampleName + '/XRD_Plots/meas_2D_plot/')
 meas.plot1dvsTime(step_width=2,maxQ=15, max_index=30, plot_temp=True,savefig='svg',outputPath=rootdir + '/processed/' + meas_sampleName + '/XRD_Plots/meas_1D_plot/')
-#~~~~~~~~~~~~~~~~~ XRD Phase Check end ~~~~~~~~~~~~~~~~~~~~~#
 
 
-
-# Now we come to the PDf generation itself (appart from the one performed for BG subtraction)
-#-----------------------------------------------------------------------------------------#
-# In the beginning I tried with 3 types of aproches 
-# 1. Giving PDFgetX3 the sample and BG file + the subtraction factor (no corrections done)
-#       --> This is now implemented directly in the BG subtraction, when using PDF maximization for it.
-# 2. Subtracting the BG and the give PDFgetX3 just the subtracted sample file
-#       (This approche works not that well as PDFgetX3 accounts for the BG subtraction scale and alters the PDF in a profidable manner,
-#        however here one can do baseline corrections quite easily)
-# 3. Doing the corrections first, then accounting for the scale of the BG and subracting the corrections from both BG and sample,
-#        then giving PDFgetX3 both corrected files and the scale 
-#       (This approche can be helpfull, but in the end corrections are after the FT not that important as a good BG subtraction)
-
-# The difference between Qmaxinst and Qmaxinst_integrate is just that one is used as a mask for the BG subtraction
-# and the other as the limit for PDFgetX3. Often they can be set just to be the same, 
-# so I didn“t incllude 2 varibles in the class and I now set the here:
-Qmaxinst = Qmaxinst_integrate
-
-#This line is used already in the phase check but is missing if one comments it out, 
-# because you already now the data set and just want to reprocess the PDF.
-meas.I = meas.subtracted_I
-
-# Here we create the .dat for PDFgetX3 to take:
-meas.outputDatFile(rootdir + '/processed/' + meas_sampleName + '/Dat_files/meas_type2_corrected_prior_Dat/')