diff --git a/build/lib/iexcode/instruments/ARPES.py b/build/lib/iexcode/instruments/ARPES.py
index 145759505fa8998c367daf2d8ce6b424e8bc2c96..d156ced2d40c89bd1eb701f076106987e8ed1b9a 100644
--- a/build/lib/iexcode/instruments/ARPES.py
+++ b/build/lib/iexcode/instruments/ARPES.py
@@ -1,4 +1,5 @@
 import os
+from re import A
 from time import sleep
 import numpy as np
 from epics import caget,caput,PV
@@ -71,9 +72,11 @@ def ARPES_init(*userName,**kwargs):
                 user_name = userName[0]
         print(user_name)
         folders_ARPES(user_name,**kwargs)
+    else:
+        user_name = iex.BL.mda.user_name()
 
-        #update for default scanRecord advanced parameters
-        iex.BL.mda.log=Logfile('ARPES',user_name,_ARPES_log_header(),_ARPES_log_entries)
+    #update for default scanRecord advanced parameters
+    iex.BL.mda.log=Logfile('ARPES',user_name,_ARPES_log_dictionary)
 
     #EA
     if EA.connected: 
@@ -81,7 +84,7 @@ def ARPES_init(*userName,**kwargs):
         EA.get()
         _EA_init_Motors(ARPES_Motors)
         if kwargs['set_folders']:
-            userPath = os.path.dirname(iex.BL.mda.filepath)
+            userPath = os.path.dirname(iex.BL.mda.filepath())
             folders_EA(userPath,filePrefix="EA",**kwargs)
         
     else:
@@ -306,29 +309,26 @@ def _ARPES_log_header():
         }
     return header_list
 
-def _ARPES_log_entries():
+def _ARPES_log_dictionary():
     """
     endstation info for log file
 
     Previously: scanlog
     """
-    vals = ARPES_get_all(verbose=False)
-    x = vals['x']
-    y = vals['y']
-    z = vals['z']
-    th = vals['th']
-    chi = chi['chi']
-    phi = vals['phi']
-    TA = vals['TA']
-    TB = vals['TB']
-    tey1 = vals['tey1']
-    tey2 = vals['tey2']
-
-    entry_list = ["x","y","z","th","chi","phi","TA","TB","tey1","tey2"]
-    pv_list = [ x, y, z, th, chi, phi, TA, TB, tey1,tey2]  
-    format_list = [".2f",".2f",".2f",".2f",".2f",".2f",".2f",".2f","1.2e","1.2e"]
-
-    return entry_list,pv_list,format_list
+    d={
+        "x":(ARPES_Motors.get('x'),".2f"),
+        "y":(ARPES_Motors.get('y'),".2f"),
+        "z":(ARPES_Motors.get('z'),".2f"),
+        "th":(ARPES_Motors.get('thi'),".2f"),
+        "chi":(ARPES_Motors.get('chi'),".2f"),
+        "phi":(ARPES_Motors.get('phi'),".2f"),
+        "TA":(caget(ARPES_extra_pvs()['TA']),".2f"),
+        "TB":(caget(ARPES_extra_pvs()['TB']),".2f"),
+        "tey1":(caget(ARPES_extra_pvs()['tey1']),"1.2e"),
+        "tey2":(caget(ARPES_extra_pvs()['tey2']),"1.2e")
+        }
+
+    return d
 
 ##############################################################################################################
 ##############################             ARPES scanRecord           ##############################
diff --git a/build/lib/iexcode/instruments/IEX_VPU.py b/build/lib/iexcode/instruments/IEX_VPU.py
index e23ccef3470e5e2a9283ec41791640872cbcf49a..20d0c8957ab48b763aa7462537f42a8513afe0ed 100644
--- a/build/lib/iexcode/instruments/IEX_VPU.py
+++ b/build/lib/iexcode/instruments/IEX_VPU.py
@@ -92,8 +92,8 @@ def ID_get_all(verbose=False):
     vals={    
         "ID_mode":ID_mode_get(verbose=False),
         "ID_QP_ratio":ID_QP_ratio_get(verbose=False),
-        "ID_sp":caget(ID_pvs()['energy_sp']),
-        "ID_rbv":ID_get_eV(verbose=False)
+        "ID_sp":ID_get_sp(verbose=False),
+        "ID_rbv":ID_get_rbv_eV(verbose=False)
     }
 
     if verbose:
@@ -219,6 +219,8 @@ def ID_off(verbose=True):
     waits for permission then turns on the main coils OFF    
     """
     ID_wait_for_permission(verbose=False)
+    ID_ready()
+
     caput(ID_pvs()['main_power'],'Off',wait=True,timeout=18000)
     sleep(5)
     if verbose:
@@ -280,22 +282,35 @@ def ID_switch_mode(ID_mode):
         ID_ready()
 
         print("Switching ID mode, please wait...")
-        ID_mode_set(ID_mode) 
         ID_on(verbose=True)
+        ID_mode_set(ID_mode) 
         ID_ready()
-    print("ID Mode:",ID_mode_get())
+    
+    if ID_mode_get() != ID_mode:
+            print_warning_message("ID mode switch had an error, please try again")
+    else:
+        print("ID Mode:",ID_mode_get())
 
 
 def ID_get(verbose=False):
     """
-    returns the readback value for the 
+    returns the readback value for the ID in keV
     """
     ID_RBV = caget(ID_pvs()['energy_rbv'])
     if verbose:
         print("ID_RBV: ", ID_RBV)
     return ID_RBV  
 
-def ID_get_eV(verbose=False):
+def ID_get_sp(verbose=False):
+    """
+    returns the readback value for the ID in keV
+    """
+    ID_SP = caget(ID_pvs()['energy_sp'])
+    if verbose:
+        print("ID_SP: ", ID_SP)
+    return ID_SP  
+
+def ID_get_rbv_eV(verbose=False):
     """
     returns the readback value for the 
     """
@@ -304,6 +319,15 @@ def ID_get_eV(verbose=False):
         print("ID_RBV: ", ID_RBV)
     return ID_RBV 
 
+def ID_get_sp_eV(verbose=False):
+    """
+    returns the setpoint value for the ID in eV
+    """
+    ID_SP = ID_get_sp(verbose=False)*1000
+    if verbose:
+        print("ID_SP: ", ID_SP)
+    return ID_SP 
+
 def _ID_write_SP_proc(keV):
     # pressing ramp button doesn't work
     # ramp_delay=5
@@ -315,7 +339,7 @@ def _ID_write_SP_proc(keV):
 
 
 def _ID_bw_ok(keV):
-    ID_SP = caget(ID_pvs()['energy_sp'])
+    ID_SP = ID_get_sp(verbose=False)
     ID_bw = ID_SP * 0.095
     ID_diff = abs(ID_get()-keV)
     if ID_diff > ID_bw:
@@ -331,7 +355,7 @@ def ID_set(keV,verbose=True):
     """
     
     #check if I'm already there
-    ID_SP = round(caget(ID_pvs()['energy_sp']),3)
+    ID_SP = round(ID_get_sp(verbose=False),3)
     if round(keV,3) == ID_SP:
         if verbose:
             print("ID already at "+str(ID_SP))
@@ -358,7 +382,7 @@ def ID_set(keV,verbose=True):
             #check if ID within some bandwidth
             if _ID_bw_ok(keV):
                 if verbose:
-                    ID_SP = caget(ID_pvs()['energy_sp'])
+                    ID_SP = ID_get_sp(verbose=False)
                     ID_RBV = ID_get()
                     print("ID SET : "+"%.1f" % ID_SP, "eV")
                     print("ID RBV : "+"%.1f" % ID_RBV, "eV")
@@ -366,9 +390,8 @@ def ID_set(keV,verbose=True):
             else:
                 print_warning_message("ID not within energy bandwidth")
                 ID_QP_ratio_get(verbose)
- 
 
-def ID_energy_set_eV(hv_eV,QP_ratio=None,verbose=True):
+def ID_energy_set(keV,verbose=True):
     """
     Sets optimum ID set point for hv(eV) (max intensity)
     and opens the main shutter
@@ -379,8 +402,30 @@ def ID_energy_set_eV(hv_eV,QP_ratio=None,verbose=True):
     """
     ID_mode = ID_mode_list()[ID_state_get()]
     mono_grating = mono_grating_get()
-    keV = ID_calc_eV(mono_grating,ID_mode,hv_eV,QP_ratio)/1000.0
-    ID_set(keV)
+    QP_ratio = ID_QP_ratio_get()[0]
+    eV = keV/1000.0
+    keV = ID_calc_eV(mono_grating,ID_mode,eV,QP_ratio)/1000.0
+    ID_set(keV,verbose=verbose) 
+
+def ID_energy_set_eV(eV,verbose=True):
+    """
+    Sets optimum ID set point for hv(eV) (max intensity)
+    and opens the main shutter
+
+    Note that QP is generally not calibrated
+
+    Previously: SetID
+    """
+    keV = eV/1000.0
+    ID_energy_set(keV,verbose=verbose)
+
+def ID_set_eV(eV,verbose=True):
+    """
+    Set the ID setpoint
+    """
+    keV=eV/1000.0
+    ID_set(keV,verbose=verbose)
+
 
     
 def ID_QP_ratio_get(verbose=True):
@@ -418,7 +463,7 @@ def ID_QP_mode_set(QP_ratio=None,verbose=True):
     if QP_ratio < QP_min:
         message_string="QP ratio is too small, setting it to minimum allowed value ("+str(QP_min)+")"
         print_warning_message(message_string)
-    QP_ratio=max(70,QP_ratio)
+    QP_ratio=min(100,max(70,QP_ratio))
 
     if QP_ratio != None:
         #checking to see if already in specified QP
@@ -443,9 +488,6 @@ def ID_coef(grt,ID_state,hv_eV,QP_ratio):    # Mode = state (0=RCP,1=LCP,2=V,3=H
     Previously: ID_Coef
     """
 
-    if QP_ratio == None:
-        QP_ratio = ID_QP_ratio_get()[0]
-
     def ListRange(grt,ID_state,IDdict):  # extract the list of break pts for a given mode/grt 
         tmp_list=[]
         for item in (IDdict[grt][ID_state]):
@@ -460,9 +502,7 @@ def ID_coef(grt,ID_state,hv_eV,QP_ratio):    # Mode = state (0=RCP,1=LCP,2=V,3=H
         #print(index)
         return(index[0])
 
-   
-    
-    if QP_ratio < 100:
+    if QP_ratio < 100.0:
         if isinstance(QP_ratio,float) or isinstance(QP_ratio,int): 
             QP_ratio=str(floor(QP_ratio))
             dictfile='Dict_IDCal_QP'+QP_ratio+'.txt'
diff --git a/build/lib/iexcode/instruments/Kappa.py b/build/lib/iexcode/instruments/Kappa.py
index 175c368d499e4c0dd60ed246f61772d669ed0385..7c3ca56b35d1da10ea0fe0ee6c2ff2be5cb6e77a 100644
--- a/build/lib/iexcode/instruments/Kappa.py
+++ b/build/lib/iexcode/instruments/Kappa.py
@@ -20,6 +20,7 @@ from iexcode.instruments.userCalcs import userStringSeq_clear, userStringSeq_pvs
 
 from iexcode.instruments.Motors import Motors
 from iexcode.instruments.current_amplifiers import Keithley, _Keithley_pv, ca_reset_all, _ca_live_sequence
+from iexcode.instruments.current_amplifiers import SRS
 
 from iexcode.instruments.valves import branch_valve_close
 from iexcode.instruments.shutters import branch_shutter_close
@@ -397,7 +398,7 @@ def _kappa_log_entries():
     mesh_current = mesh.current_Amp
     det_name = tthdet.name
     mpa_HV = iex.mpa.HV_get()
-    m3r_centroid = vals['kphi']
+    m3r_cent = m3r_centroid()
 
     entry_list = ["x","y","z","tth","kth","kap","kphi","TA","TB","TEY","mesh","det_name","mpa_HV","m3r_centroid"]
     pv_list = [ x, y, z, tth, kth, kap,kphi, TA, TB,tey_current,mesh_current,det_name,mpa_HV,m3r_centroid]  
diff --git a/build/lib/iexcode/instruments/scanRecord.py b/build/lib/iexcode/instruments/scanRecord.py
index 4e553880611ef5f10d01abc5f804be3e04bb7001..3d58f0ea35ec70584dd99fb0416d0efa40a92aab 100644
--- a/build/lib/iexcode/instruments/scanRecord.py
+++ b/build/lib/iexcode/instruments/scanRecord.py
@@ -8,6 +8,7 @@ import iexcode.instruments.cfg as iex
 from iexcode.instruments.utilities import dateandtime, print_warning_message
 from iexcode.instruments.userCalcs import userStringSeq_pvs,userStringSeq_clear
 from iexcode.instruments.shutters import shutter_check
+from iexcode.instruments.Logfile import log_update
 
 def scan_fillin(VAL,RBV,start,stop,steps_points,**kwargs):
     """
@@ -53,6 +54,12 @@ def last_mda():
     except:
         print("IEX_endstations has not been initialized")
 
+def user_path():
+    """
+    returns to the user directory as found in the mda scanRecord
+    """
+    return iex.BL.mda.filepath()
+
 def saveData_get_all(ioc_pv):
     """
     returns saveData info: 
@@ -76,6 +83,8 @@ def saveData_get_all(ioc_pv):
         print(ioc_pv+"not connected")
         return {}
 
+
+
    
     
 ##############################################################################################################
@@ -773,7 +782,7 @@ class ScanRecord:
             scan_pv = self.ioc+"scan"+str(scan_dim)
             caput(scan_pv+".EXSC",1,wait=True,timeout=900000)  #pushes scan button
             if self.log != None:
-                self.log.update() # writes the log file
+                log_update() # writes the log file
             print(filename+str(fileNum)+" finished at ", dateandtime())
             print('\n')
             
diff --git a/build/lib/iexcode/instruments/xrays.py b/build/lib/iexcode/instruments/xrays.py
index 161b48fdd494a472b7dede31f8e732b1e538c692..561d76a2f06b0ae0038088edaf0617d5e030e849 100644
--- a/build/lib/iexcode/instruments/xrays.py
+++ b/build/lib/iexcode/instruments/xrays.py
@@ -161,8 +161,8 @@ def _xrays_log_entries(**kwargs):
     #beamline info
     ID_mode = ID_mode_get(verbose=False) if iex.BL.xrays else "no_xrays"
     ID_QP_ratio = ID_QP_ratio_get(verbose=False)[0] if iex.BL.xrays else "no_xrays"
-    ID_sp  = round(ID_SP_get_eV()) if iex.BL.xrays else 0
-    ID_rbv = round(ID_rbv_get_eV,4) if iex.BL.xrays else 0
+    ID_sp  = round(ID_get_sp_eV()) if iex.BL.xrays else 0
+    ID_rbv = round(ID_get_rbv_eV,4) if iex.BL.xrays else 0
     hv = mono_energy_get() if iex.BL.xrays else 0
     grt = mono_grating_get() if iex.BL.xrays else 0
     slit_size = slit_get()[0] if iex.BL.xrays else 0
@@ -226,7 +226,7 @@ def energy_get():
     hv = mono_energy_get()
     return hv
 
-def energy(hv_eV,slit_coeff=1,m3r=True,QP_ratio=100,verbose=True):
+def energy(hv_eV,slit_coeff=1,m3r=True,verbose=True):
     """
     sets the ID for optimal flux based on calibration
     sets the mono
@@ -243,7 +243,7 @@ def energy(hv_eV,slit_coeff=1,m3r=True,QP_ratio=100,verbose=True):
         print_warning_message(message_string)
 
 
-    ID_energy_set_eV(hv_eV,QP_ratio,verbose=verbose)
+    ID_energy_set_eV(hv_eV,verbose=verbose)
     mono_energy_set(hv_eV,verbose=verbose)
     apertures_set(c_2B=slit_coeff,c_1A=1,verbose=verbose)
 
@@ -340,20 +340,20 @@ def apertures_set(c_2B=1,c_1A=1,verbose=True):
     slit2B_set(Size2B[0],Size2B[1],center=(H2_center,V2_center),verbose=verbose)
 
 
-def mvID(val,QP_ratio=100):
+def mvID(val):
     """
     Sets the ID absolute set point (not optimized , mono & apertures stay fixed).
     
     to go to most flux use energy
     """
-    ID_SP_set(val,QP_ratio=100)
+    ID_set_eV(val)
 
-def mvID_calibrated(val,QP_ratio=100):
+def mvID_calibrated(val):
     """
     Sets the ID peak to val (calibrated).
 
     """
-    ID_energy_set(val,QP_ratio)
+    ID_energy_set_eV(val)
 
 
 def scan_ID(ID_sp_start,ID_sp_stop,ID_sp_step,**kwargs):
@@ -392,7 +392,7 @@ def grating(grating_name):
         shutter_open = main_shutter_status()
         main_shutter_close()
         print("Switching grating, please wait...")
-        mono_grating_change(grating_name,verbose=False)
+        mono_grating_set(grating_name,verbose=False)
         apertures_set()
 
         if shutter_open:
@@ -429,12 +429,7 @@ def scanmono(start,stop,step,average_pnts=1,**kwargs):
     """
     ca_average(average_pnts,ca_detector_list(iex.BL.branch))
 
-    mono_scan_fillin(iex.BL.mda,start,stop,step,**kwargs)
-
-    mono_energy_set(start)
-    iex.BL.mda.go(**kwargs)
-
-    mono_scan_after(iex.BL.mda)
+    mono_scan(start,stop,step,**kwargs)
 
 
 
@@ -472,7 +467,7 @@ def scanXAS(start_stop_step_lists,ID_eV=None,ID_tracking=False, **kwargs):
     #Setting up the ScanRecord for Mono and ID in Table mode
     mono_array,ID_array = BL_energy_tables(start_stop_step_lists,**kwargs)
     kwargs.update('positioner_num',1)
-    mono_scan_fillin_table(iex.BL.mda,scan_dim,mono_array,**kwargs)
+    mono_scan_table(iex.BL.mda,scan_dim,mono_array,execute=False)
     if ID_tracking == True:
         kwargs.update('positioner_num',2)
         ID_scan_fillin_table(iex.BL.mda,scan_dim,ID_array,**kwargs)
@@ -522,7 +517,7 @@ def BL_energy_tables(start_stop_step_lists,**kwargs):
     ID_array=np.array([])
     ID_mode,ID_QP_ratio,ID_sp,ID_rbv,hv,grt = energy_get_all(verbose=False)
     for hv_eV in mono_array:
-        ID_array=np.append(ID_array,ID_calc_SP(grt,ID_mode,hv_eV))
+        ID_array=np.append(ID_array,ID_calc_eV(grt,ID_mode,hv_eV))
     return mono_array,ID_array
 
 
@@ -531,7 +526,7 @@ def BL_energy_tables(start_stop_step_lists,**kwargs):
 ##############################################################################################################
 
 
-def switch_branch(branch, force=False, shutter=True,scan_reset=True,enable_cams=True):
+def switch_branch(branch, force=False, shutter=True,enable_cams=True):
     """Switch beam into which = \"c\" or \"d\" branch (by retracting/inserting deflecting mirror)
         Optionnal keyword argument:
             force: change m3r even if the beamline think it is already there (default=False)
@@ -568,13 +563,10 @@ def switch_branch(branch, force=False, shutter=True,scan_reset=True,enable_cams=
 
         # Open branch shutters:
             if shutter:
-                branch_shutter_open(branch,valve=False)
+                branch_shutter_open(branch)
 
-            if scan_reset:
-                iex.BL.mda.reset()
 
-            if enable_cams:
-                _enable_endstation_cameras(branch)
+            print("Need to intialize endstation")
 
     else:
         print_warning_message(branch+' is not a valid branch selection')
@@ -599,7 +591,7 @@ def slit(size,verbose=True):
         Kappa  = 0 < x < 1000 um
     """
     branch = iex.BL.branch
-    exit_slit(branch,size,verbose=verbose)
+    exit_slit_set(branch,size,verbose=verbose)
 
 
 def slit_get(verbose=True):
@@ -609,7 +601,8 @@ def slit_get(verbose=True):
         ARPES = 0 < x < 300  um
         Kappa  = 0 < x < 1000 um
     """
-    exit_slit_get(branch,verbose=verbose)
+    branch = iex.BL.branch
+    slit_size,slit_center = exit_slit_get(branch,verbose=verbose)
     return slit_size,slit_center
 
 
diff --git a/iexcode/cheatsheet.txt b/iexcode/cheatsheet.txt
index 6a0b6230b3d5bb01d8a347b3e2a80a741f37dc9d..df37e4aaea4f87beec4a2661a8aed05fd0142260 100644
--- a/iexcode/cheatsheet.txt
+++ b/iexcode/cheatsheet.txt
@@ -112,8 +112,11 @@ ID_power_status => returns off/on
 ID_start => turns on the ID in a given mode
 ID_switch_mode => changes the ID mode
 ID_get/set => gets rbv / sets val in keV
-ID_energy_set => set calibrated energy in eV
-ID_rbv_get
+ID_get/set_eV => gets rbv / sets val in eV, uses keV pvs, just does math
+ID_energy_set => set calibrated energy in keV
+ID_energy_set_eV => set calibrated energy in keV, just does math
+ID_get_rbv/_eV => get the read back value in keV/eV (same as ID_get)
+ID_get_sp/_eV => get the read back value in keV/eV
 
 
 #kappa_angle_calcs:
diff --git a/iexcode/instruments/ARPES.py b/iexcode/instruments/ARPES.py
index 145759505fa8998c367daf2d8ce6b424e8bc2c96..d156ced2d40c89bd1eb701f076106987e8ed1b9a 100644
--- a/iexcode/instruments/ARPES.py
+++ b/iexcode/instruments/ARPES.py
@@ -1,4 +1,5 @@
 import os
+from re import A
 from time import sleep
 import numpy as np
 from epics import caget,caput,PV
@@ -71,9 +72,11 @@ def ARPES_init(*userName,**kwargs):
                 user_name = userName[0]
         print(user_name)
         folders_ARPES(user_name,**kwargs)
+    else:
+        user_name = iex.BL.mda.user_name()
 
-        #update for default scanRecord advanced parameters
-        iex.BL.mda.log=Logfile('ARPES',user_name,_ARPES_log_header(),_ARPES_log_entries)
+    #update for default scanRecord advanced parameters
+    iex.BL.mda.log=Logfile('ARPES',user_name,_ARPES_log_dictionary)
 
     #EA
     if EA.connected: 
@@ -81,7 +84,7 @@ def ARPES_init(*userName,**kwargs):
         EA.get()
         _EA_init_Motors(ARPES_Motors)
         if kwargs['set_folders']:
-            userPath = os.path.dirname(iex.BL.mda.filepath)
+            userPath = os.path.dirname(iex.BL.mda.filepath())
             folders_EA(userPath,filePrefix="EA",**kwargs)
         
     else:
@@ -306,29 +309,26 @@ def _ARPES_log_header():
         }
     return header_list
 
-def _ARPES_log_entries():
+def _ARPES_log_dictionary():
     """
     endstation info for log file
 
     Previously: scanlog
     """
-    vals = ARPES_get_all(verbose=False)
-    x = vals['x']
-    y = vals['y']
-    z = vals['z']
-    th = vals['th']
-    chi = chi['chi']
-    phi = vals['phi']
-    TA = vals['TA']
-    TB = vals['TB']
-    tey1 = vals['tey1']
-    tey2 = vals['tey2']
-
-    entry_list = ["x","y","z","th","chi","phi","TA","TB","tey1","tey2"]
-    pv_list = [ x, y, z, th, chi, phi, TA, TB, tey1,tey2]  
-    format_list = [".2f",".2f",".2f",".2f",".2f",".2f",".2f",".2f","1.2e","1.2e"]
-
-    return entry_list,pv_list,format_list
+    d={
+        "x":(ARPES_Motors.get('x'),".2f"),
+        "y":(ARPES_Motors.get('y'),".2f"),
+        "z":(ARPES_Motors.get('z'),".2f"),
+        "th":(ARPES_Motors.get('thi'),".2f"),
+        "chi":(ARPES_Motors.get('chi'),".2f"),
+        "phi":(ARPES_Motors.get('phi'),".2f"),
+        "TA":(caget(ARPES_extra_pvs()['TA']),".2f"),
+        "TB":(caget(ARPES_extra_pvs()['TB']),".2f"),
+        "tey1":(caget(ARPES_extra_pvs()['tey1']),"1.2e"),
+        "tey2":(caget(ARPES_extra_pvs()['tey2']),"1.2e")
+        }
+
+    return d
 
 ##############################################################################################################
 ##############################             ARPES scanRecord           ##############################
diff --git a/iexcode/instruments/IEX_VPU.py b/iexcode/instruments/IEX_VPU.py
index e23ccef3470e5e2a9283ec41791640872cbcf49a..20d0c8957ab48b763aa7462537f42a8513afe0ed 100644
--- a/iexcode/instruments/IEX_VPU.py
+++ b/iexcode/instruments/IEX_VPU.py
@@ -92,8 +92,8 @@ def ID_get_all(verbose=False):
     vals={    
         "ID_mode":ID_mode_get(verbose=False),
         "ID_QP_ratio":ID_QP_ratio_get(verbose=False),
-        "ID_sp":caget(ID_pvs()['energy_sp']),
-        "ID_rbv":ID_get_eV(verbose=False)
+        "ID_sp":ID_get_sp(verbose=False),
+        "ID_rbv":ID_get_rbv_eV(verbose=False)
     }
 
     if verbose:
@@ -219,6 +219,8 @@ def ID_off(verbose=True):
     waits for permission then turns on the main coils OFF    
     """
     ID_wait_for_permission(verbose=False)
+    ID_ready()
+
     caput(ID_pvs()['main_power'],'Off',wait=True,timeout=18000)
     sleep(5)
     if verbose:
@@ -280,22 +282,35 @@ def ID_switch_mode(ID_mode):
         ID_ready()
 
         print("Switching ID mode, please wait...")
-        ID_mode_set(ID_mode) 
         ID_on(verbose=True)
+        ID_mode_set(ID_mode) 
         ID_ready()
-    print("ID Mode:",ID_mode_get())
+    
+    if ID_mode_get() != ID_mode:
+            print_warning_message("ID mode switch had an error, please try again")
+    else:
+        print("ID Mode:",ID_mode_get())
 
 
 def ID_get(verbose=False):
     """
-    returns the readback value for the 
+    returns the readback value for the ID in keV
     """
     ID_RBV = caget(ID_pvs()['energy_rbv'])
     if verbose:
         print("ID_RBV: ", ID_RBV)
     return ID_RBV  
 
-def ID_get_eV(verbose=False):
+def ID_get_sp(verbose=False):
+    """
+    returns the readback value for the ID in keV
+    """
+    ID_SP = caget(ID_pvs()['energy_sp'])
+    if verbose:
+        print("ID_SP: ", ID_SP)
+    return ID_SP  
+
+def ID_get_rbv_eV(verbose=False):
     """
     returns the readback value for the 
     """
@@ -304,6 +319,15 @@ def ID_get_eV(verbose=False):
         print("ID_RBV: ", ID_RBV)
     return ID_RBV 
 
+def ID_get_sp_eV(verbose=False):
+    """
+    returns the setpoint value for the ID in eV
+    """
+    ID_SP = ID_get_sp(verbose=False)*1000
+    if verbose:
+        print("ID_SP: ", ID_SP)
+    return ID_SP 
+
 def _ID_write_SP_proc(keV):
     # pressing ramp button doesn't work
     # ramp_delay=5
@@ -315,7 +339,7 @@ def _ID_write_SP_proc(keV):
 
 
 def _ID_bw_ok(keV):
-    ID_SP = caget(ID_pvs()['energy_sp'])
+    ID_SP = ID_get_sp(verbose=False)
     ID_bw = ID_SP * 0.095
     ID_diff = abs(ID_get()-keV)
     if ID_diff > ID_bw:
@@ -331,7 +355,7 @@ def ID_set(keV,verbose=True):
     """
     
     #check if I'm already there
-    ID_SP = round(caget(ID_pvs()['energy_sp']),3)
+    ID_SP = round(ID_get_sp(verbose=False),3)
     if round(keV,3) == ID_SP:
         if verbose:
             print("ID already at "+str(ID_SP))
@@ -358,7 +382,7 @@ def ID_set(keV,verbose=True):
             #check if ID within some bandwidth
             if _ID_bw_ok(keV):
                 if verbose:
-                    ID_SP = caget(ID_pvs()['energy_sp'])
+                    ID_SP = ID_get_sp(verbose=False)
                     ID_RBV = ID_get()
                     print("ID SET : "+"%.1f" % ID_SP, "eV")
                     print("ID RBV : "+"%.1f" % ID_RBV, "eV")
@@ -366,9 +390,8 @@ def ID_set(keV,verbose=True):
             else:
                 print_warning_message("ID not within energy bandwidth")
                 ID_QP_ratio_get(verbose)
- 
 
-def ID_energy_set_eV(hv_eV,QP_ratio=None,verbose=True):
+def ID_energy_set(keV,verbose=True):
     """
     Sets optimum ID set point for hv(eV) (max intensity)
     and opens the main shutter
@@ -379,8 +402,30 @@ def ID_energy_set_eV(hv_eV,QP_ratio=None,verbose=True):
     """
     ID_mode = ID_mode_list()[ID_state_get()]
     mono_grating = mono_grating_get()
-    keV = ID_calc_eV(mono_grating,ID_mode,hv_eV,QP_ratio)/1000.0
-    ID_set(keV)
+    QP_ratio = ID_QP_ratio_get()[0]
+    eV = keV/1000.0
+    keV = ID_calc_eV(mono_grating,ID_mode,eV,QP_ratio)/1000.0
+    ID_set(keV,verbose=verbose) 
+
+def ID_energy_set_eV(eV,verbose=True):
+    """
+    Sets optimum ID set point for hv(eV) (max intensity)
+    and opens the main shutter
+
+    Note that QP is generally not calibrated
+
+    Previously: SetID
+    """
+    keV = eV/1000.0
+    ID_energy_set(keV,verbose=verbose)
+
+def ID_set_eV(eV,verbose=True):
+    """
+    Set the ID setpoint
+    """
+    keV=eV/1000.0
+    ID_set(keV,verbose=verbose)
+
 
     
 def ID_QP_ratio_get(verbose=True):
@@ -418,7 +463,7 @@ def ID_QP_mode_set(QP_ratio=None,verbose=True):
     if QP_ratio < QP_min:
         message_string="QP ratio is too small, setting it to minimum allowed value ("+str(QP_min)+")"
         print_warning_message(message_string)
-    QP_ratio=max(70,QP_ratio)
+    QP_ratio=min(100,max(70,QP_ratio))
 
     if QP_ratio != None:
         #checking to see if already in specified QP
@@ -443,9 +488,6 @@ def ID_coef(grt,ID_state,hv_eV,QP_ratio):    # Mode = state (0=RCP,1=LCP,2=V,3=H
     Previously: ID_Coef
     """
 
-    if QP_ratio == None:
-        QP_ratio = ID_QP_ratio_get()[0]
-
     def ListRange(grt,ID_state,IDdict):  # extract the list of break pts for a given mode/grt 
         tmp_list=[]
         for item in (IDdict[grt][ID_state]):
@@ -460,9 +502,7 @@ def ID_coef(grt,ID_state,hv_eV,QP_ratio):    # Mode = state (0=RCP,1=LCP,2=V,3=H
         #print(index)
         return(index[0])
 
-   
-    
-    if QP_ratio < 100:
+    if QP_ratio < 100.0:
         if isinstance(QP_ratio,float) or isinstance(QP_ratio,int): 
             QP_ratio=str(floor(QP_ratio))
             dictfile='Dict_IDCal_QP'+QP_ratio+'.txt'
diff --git a/iexcode/instruments/Kappa.py b/iexcode/instruments/Kappa.py
index 175c368d499e4c0dd60ed246f61772d669ed0385..7c3ca56b35d1da10ea0fe0ee6c2ff2be5cb6e77a 100644
--- a/iexcode/instruments/Kappa.py
+++ b/iexcode/instruments/Kappa.py
@@ -20,6 +20,7 @@ from iexcode.instruments.userCalcs import userStringSeq_clear, userStringSeq_pvs
 
 from iexcode.instruments.Motors import Motors
 from iexcode.instruments.current_amplifiers import Keithley, _Keithley_pv, ca_reset_all, _ca_live_sequence
+from iexcode.instruments.current_amplifiers import SRS
 
 from iexcode.instruments.valves import branch_valve_close
 from iexcode.instruments.shutters import branch_shutter_close
@@ -397,7 +398,7 @@ def _kappa_log_entries():
     mesh_current = mesh.current_Amp
     det_name = tthdet.name
     mpa_HV = iex.mpa.HV_get()
-    m3r_centroid = vals['kphi']
+    m3r_cent = m3r_centroid()
 
     entry_list = ["x","y","z","tth","kth","kap","kphi","TA","TB","TEY","mesh","det_name","mpa_HV","m3r_centroid"]
     pv_list = [ x, y, z, tth, kth, kap,kphi, TA, TB,tey_current,mesh_current,det_name,mpa_HV,m3r_centroid]  
diff --git a/iexcode/instruments/Logfile.py b/iexcode/instruments/Logfile.py
index 7a0093af7134ea57c26f493119e138ad11b3f9e9..4d5b60e665cee7c1d944829d5c135461ea42b3e4 100644
--- a/iexcode/instruments/Logfile.py
+++ b/iexcode/instruments/Logfile.py
@@ -6,7 +6,7 @@ from iexcode.instruments.utilities import today
 import iexcode.instruments.cfg as iex
 
 ## To do: make this work if User Folder doesn't already exist
-
+file_path = '/home/beams22/29IDUSER/Documents/User_Folders'
 
 ##############################################################################################################
 ##############################             logging           ##############################
@@ -25,7 +25,7 @@ def log_update():
     updates the log file with the last scan info
     """
     try:
-        entry_list,pv_list, format_list = iex.BLlog.entries_function()
+        entry_list,pv_list, format_list = iex.BL.log.entries_function()
         iex.BL.mda.log.update(entry_list,pv_list,format_list)
     except:
         print('No logfile written')
@@ -40,7 +40,7 @@ def log_name_set(file_name):
 ##############################            general   logfile functions          ##############################
 ##############################################################################################################
 class Logfile:
-    def __init__(self,endstation_name,user_name,headerlist,entries_function):
+    def __init__(self,endstation_name,user_name,log_dictionary):
         """
         endstation: used for filename pv ('ARPES' / 'Kappa' / 'Octupole' / 'Test') 
         user_name: used for filepath
@@ -51,8 +51,7 @@ class Logfile:
         self.pv = self._name_pv()
         self.userName = user_name
         self.filepath = self._fpath()
-        self.headerlist = headerlist
-        self.entries_function = entries_function
+        self.log_dictionary = log_dictionary
 
         self.name_set()
 
@@ -94,7 +93,7 @@ class Logfile:
         try:
             caput(self._name_pv(),filename)
             print("\nLog filename = \'"+filename+"\' @ "+self._name_pv())
-            print('To change filename, use logname_set(endstation_name,new_name)')
+            print('To change filename, use log_name_set(new_name)')
         except:
             print("Error: was not able to set the filename, check that 29idb ioc is running")
 
@@ -115,10 +114,10 @@ class Logfile:
 
         Previously: logname, logname_generate
         """
+        user_folder = join(file_path,self.userName)
         try: 
             filename = self.name_get()
-            user_name = self.userName
-            fpath_with_subfolder = join(user_name,filename)
+            fpath_with_subfolder = join(user_folder,filename)
         except:
             fpath_with_subfolder = "logfile.txt"
             self.name_get()
@@ -147,6 +146,22 @@ class Logfile:
             print("Logprint failed")
 
 
+    def _log_entries(self):
+        """
+        gets the meta data to write in the log file
+        """
+        d = self.log_dictionary()
+        entry_list = []
+        pv_list = []  
+        format_list = []
+        for key in d.keys():
+            val = d[key]
+            entry_list.append(key)
+            pv_list.append(val[0])
+            format_list.append(val[1])
+        return entry_list,pv_list,format_list
+
+    
     def write_header(self): 
         """
         file path = path to where file_name lives
@@ -160,20 +175,24 @@ class Logfile:
         with open(self.filepath, "w+") as f:
             f.write('@Log version: '+ version+'\n\n')
             f.write('FilePath '+self.endstation_name+': '+self.filepath+'\n')
+            
+            header_list,pv_list,format_list = self._log_entries()
 
-            for key in self.headerlist.keys():
-                f.write(key+' Header:  '+ self.headerlist[key]+'\n\n')
-
+            entry = self.endstation_name+' Header:  '
+            for item in header_list:
+                entry+=item
+            f.write(entry +'\n\n')
+    
 
    
-    def update(self,entry_list,pv_list,format_list):
+    def update(self):
         """ 
         To be used for scanlog and scanEA functions.
         Update SaveFile_Header version number when changing the structure of the file (indexing).
 
         Previously: SaveFile
         """
-        #entry_list is the human readable portion
+        header_list,pv_list,format_list = self._log_entries()
         
         if not isfile(self.filepath):
             self.write_header()
diff --git a/iexcode/instruments/Octupole.py b/iexcode/instruments/Octupole.py
index b0f473370ecf70cb6d6caa512af60654c6330881..c2c8f805797eac69525d34ff68a3e4ff44375a2f 100644
--- a/iexcode/instruments/Octupole.py
+++ b/iexcode/instruments/Octupole.py
@@ -19,14 +19,14 @@ from iexcode.instruments.utilities import *
 from iexcode.instruments.userCalcs import userStringSeq_clear, userStringSeq_pvs
 
 from iexcode.instruments.Motors import Motors
-from iexcode.instruments.current_amplifiers import *
+from iexcode.instruments.current_amplifiers import Keithley, _Keithley_pv, ca_reset_all, _ca_live_sequence,SRS
 
 from iexcode.instruments.valves import branch_valve_close
 from iexcode.instruments.shutters import branch_shutter_close
 
 #branch specific
 from iexcode.instruments.slits import slit3D_get
-
+from iexcode.instruments.m3r import m3r_centroid
 #endstation specific
 from iexcode.instruments.scalers import scaler_cts,Scaler
 from iexcode.instruments.spec_stuff import folders_spec
@@ -74,9 +74,9 @@ def Octupole_init(*userName,**kwargs):
                 user_name = userName[0]
         print(user_name)
         folders_Octupole(user_name,**kwargs)
-
-        #update for default scanRecord advanced parameters
-        iex.BL.mda.log('Octupole',user_name,_Octupole_log_header(),_Octupole_log_entries)
+    
+    #update for default scanRecord advanced parameters
+    iex.BL.mda.log('Octupole',user_name,_Octupole_dictionary)
 
     #global detectors
     mesh = SRS("29ide:scaler1.S2", '29idd:A4')
@@ -319,33 +319,27 @@ def _Octupole_log_header():
     header_list = {'Octupole':h}
     return header_list 
 
-def _Octupole_log_entries():
+def _Octupole_dictionary():
     """
     enstation info for log file
 
     Previously: scanlog
     """
-    vals = Octupole_get_all(verbose=False)
-    x = vals['x']
-    y = vals['y']
-    z = vals['z']
-    th = vals['th']
-    tth = vals['tth']
-  
-
-    TA = vals['TA']
-    mesh.get()
-    tey_current = tey.current
-    mesh_current = mesh.current
-
+    
     #m3r_centroid = vals['kphi'] ????
-
-    entry_list = ["x","y","z","tth","kth","kap","kphi","TA","TB","TEY","mesh","det_name","mpa_HV","m3r_centroid"]
-    pv_list = [ x, y, z, tth, kth, kap,kphi, TA, TB,tey_current,mesh_current,det_name,mpa_HV,m3r_centroid]  
-    format_list = [".2f",".2f",".2f",".2f",".2f",".2f",".2f",".2f",".2f","1.2e","1.2e","s",".0f",".0f"]
-
-    return entry_list,pv_list,format_list
-
+    #header: pv, format
+    d={
+        "x":(Octupole_Motors.get('x'),".2f"),
+        "y":(Octupole_Motors.get('y'),".2f"),
+        "z":(Octupole_Motors.get('z'),".2f"),
+        "th":(Octupole_Motors.get('th'),".2f"),
+        "tth":(Octupole_Motors.get('tth'),".2f"),
+        "TA":(caget(Octupole_extra_pvs()['TA']),".2f"),
+        "tey_current":(tey.current,".2f"),
+        "mesh_current":(mesh.current,".2f"),
+        "m3r_centroid":(m3r_centroid(),".0f") , 
+    }
+    return d
 ##############################################################################################################
 ##############################             Octupole scanRecord           ##############################
 ##############################################################################################################
@@ -453,7 +447,7 @@ def _Octupole_detector_triggers_sequence(**kwargs):    # do we need to add 29idb
     last = len(ca_list)
     if last !=0:
         for i,ca in enumerate(ca_list):
-            ca_pv = Keithley_pv(ca[0], ca[1])+':read.PROC CA NMS'
+            ca_pv = _Keithley_pv(ca[0], ca[1])+':read.PROC CA NMS'
             caput(detector_triggers_pv+".LNK" +str(i+2),ca_pv)
             caput(detector_triggers_pv+".WAIT"+str(i+2),"After"+str(last))
 
diff --git a/iexcode/instruments/scanRecord.py b/iexcode/instruments/scanRecord.py
index 4e553880611ef5f10d01abc5f804be3e04bb7001..3d58f0ea35ec70584dd99fb0416d0efa40a92aab 100644
--- a/iexcode/instruments/scanRecord.py
+++ b/iexcode/instruments/scanRecord.py
@@ -8,6 +8,7 @@ import iexcode.instruments.cfg as iex
 from iexcode.instruments.utilities import dateandtime, print_warning_message
 from iexcode.instruments.userCalcs import userStringSeq_pvs,userStringSeq_clear
 from iexcode.instruments.shutters import shutter_check
+from iexcode.instruments.Logfile import log_update
 
 def scan_fillin(VAL,RBV,start,stop,steps_points,**kwargs):
     """
@@ -53,6 +54,12 @@ def last_mda():
     except:
         print("IEX_endstations has not been initialized")
 
+def user_path():
+    """
+    returns to the user directory as found in the mda scanRecord
+    """
+    return iex.BL.mda.filepath()
+
 def saveData_get_all(ioc_pv):
     """
     returns saveData info: 
@@ -76,6 +83,8 @@ def saveData_get_all(ioc_pv):
         print(ioc_pv+"not connected")
         return {}
 
+
+
    
     
 ##############################################################################################################
@@ -773,7 +782,7 @@ class ScanRecord:
             scan_pv = self.ioc+"scan"+str(scan_dim)
             caput(scan_pv+".EXSC",1,wait=True,timeout=900000)  #pushes scan button
             if self.log != None:
-                self.log.update() # writes the log file
+                log_update() # writes the log file
             print(filename+str(fileNum)+" finished at ", dateandtime())
             print('\n')
             
diff --git a/iexcode/instruments/xrays.py b/iexcode/instruments/xrays.py
index 161b48fdd494a472b7dede31f8e732b1e538c692..561d76a2f06b0ae0038088edaf0617d5e030e849 100644
--- a/iexcode/instruments/xrays.py
+++ b/iexcode/instruments/xrays.py
@@ -161,8 +161,8 @@ def _xrays_log_entries(**kwargs):
     #beamline info
     ID_mode = ID_mode_get(verbose=False) if iex.BL.xrays else "no_xrays"
     ID_QP_ratio = ID_QP_ratio_get(verbose=False)[0] if iex.BL.xrays else "no_xrays"
-    ID_sp  = round(ID_SP_get_eV()) if iex.BL.xrays else 0
-    ID_rbv = round(ID_rbv_get_eV,4) if iex.BL.xrays else 0
+    ID_sp  = round(ID_get_sp_eV()) if iex.BL.xrays else 0
+    ID_rbv = round(ID_get_rbv_eV,4) if iex.BL.xrays else 0
     hv = mono_energy_get() if iex.BL.xrays else 0
     grt = mono_grating_get() if iex.BL.xrays else 0
     slit_size = slit_get()[0] if iex.BL.xrays else 0
@@ -226,7 +226,7 @@ def energy_get():
     hv = mono_energy_get()
     return hv
 
-def energy(hv_eV,slit_coeff=1,m3r=True,QP_ratio=100,verbose=True):
+def energy(hv_eV,slit_coeff=1,m3r=True,verbose=True):
     """
     sets the ID for optimal flux based on calibration
     sets the mono
@@ -243,7 +243,7 @@ def energy(hv_eV,slit_coeff=1,m3r=True,QP_ratio=100,verbose=True):
         print_warning_message(message_string)
 
 
-    ID_energy_set_eV(hv_eV,QP_ratio,verbose=verbose)
+    ID_energy_set_eV(hv_eV,verbose=verbose)
     mono_energy_set(hv_eV,verbose=verbose)
     apertures_set(c_2B=slit_coeff,c_1A=1,verbose=verbose)
 
@@ -340,20 +340,20 @@ def apertures_set(c_2B=1,c_1A=1,verbose=True):
     slit2B_set(Size2B[0],Size2B[1],center=(H2_center,V2_center),verbose=verbose)
 
 
-def mvID(val,QP_ratio=100):
+def mvID(val):
     """
     Sets the ID absolute set point (not optimized , mono & apertures stay fixed).
     
     to go to most flux use energy
     """
-    ID_SP_set(val,QP_ratio=100)
+    ID_set_eV(val)
 
-def mvID_calibrated(val,QP_ratio=100):
+def mvID_calibrated(val):
     """
     Sets the ID peak to val (calibrated).
 
     """
-    ID_energy_set(val,QP_ratio)
+    ID_energy_set_eV(val)
 
 
 def scan_ID(ID_sp_start,ID_sp_stop,ID_sp_step,**kwargs):
@@ -392,7 +392,7 @@ def grating(grating_name):
         shutter_open = main_shutter_status()
         main_shutter_close()
         print("Switching grating, please wait...")
-        mono_grating_change(grating_name,verbose=False)
+        mono_grating_set(grating_name,verbose=False)
         apertures_set()
 
         if shutter_open:
@@ -429,12 +429,7 @@ def scanmono(start,stop,step,average_pnts=1,**kwargs):
     """
     ca_average(average_pnts,ca_detector_list(iex.BL.branch))
 
-    mono_scan_fillin(iex.BL.mda,start,stop,step,**kwargs)
-
-    mono_energy_set(start)
-    iex.BL.mda.go(**kwargs)
-
-    mono_scan_after(iex.BL.mda)
+    mono_scan(start,stop,step,**kwargs)
 
 
 
@@ -472,7 +467,7 @@ def scanXAS(start_stop_step_lists,ID_eV=None,ID_tracking=False, **kwargs):
     #Setting up the ScanRecord for Mono and ID in Table mode
     mono_array,ID_array = BL_energy_tables(start_stop_step_lists,**kwargs)
     kwargs.update('positioner_num',1)
-    mono_scan_fillin_table(iex.BL.mda,scan_dim,mono_array,**kwargs)
+    mono_scan_table(iex.BL.mda,scan_dim,mono_array,execute=False)
     if ID_tracking == True:
         kwargs.update('positioner_num',2)
         ID_scan_fillin_table(iex.BL.mda,scan_dim,ID_array,**kwargs)
@@ -522,7 +517,7 @@ def BL_energy_tables(start_stop_step_lists,**kwargs):
     ID_array=np.array([])
     ID_mode,ID_QP_ratio,ID_sp,ID_rbv,hv,grt = energy_get_all(verbose=False)
     for hv_eV in mono_array:
-        ID_array=np.append(ID_array,ID_calc_SP(grt,ID_mode,hv_eV))
+        ID_array=np.append(ID_array,ID_calc_eV(grt,ID_mode,hv_eV))
     return mono_array,ID_array
 
 
@@ -531,7 +526,7 @@ def BL_energy_tables(start_stop_step_lists,**kwargs):
 ##############################################################################################################
 
 
-def switch_branch(branch, force=False, shutter=True,scan_reset=True,enable_cams=True):
+def switch_branch(branch, force=False, shutter=True,enable_cams=True):
     """Switch beam into which = \"c\" or \"d\" branch (by retracting/inserting deflecting mirror)
         Optionnal keyword argument:
             force: change m3r even if the beamline think it is already there (default=False)
@@ -568,13 +563,10 @@ def switch_branch(branch, force=False, shutter=True,scan_reset=True,enable_cams=
 
         # Open branch shutters:
             if shutter:
-                branch_shutter_open(branch,valve=False)
+                branch_shutter_open(branch)
 
-            if scan_reset:
-                iex.BL.mda.reset()
 
-            if enable_cams:
-                _enable_endstation_cameras(branch)
+            print("Need to intialize endstation")
 
     else:
         print_warning_message(branch+' is not a valid branch selection')
@@ -599,7 +591,7 @@ def slit(size,verbose=True):
         Kappa  = 0 < x < 1000 um
     """
     branch = iex.BL.branch
-    exit_slit(branch,size,verbose=verbose)
+    exit_slit_set(branch,size,verbose=verbose)
 
 
 def slit_get(verbose=True):
@@ -609,7 +601,8 @@ def slit_get(verbose=True):
         ARPES = 0 < x < 300  um
         Kappa  = 0 < x < 1000 um
     """
-    exit_slit_get(branch,verbose=verbose)
+    branch = iex.BL.branch
+    slit_size,slit_center = exit_slit_get(branch,verbose=verbose)
     return slit_size,slit_center