diff --git a/iexcode/APRES_cheatsheet.md b/iexcode/APRES_cheatsheet.md
index d7075b3044a97168218390d481084f11c9ae587c..44c816b7df0c7edc2dfcaf2c0aac43636b10b78c 100644
--- a/iexcode/APRES_cheatsheet.md
+++ b/iexcode/APRES_cheatsheet.md
@@ -67,13 +67,17 @@
     scanEA_y(EAlist,y_start,y_stop,y_step)  #takes spectra along y
     scanEA_z(EAlist,z_start,z_stop,z_step)  #takes spectra along z
     scanEA_map_sample(EAlist,y_list,z_list) #takes spectra in 2D y,z scan
-    -------------------------------------------------------------
-    hv2kz(lattice,V0,hv)            
-    kz2hv(lattice,V0,n)
-    kx2deg(kx,hv)
-    deg2kx(th,hv)
-    -------------------------------------------------------------
+
+### ***Resolution***
     resolution_EA(PE,slit_SES)      #returns EA contribution to resolution
+    resolution()                    #returns the resolution for the current beamline and analyzer parameters
+
+### **Conversions**
+    hv2kz(lattice,V0,hv)            #converts photon energy to kz       
+    kz2hv(lattice,V0,n)             #converst kz to photon energy
+    kx2deg(kx,hv)                   #converts in-plane momentum to degrees
+    deg2kx(th,hv)                   #conversts degrees to in-plane momentum
+
 ### **Current Amplifiers**
     tey.get()                       #get the current setting for the Keithley current amplifer
     tey.autoscale(On_Off)           #turns on/off autoscaling
diff --git a/iexcode/Octupole_cheatsheet.md b/iexcode/Octupole_cheatsheet.md
index 55a3b1e3aae27658b9c29c3c5b44089b3bd48f29..d089d83c4a86c2eacbe0d5a2e30db59eec844c24 100644
--- a/iexcode/Octupole_cheatsheet.md
+++ b/iexcode/Octupole_cheatsheet.md
@@ -29,4 +29,6 @@
 
 ### **Octupole Endstation**
     Octupole_get_all()
-    Octupole_safe_state()
\ No newline at end of file
+    Octupole_safe_state()
+
+    
\ No newline at end of file
diff --git a/iexcode/cheatsheet.txt b/iexcode/cheatsheet.txt
deleted file mode 100644
index 59a4a8875504dee244619d10b612f5209db6e82a..0000000000000000000000000000000000000000
--- a/iexcode/cheatsheet.txt
+++ /dev/null
@@ -1,305 +0,0 @@
-import iexcode.instruments.cfg as iex
-
-#ARPES: ARPES specific functions
-
-#AD_untilites: functions for common area detector operations
-
-#bakeout: functions for monitoring a bakeout
-
-#cameras: used for taking images from epics
-cam_snap => takes a single image
-cam_scan_setup => configures the scanRecord to take an image at each polarization
-cam_live => puts the camera back in live/free-run mode
-cam_done => turns off acquisition
-
-#cfg: config file which holds global variable BL and MPA
-usage => import iexcode.instruments.cfg as iex
-
-#converstions_constants: 
-h => Planck's constant (eV/s)
-c => speed of light (m/s)
-deg2rad => converts degree to radian
-rad2deg => converts radian to degrees
-eV2Lambda => converts eV to Angstroms
-Lambda2eV => converts Angstroms to eV
-
-#current_amplifiers:
-Keithley => class for Keithley current amplifiers
-ca_detector_list => list of detectors which are used in a given branch ('b for beamline)
-ca_average => turns on averaging for all Keithleys in ca_list
-ca_reset_all => resets all Keithleys in all branches
-SRS => class for SRS current amplifiers
-.get
-.setgain
-current2flux => calculates the flux based on the current reading in an AUX100 photodiode
-flux2current => calculates the current reading for a given flux for and AUX100 photodiode
-
-#diagnostics: bemaline diagnostics
-diagnostic_name_list => prints the name of all the diagnostics_all_in
-diagnostic => moves the specified diagnostic in/out
-diagnostics_all_out => moves all beamline diagnostics out
-diagnostics_all_in => moves all beamline diagnostics in; Note that they can shadow/block downstream diagnostics 
-mesh_W => moves W-mesh in the A-hutch in/out
-diode_c => moves diode in c-branch in/out
-diode_c_read => reads the current amplifier for the c-branch diode
-diode_d => moves diode in c-branch in/out; located just before the kappa endstation
-mesh_d => moves mesh in d-branch in/out; used for normalization
-mesh_d_read => reads the current amplifier for the d-branch mesh
-
-diagnostics_preset_list => returns the dictionary with all preset positions
-diagnostics_presets_go => goes to preset value
-
-
-#electron_analyzer: beamline specific calls to Scienta
-EA => electron analyzer class
-EA_ioc_init => initializes the ioc after a reboot (eventually goes in AutoSave)
-folders_EA => sets the folder for the Scienta spectra saving (called by Folders_ARPES)
-SES_slit_get => gets the analyzer slit number
-SES_slit_set => sets the analyzer slit to the given value
-scanEA => takes a spectra
-scanFM => takes a Fermi map
-mvth_interp => moves to an interpolated theta value
-scanEA_hv => takes a spectra at each photon energy
-scanEA_motor => takes a spectra at each motor point 
-resolution_EA => get the analyzer contribution to the resolution
-
-#encoder: beamline absolute encoders
-encoder_name_list => lists names in encoder dictionary
-encoder_sync => syncs all the encoders associated with name
-encoders_slit2B_reset_zero => resets the center for the slit2B encoder
-
-#files_and_folders: general scripts for dealing with files and directories
-path_dserv => path to user data directory on the dserve
-check_run => returns the current run based on todays date
-make_ftp => creates the folders on the ftp server, kip
-make_user_folders => creates all the appropriate user folders
-folder_mda => creates/set the user folder for the scanRecord
-folder_SPEC
-get_last_fileNumber => gets the last file number in the directory
-
-FMB_mirrors: functions for M0,M1,M3R
-FMB_mirror_get => get the current position of all axes for a given mirror
-FMB_mirror_move => moves the specified axis ('Tx','Ty','Tz','Rx','Ry','Rz') for the given mirror
-FMB_mirror_move_all => moves all the axes to the positions specified in position_list
-FMB_mirror_tweak => relative moves
-FMB_mirror_scan => scan a mirror axis
-M0M1_Table => reads the dictionary file to get the previous mirror positions
-M0M1_SP => writes the values form M0M1_Table to the set points (still need to push move)
-
-#hxp_mirrors: Newport hexapods
-hxp_sync => syncs the motor setpoint and readback values for a given mirror
-hxp_get => gets a mirror position
-hxp_get_all => gets all the mirror positions
-
-
-#IEX_BL_config: used to access current beamline configuration, based on instance initialization not pv
-Beamline_Config => class to carry all configuration info gets stored in iexcode\instruments\cft BL
-BL_ioc => returns the scan ioc
-BL_branch => returns the branch (shutter not mirror position)
-BL_mode => returns the current mode (user/staff)
-BL_mda_prefix => return prefix for mda scanRecord
-BL_mda_filepath => returns the file path in mda scanRecord
-get_all => gets relavent pv values
-
-#IEX_VPU: undulator functions
-ID_calc_SP => calculate the set point for maximum flux
-ID_wait_for_permission => waits for security access 
-ID_get_all => gets ID_mode, ID_QP_ratio, ID_sp, ID_rbv
-ID_energy_range => return max/min for a given mode
-ID_ready => looks at the two busy records
-ID_off/on => turns off/on the ID 
-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_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:
-fourc2kappa => converts between four-circle angles and kappa angles
-kappa2fourc => converts between kappa dn four-circle angles
-
-#kappa_det: defines kappa tth detector class and other functions
-Kappa_Detector => for detset etc in kappa chamber
-
-#kappa: kappa specific functions
-
-#Logfile: functions for writing logfile.txt, gets set by IEX_BL_config
-log_print => print a comment in the logfile
-log_update => updates the logfile with the current info (used if script is aborted)
-log_name_set => change name of logfile
-.log_entries => turns dictionary to header_list,data_list,format_list
-.write_header 
-.write_entry
-
-
-#m3r: functions for dealin with m3r
-m3r_tweak_pitch => tweaks the pitch of m3r
-m3r_table => go to the default position specified branch
-m3r_branch => returns the branch based on mirror position
-m3r_switch_branch => moves the mirror to the default position for a given branch
-m3r_centroid => returns the centroid position for m3r
-m3r_align => aligns the m3r
-
-#Motors: motor class and common name functions
-Motor => class definition get set in Beamline_Config
-mvx => moves motor x
-dmvx => relative move of x 
-scanx => scan of x motor
-dscanx => relative scan of x motor
-...
-
-#resolution
-resolution => gives the resolution for the current settings
-
-#scalers
-scaler_cts => sets the scaler counter for the current endstation
-
-#scanRecord: functions and class for handling the scanRecord
-saveData_get_all  => returns dictions of fileSystem,subDir,scanNumber,baseName
-ScanRecord => class for handling scanRecord_user
-scan_fillin => same as iex.BL.mda.fillin
-scan_fillin_table => same as iex.BL.mda.fillin_table
-scan_go => same as iex.BL.mda.go
-
-mda_filepath => same as iex.BL.mda.filepath
-mda_prefix => same as iex.BL.mda.prefix
-mda_user_name => same as iex.BL.mda.prefix
-mda_run_cycle => same as iex.BL.mda.run_cycle
-mda_reset => same as iex.BL.mda.reset_all
-
-.fillin => checks progress, clears positions and writes new values, updates kwarg settings 
-.fillin_table => checks progress, clears positions and writes new values, updates kwarg settings 
-.table_reset_after => sets back to linear and clears positioners
-
-.positioner_settling_time_get/set => gets/sets the positioner settling time
-.positioner_absolute_mode_set => sets the positioner mode absolute or relative
-.positioner_after_scan_set => sets positioner after scan to "PRIOR POS" or 'STAY'
-
-.detectors_clear => clears all detector for scan_dim
-.detectors_get/set  => gets/set detectors
-.detector_settling_time => sets to the default unless specified 
-
-.trigger_clear => clears all the detector triggers
-.trigger_get/set => gets/sets detector triggers
-
-.before_scan_set => sets the before scan pv, before_scan_pv = '' clears
-.after_scan_set => sets the after scan pv, after_scan_pv = '' clears
-
-.fileNum
-.lastFileNum
-.filepath
-.prefix
-.current_run
-.user_name
-.empty_scan => scan with no positioners
-.time_scan => scan with positioner readback as time and detector settling as minutes
-
-
-
-
-#Scienta: base functions for taking spectra, called by electron_analyzer
-
-#shutters: main shutter and branch shutter functions
-shutter_check => checks and then opens main and branch shutters
-main_shutter_open => checks status then opens if not open
-main_shutter_close => checks status then closes if not closed
-main_shutter_status => returns open=True/False
-branch_shutter_open => checks status then opens iex.BL.mda.branch shuttter if not open
-branch_shutter_close => checks status then closes iex.BL.mda.branch shuttter  if not closed
-branch_shutter_status => returns open=True/False
-
-#slits: beamline slits and aperatures
-slit_name_list => list all slits/apertures
-slits_synch => syncs the motor position with the slit table for a given slit
-slits_synch_all =>
-slits_get_all =>
-slits_set => sets the slit/aperature to the specified size and position
-slits_get => gets the slit/aperature size and position
-slits_set_size
-slits_set_center
-slits_scan_size
-slits_scan_center
-slit1A_scribe_marks => moves the slits so that the scribe marks should align
-slit1A_get/set
-slit2B_get/set
-slit2B_encoders_reset => resets the encords to be zero at the specified position
-slit3C_get/set
-slit3D_get/set
-exit_slit => uses iex.BL.branch to set correct exit slit size
-
-#staff 
-folders_startup => makes folder structure for a new run
-
-#storage ring
-wait_for_beam => waits for storage ring current to be above ring_current
-
-#userCals: functions for filling in user calcs and string Sequences
-
-#utilities: general functions
-dateandtime => prints current date and time
-today => returns a string with the date
-print_warning_message => prints a warning message_string
-wait_for_it => waits for future time
-input_timeout => used to break for an input
-playsound 
-range_up/down => loop for noninteger counting (inclusive of last point)
-take_closest_value => takes the closest value from a list
-read_dict => reads text files in iexcode.IEX_dictionaries
-make_table => makes a table array from a list of lists 
-
-#valves: control valves via epics
-branch_valve_close/open
-valve_close/open
-
-#VLS_PGM: mono functions
-mono_get_all => returns the current mono settings from most common parameters
-mono_get_all_extended => returns all the current mono settings
-mono_grating_get/set
-mono_energy_get/set
-mono_reset_pitch => resets the motors after a following error
-mono_stop => stops the mono motors
-mono_enage => reenables the mono motors
-mono_limits_reset => sets the energy lower limit to 200
-mono_cff_print
-mono_parameters_get
-mono_parameters_history_read
-mono_parameters_history_write
-mono_temperature_interlock => moving this to EPS
-mono_scan_fillin/_table
-mono_scan_after
-mono_motor_move
-mono_motor_scan_fillin
-mono_zero_order
-mono_angles_set
-mono_pink_beam
-mono_grating_offset_set
-mono_mirror_offset_set
-mono_grating_mirror_offsets_set
-mono_grating_b2_set
-mono_cff_set
-mono_arm_set
-
-#xrays
-safe_state
-energy_get_all
-energy_get => retuns the mono energy
-getE => same as energy_get
-energy => set the ID, aperatures and mono
-qp => set the qp ratio
-apertures_set => decrease aperature size/cutting flux
-mvID => moves the ID to a given set point (not calibrated)
-mvID_calibrated => moves the ID for max flux
-mvmono => sets mono energy
-grating/_get => switches gratings/gets the current grating
-polarization/_get => changes the polariation/gets current polarization
-scanXAS => table scan of the energy 
-shutter_check => checks main and branch shutter
-switch_branch => moves m3R to default position for the branch; close/reopens shutters too
-get_mirros => gets all the FMB mirror positions
-slit => sets the exit_slit
-slit_get => gets the exit slit
diff --git a/iexcode/instruments/FMB_mirrors.py b/iexcode/instruments/FMB_mirrors.py
index a34e03dc3e3560cb82250b7b2609a1f306bd797b..4dc2d0e358897a8a16c28a0589058a3f166c5457 100644
--- a/iexcode/instruments/FMB_mirrors.py
+++ b/iexcode/instruments/FMB_mirrors.py
@@ -33,10 +33,10 @@ def FMB_mirror_axis_position(mirror_num,axis, verbose=True):
     """
     returns the readback and set point of an FMB mirror
     """
-    pv = _FMB_mirror_ioc(mirror_num)
+    pv = _FMB_mirror_ioc(mirror_num)+axis
   
-    rbv = round(caget(pv+axis+"_MON"),3)
-    sp = round(caget(pv+axis+"_POS_SP"),3)
+    rbv = round(caget(pv+"_MON"),3)
+    sp = round(caget(pv+"_POS_SP"),3)
 
     if verbose:
         print (pv+axis+": "+str(rbv))
@@ -125,7 +125,7 @@ def FMB_mirror_tweak(mirror_num,axis,val,verbose=False):
      print(pv+" "+str(previous_position[0])+" -> "+str(new_position[0]))
 
 
-def FMB_mirror_scan(mirror_num,start,stop,step):
+def FMB_mirror_scan(mirror_num,axis,start,stop,step):
     """
     e.g. Scan_FMB_mirror("m1:TX",-5,5,.25)
 
@@ -133,7 +133,7 @@ def FMB_mirror_scan(mirror_num,start,stop,step):
         TY = vertical                RY = Pitch
         TZ = longitudinal            RZ = Roll
     """
-    pv = _FMB_mirror_ioc(mirror_num)
+    pv = _FMB_mirror_ioc(mirror_num)+axis
     
     # database sets .PREC==0.  We want more digits than that.
     caput(pv+"_SP.PREC",3)
diff --git a/iexcode/instruments/IEX_BL_config.py b/iexcode/instruments/IEX_BL_config.py
index 9d482720d0efaf91a7bce4d9e7846bba6586189f..8747f270db17198e58d75ab755ad3a9646d94381 100644
--- a/iexcode/instruments/IEX_BL_config.py
+++ b/iexcode/instruments/IEX_BL_config.py
@@ -15,26 +15,6 @@ init kwargs to see which defaults you can change.
 #For new endstation modify here:
 endstations_list = ['ARPES','kappa','Octupole']   
 class Beamline_Config:
-    """
-    used for defining which endstation in which you are running
-    for short names and ioc info
-
-    BL = Endstation('ARPES')
-        BL.endstation_name: name of endstation  ("ARPES" / "kappa" / "Octupole")
-        
-        BL.ioc: string of scan ioc  ('29idb:', '29idTest:')
-        BL.mda: scanRecord object of ioc specified by .ioc 
-        
-        BL.xrays: True/False, used for detectors and shutter check
-        BL.mode: 'user' / 'staff', used for detectors and to specifiy folder
-        
-        BL.folder: shorthand for where data is save and used for saveData structure ('b','c','d')
-        BL.prefix: mda prefix (set by endstation)
-
-        BL.log: object of log class which holds logging info
-
-    """
-
     def __init__(self,endstation_name,scan_ioc,xrays,mode='user',Motors=None,**kwargs):
         """
         intializes the several beamline variables 
@@ -48,8 +28,6 @@ class Beamline_Config:
             BL.mode => 'user'/'staff' previously: BL_Mode_Set
             BL.mda => scanRecord class used for scanning
             BL.folder => 'b','c','d'
-            BL.prefix => 'ARPES_','Kappa_'
-            BL.ioc => previously: BL_ioc()
             BL.Motors => motor calls#For new endstation modify here:
             BL.safe_state => function to put endstation in a 'safe state'
             BL.endstation_get => function to return endstation status
@@ -61,7 +39,6 @@ class Beamline_Config:
        
         self.endstation_name = None
         self.branch = None
-        self.ioc = scan_ioc
         self.folder = None
         self.prefix = None
 
@@ -122,12 +99,6 @@ class Beamline_Config:
 ##############################################################################################################
 ##############################               BL commands            ##############################
 ##############################################################################################################
-def BL_ioc():
-    """
-    returns the ioc from the Endstation instance
-    """
-    return iex.BL.ioc
-
 def BL_branch():
     """
     returns the branch from the Endstation instance
@@ -140,18 +111,6 @@ def BL_mode():
     """
     return iex.BL.mode
 
-def BL_mda_prefix():
-    """
-    returns the mda file prefix
-    """
-    return iex.BL.prefix
-
-def BL_mda_filepath():
-    """
-    returns the mda file prefix
-    """
-    return iex.BL.filepath
-
 ##############################################################################################################
 def get_all(verbose=True):
     """
diff --git a/iexcode/instruments/Kappa_det.py b/iexcode/instruments/Kappa_det.py
index b03fe847c641be18510e00eba7cf534e856889c5..21a43ee6c1f169561bbaa0378dac7dd926b94798 100644
--- a/iexcode/instruments/Kappa_det.py
+++ b/iexcode/instruments/Kappa_det.py
@@ -51,7 +51,7 @@ class Kappa_Detector:
             if move:
                 self.motors.move('tth',tth_val,wait=True,verbose=False)
 
-    def tth0_set(self,move):
+    def tth0_set(self):
         """
         resetting the tth motor zero to correspond to direct beam
 
@@ -73,5 +73,6 @@ class Kappa_Detector:
                 caput(tth_pv+'.SET','Use')
                 print("tth position reset to 0")
             else:
-                print("That's ok, everybody can get cold feet in tough situation...")
+                print("That's ok, everybody can get cold feet in tough situations...")
+            
 
diff --git a/iexcode/instruments/Keithley_current_amplifiers.py b/iexcode/instruments/Keithley_current_amplifiers.py
index 4ce8304280da680fd40c52260a629c4293a67faf..4c1c3c2d8d59a26a51e0947a9bc27b718f1f668d 100644
--- a/iexcode/instruments/Keithley_current_amplifiers.py
+++ b/iexcode/instruments/Keithley_current_amplifiers.py
@@ -42,6 +42,8 @@ def ca_dictionary():
     ca["c"] = {
         1:'TEY',
         }
+    ca["d"] = {}
+    ca["e"] = {}
     return ca
 
 ##############################################################################################################
diff --git a/iexcode/instruments/conversions_constants.py b/iexcode/instruments/conversions_constants.py
index 44f84907c589a4d7965bde87e823d3fee4fc5c1a..c8654fbb40932a05807e6edbae25a6a015922dd1 100644
--- a/iexcode/instruments/conversions_constants.py
+++ b/iexcode/instruments/conversions_constants.py
@@ -31,3 +31,90 @@ def Lambda2eV(Angstrom):
     eV = h*c/Angstrom*1e10
     return eV
 
+    
+def hv2kz(lattice,V0,hv):
+    """
+    Converts a hv value for the nth zone had returns corresponding kz values 
+    [0]for zone  boundary and [1] for zone center in inverse angstroms
+    lattice = c; assuming kz orthoganal to a-b plane (i.e. 2np.pi/c = GZ distance)
+    and at zone center (kx,ky)=0 /cos(th=0)=1
+    V0 = the inner potential
+    """
+    work_fct=EA.wk
+    Ek=hv-work_fct
+    k_z=0.5124*np.sqrt(Ek+V0)    # Kz at (kx,ky)=0 i.e. cos(th)=1
+    c_star=2*np.pi/lattice    # 2pi/c = GZ distance
+    GZ_n=round((k_z/c_star*2),2)
+    G_n=round((k_z/c_star),2)
+    print("  kz = "+str(round(k_z,2))+" A^(-1) = " +str(GZ_n)+" * pi/c = " +str(G_n)+" * 2pi/c")
+    return GZ_n,G_n
+    
+def kz2hv(lattice,V0,n):
+    """
+    Converts a kz value for the nth zone had returns corresponding hv
+    lattice = c; assuming kz orthoganal to a-b plane (i.e. 2pi/c = GZ distance)
+    and at zone center (kx,ky)=0 /cos(th=0)=1
+    V0 = the inner potential
+    """
+    work_fct=EA.wk
+    c_star=2*np.pi/lattice        # 2pi/c = GZ distance
+    Ek=(n*c_star/0.5124)**2-V0    # Ek at (kx,ky)=0 i.e. cos(th)=1
+    hv=Ek+work_fct
+    mono=round(hv,1)
+    print("\n")
+    print("  hv = Ek + Phi = "+str(round(hv,2))+" eV")
+    print("  kz = n*2pi/c   with  n = "+str(n))
+    return mono
+
+######### ARPES ###########
+def Print_Gamma_n(lattice,V0,n1,n2):
+    work_fct=EA.wk
+    c_star=2*np.pi/lattice                # 2pi/c = GZ distance
+    for n in range(n1,n2+1,1):
+        Ek_Gn=(n*c_star/0.5124)**2-V0        # Ek at G
+        Ek_Zn=((n+0.5)*c_star/0.5124)**2-V0    # Ek at Z
+        hv_Gn=round(Ek_Gn+work_fct,2)
+        hv_Zn=round(Ek_Zn+work_fct,2)
+        print("\n G["+str(n)+"]:  hv = Ek + Phi = "+str(round(hv_Gn,2))+" eV ")
+        print(" Z["+str(n)+"]:  hv = Ek + Phi = "+str(round(hv_Zn,2))+" eV")
+
+def Print_Gamma_hv(lattice,V0,hv1,hv2):
+    work_fct=EA.wk
+    c_star=2*np.pi/lattice                # 2pi/c = GZ distance
+    Ek1=hv1-work_fct
+    Ek2=hv2-work_fct
+    k_z1=0.5124*np.sqrt(Ek1+V0)    # Kz at (kx,ky)=0 i.e. cos(th)=1
+    k_z2=0.5124*np.sqrt(Ek2+V0)    # Kz at (kx,ky)=0 i.e. cos(th)=1
+    GZ_n1=round((k_z1/c_star*2),1)
+    G_n1=round((k_z1/c_star),1)
+    GZ_n2=round((k_z2/c_star*2),1)
+    G_n2=round((k_z2/c_star),1)
+    if modf(G_n1)[0]>=0.5:
+        n1=modf(G_n1)[1]+1,0
+    else:
+        n1=modf(G_n1)[1]
+    n2=modf(G_n2)[1]
+    print("\n hv1 = "+str(hv1)+" eV:  " +str(GZ_n1)+" * pi/c = " +str(G_n1)+" * 2pi/c")
+    if type(n1) == tuple: n1 = n1[0]
+    if type(n2) == tuple: n2 = n2[0]
+    Print_Gamma_n(lattice,V0,n1,n2)
+    print("\n hv2 = "+str(hv2)+" eV:  " +str(GZ_n2)+" * pi/c = " +str(G_n2)+" * 2pi/c")
+    return n1,n2
+
+def deg2kx(th,hv,verbose=True):
+    """
+    kx = 0.5124*sqrt(hv)*sin(theta)
+    """
+    kx = 0.5124*np.sqrt(hv)*np.sin(th/180*np.pi)
+    if verbose:
+        print('kx = '+str(round(kx,3))+' 1/A')
+    return kx
+
+def kx2deg(kx,hv,verbose=True):
+    """
+    theta = asin(kx/0.5124/sqrt(hv))
+    """
+    th = np.asin(kx/0.5124/np.sqrt(hv))*180/np.pi
+    if verbose:
+        print('th = '+str(round(th,3))+' deg')
+    return th
\ No newline at end of file
diff --git a/iexcode/instruments/diagnostics.py b/iexcode/instruments/diagnostics.py
index 5def6af5696498c7ff4818c92797a47af93b3d99..692ed319a67f1565d88588f0925c8beaef5d623b 100644
--- a/iexcode/instruments/diagnostics.py
+++ b/iexcode/instruments/diagnostics.py
@@ -93,9 +93,10 @@ def diagnostics_sp_read(diag_name,preset_name):
     pv = _diagnostics_preset_pv(diag_name,preset_name)
     caget(pv+'_Setpoint.VAL')
 
-def _diagnostics_sp_write(diag_name,preset_name):
+def _diagnostics_sp_write(diag_name,preset_name,val):
     pv = _diagnostics_preset_pv(diag_name,preset_name)
-    caget(pv+'_Setpoint.VAL')
+    #need to make this an input question, are you sure?
+    print('caput(+'pv+'_Setpoint.VAL,'+str(val)+')'
     
 
 ##############################################################################################################
diff --git a/iexcode/instruments/electron_analyzer.py b/iexcode/instruments/electron_analyzer.py
index de246eda4ce0810e3d048920dc4b5e3dc6cddfe2..cc3e24923881b84449328ab4380905f12ac16827 100644
--- a/iexcode/instruments/electron_analyzer.py
+++ b/iexcode/instruments/electron_analyzer.py
@@ -703,96 +703,7 @@ def scanEA_map_sample(EAlist,y_list,z_list,**kwargs):
 
         #After scan
         scanEA_reset(**kwargs)
-             
-    
-def hv2kz(lattice,V0,hv):
-    """
-    Converts a hv value for the nth zone had returns corresponding kz values 
-    [0]for zone  boundary and [1] for zone center in inverse angstroms
-    lattice = c; assuming kz orthoganal to a-b plane (i.e. 2np.pi/c = GZ distance)
-    and at zone center (kx,ky)=0 /cos(th=0)=1
-    V0 = the inner potential
-    """
-    work_fct=EA.wk
-    Ek=hv-work_fct
-    k_z=0.5124*np.sqrt(Ek+V0)    # Kz at (kx,ky)=0 i.e. cos(th)=1
-    c_star=2*np.pi/lattice    # 2pi/c = GZ distance
-    GZ_n=round((k_z/c_star*2),2)
-    G_n=round((k_z/c_star),2)
-    print("  kz = "+str(round(k_z,2))+" A^(-1) = " +str(GZ_n)+" * pi/c = " +str(G_n)+" * 2pi/c")
-    return GZ_n,G_n
-    
-def kz2hv(lattice,V0,n):
-    """
-    Converts a kz value for the nth zone had returns corresponding hv
-    lattice = c; assuming kz orthoganal to a-b plane (i.e. 2pi/c = GZ distance)
-    and at zone center (kx,ky)=0 /cos(th=0)=1
-    V0 = the inner potential
-    """
-    work_fct=EA.wk
-    c_star=2*np.pi/lattice        # 2pi/c = GZ distance
-    Ek=(n*c_star/0.5124)**2-V0    # Ek at (kx,ky)=0 i.e. cos(th)=1
-    hv=Ek+work_fct
-    mono=round(hv,1)
-    print("\n")
-    print("  hv = Ek + Phi = "+str(round(hv,2))+" eV")
-    print("  kz = n*2pi/c   with  n = "+str(n))
-    return mono
-
-
-def Print_Gamma_n(lattice,V0,n1,n2):
-    work_fct=EA.wk
-    c_star=2*np.pi/lattice                # 2pi/c = GZ distance
-    for n in range(n1,n2+1,1):
-        Ek_Gn=(n*c_star/0.5124)**2-V0        # Ek at G
-        Ek_Zn=((n+0.5)*c_star/0.5124)**2-V0    # Ek at Z
-        hv_Gn=round(Ek_Gn+work_fct,2)
-        hv_Zn=round(Ek_Zn+work_fct,2)
-        print("\n G["+str(n)+"]:  hv = Ek + Phi = "+str(round(hv_Gn,2))+" eV ")
-        print(" Z["+str(n)+"]:  hv = Ek + Phi = "+str(round(hv_Zn,2))+" eV")
-
-def Print_Gamma_hv(lattice,V0,hv1,hv2):
-    work_fct=EA.wk
-    c_star=2*np.pi/lattice                # 2pi/c = GZ distance
-    Ek1=hv1-work_fct
-    Ek2=hv2-work_fct
-    k_z1=0.5124*np.sqrt(Ek1+V0)    # Kz at (kx,ky)=0 i.e. cos(th)=1
-    k_z2=0.5124*np.sqrt(Ek2+V0)    # Kz at (kx,ky)=0 i.e. cos(th)=1
-    GZ_n1=round((k_z1/c_star*2),1)
-    G_n1=round((k_z1/c_star),1)
-    GZ_n2=round((k_z2/c_star*2),1)
-    G_n2=round((k_z2/c_star),1)
-    if modf(G_n1)[0]>=0.5:
-        n1=modf(G_n1)[1]+1,0
-    else:
-        n1=modf(G_n1)[1]
-    n2=modf(G_n2)[1]
-    print("\n hv1 = "+str(hv1)+" eV:  " +str(GZ_n1)+" * pi/c = " +str(G_n1)+" * 2pi/c")
-    if type(n1) == tuple: n1 = n1[0]
-    if type(n2) == tuple: n2 = n2[0]
-    Print_Gamma_n(lattice,V0,n1,n2)
-    print("\n hv2 = "+str(hv2)+" eV:  " +str(GZ_n2)+" * pi/c = " +str(G_n2)+" * 2pi/c")
-    return n1,n2
-
-def deg2kx(th,hv,verbose=True):
-    """
-    kx = 0.5124*sqrt(hv)*sin(theta)
-    """
-    kx = 0.5124*np.sqrt(hv)*np.sin(th/180*np.pi)
-    if verbose:
-        print('kx = '+str(round(kx,3))+' 1/A')
-    return kx
-
-def kx2deg(kx,hv,verbose=True):
-    """
-    theta = asin(kx/0.5124/sqrt(hv))
-    """
-    th = np.asin(kx/0.5124/np.sqrt(hv))*180/np.pi
-    if verbose:
-        print('th = '+str(round(th,3))+' deg')
-    return th
-
-    
+                 
 def resolution_EA(PE,slit_SES):    # updated 10/30/17: straight slits scaled to slit width not area
     SES_Table={}
     SES_Table[2]   = {1: 1.6, 2:2,   3:2,   4:4,   5:4,   6:6,    7:12,   8:20,   9:32}
diff --git a/iexcode/instruments/scanRecord.py b/iexcode/instruments/scanRecord.py
index f6942ea8ad30afbae08dfee33c749dd471d90277..1a7cf1edc9fb1115eed321b4583db047c329e387 100644
--- a/iexcode/instruments/scanRecord.py
+++ b/iexcode/instruments/scanRecord.py
@@ -57,8 +57,6 @@ def scan_detectors_set(**kwargs):
     iex.BL.mda.detectors_set(**kwargs)
 
 
-
-
 def scan_go(**kwargs):
     """
     Starts a scan 
diff --git a/iexcode/staff_cheatsheet.md b/iexcode/staff_cheatsheet.md
new file mode 100644
index 0000000000000000000000000000000000000000..d7f13d88c617e88dc91212ccfecdbbf7402f223c
--- /dev/null
+++ b/iexcode/staff_cheatsheet.md
@@ -0,0 +1,391 @@
+# **IEX python - cheatsheet**
+list of commonly used python functions for the Octupole Endstation 
+<br>
+
+---
+<br>
+
+# **Instruments**
+
+## **ARPES**
+ARPES sepcific functions
+
+    tey,ca15 = ARPES_init('user_name')
+
+## **AD_untilites**
+functions for common area detector operations
+
+## **bakeout**
+functions for monitoring a bakeout
+
+## **cfg**
+config file which holds global variable BL and MPA
+
+    
+    import iexcode.instruments.cfg as iex
+
+## **converstions_constants**
+    h                               #Planck's constant (eV/s)
+    c                               #speed of light (m/s)
+    -------------------------------------------------------------
+    deg2rad(deg)                    #converts degree to radian
+    rad2deg(radian)                 #converts radian to degrees
+    -------------------------------------------------------------
+    eV2Lambda(eV)                   #converts eV to wavelength in Angstroms
+    Lambda2eV(Angstroms)            #converts Angstroms to eV
+    -------------------------------------------------------------
+    hv2kz(lattice,V0,hv)            #converts photon energy to kz       
+    kz2hv(lattice,V0,n)             #converst kz to photon energy
+    kx2deg(kx,hv)                   #converts in-plane momentum to degrees
+    deg2kx(th,hv)                   #conversts degrees to in-plane momentum
+
+## **diagnostics**
+beamline diagnostics, positions and current amplifiers
+To Do: add functions to enable scanning
+
+    diagnostic_name_list()              #prints the name of all the diagnostics_all_in/out()            #move all diagnostics to in/out position
+    diagnostic_InOut(name,In_Out)       #moves the specified diagnostic in/out
+    diagnostic_read(name)               #reads the current amplifier for a given diagnostic
+    -------------------------------------------------------------
+    mesh_W(In_Out)                      #moves W-mesh in the A-hutch in/out
+    diode_c(In_Out)                     #moves diode in c-branch in/out
+    diode_c_read()                      #reads the current amplifier for the c-branch diode
+    diode_d(In_Out)                      #moves diode in c-branch in/out; located just before the kappa endstation
+    mesh_d(In_Out)                      #moves mesh in d-branch in/out; used for normalization
+    mesh_d_read()                       #reads the current amplifier for the d-branch mesh
+-------------------------------------------------------------
+    diagnostics_preset_list()   #returns the dictionary with all preset positions
+    diagnostics_presets_go(diag_name,preset_name)   #goes to preset value 
+    _diagnostics_sp_write(diag_name,preset_name,val)
+
+## **electron_analyzer**
+Scienta functions
+
+    folders_EA(userPath                            #sets the folder for spectra saving (called by folders_ARPES)
+
+    EA_ioc_init()                           #initializes the ioc after a reboot (eventually goes in AutoSave)
+    -------------------------------------------------------------
+    EA.get()                        #get current EA setting
+    EA.put(KE,PE)                   #change EA setting
+    EA.off()                        #turns off EA high voltagae
+    -------------------------------------------------------------
+    SES_motor_get()                 #gets current SES slit number
+    SES_motor_set(slit_number)      #change SES slit
+    -------------------------------------------------------------
+    scanEA_reset()                  #clears scanRecord after abort
+    -------------------------------------------------------------
+    scanEA(EAlist)                          #takes spectra
+    scanFM(EAlist,thList,RoughPositions)    #takes Fermi map
+    scanEA_y(EAlist,y_start,y_stop,y_step)  #takes spectra along y
+    scanEA_z(EAlist,z_start,z_stop,z_step)  #takes spectra along z
+    scanEA_map_sample(EAlist,y_list,z_list) #takes spectra in 2D y,z scan
+    -------------------------------------------------------------
+    EA_ioc_init()                           #initializes the ioc after a reboot (eventually goes in AutoSave)
+
+
+## **encoder**
+all beamline absolute encoders
+
+    encoder_name_list()         #lists names in encoder dictionary
+    encoder_sync(name)          #syncs all the encoders associated with name
+    encoders_reset_zero(name)    #resets the center for the current position
+
+## **files_and_folder**
+general functions for dealing with files and directories
+
+    path_dserv(folder,run,user_name)   #path to user data directory on the dserve
+    check_run()                         #returns the current run based on todays date
+    folder_ftp(folder,run,user_name)              #creates the folders on the ftp server, kip
+    make_user_folders(run,folder,user_name,endstation_name)     #creates all the appropriate user folders
+    folder_mdarun,folder,user_name,file_prefix,ioc)             #creates/set the user folder for the scanRecord
+    folder_SPEC(run,folder,user_name)   #creat3s spec folder in 29iduser account
+
+## **FMB_mirrors**
+functions for M0,M1,M3R
+To Do: M0M1 table moves to dictionary with csv file
+
+    FMB_mirror_get(mirror_num)                      #get the current position of all axes for a given mirror
+    FMB_mirror_move(mirror_num,axis)                #moves the specified axis ('Tx','Ty','Tz','Rx','Ry','Rz') for the given mirror
+    FMB_mirror_move_all(mirror_num,position_list)   #moves all the axes to the positions specified in position_list
+    FMB_mirror_tweak(mirror_num,axis)               #relative moves
+    FMB_mirror_scan(mirror_num,start,stop,step)     #scan a mirror axis
+    M0M1_Table => reads the dictionary file to get the previous mirror positions
+    M0M1_SP => writes the values form M0M1_Table to the set points (still need to push move)
+
+## **hxp_mirrors**
+Newport hexapods M3A/M4A and M4R
+
+    hxp_sync(mirror_name)                   #syncs the motor setpoint and readback values 
+    hxp_get(mirror_name)                    #gets a mirror position
+    hxp_get_all()                           #gets all the mirror positions
+
+## **IEX_camera**
+Cameras to enable/disable when switching between branches
+
+    cam_pv_dictionary()
+    _enable_endstation_cameras(unused_off=True)
+
+## **IEX_BL_config**
+used to access current beamline configuration, based on instance initialization not pv
+
+    Beamline_Config     #class to carry all configuration info gets stored in 
+    iexcode\instruments\cfg BL
+    BL_branch()         #returns the branch (shutter not mirror position)
+    BL_mode()           #returns the current mode (user/staff)
+    get_all()           #gets relavent pv values
+
+## **IEX_VPU: undulator functions**
+insertion device functions
+
+    ID_wait_for_permission()      #waits for security access 
+    
+    ID_get_all()                  #gets ID_mode, ID_QP_ratio, ID_sp, ID_rbv
+    ID_energy_range()             #return max/min for a given mode
+    ID_ready()                    #looks at the two busy records
+    ID_off/on()                   #turns off/on the ID 
+    ID_power_status()             #returns off/on
+    ID_start(ID_mode,QP_ratio)    #turns on the ID in a given mode
+    ID_switch_mode(ID_mode)       #changes the ID mode
+    ID_get/set()                  #gets rbv / sets val in keV
+    ID_get/set_eV()               #gets rbv / sets val in eV, uses keV pvs, just does math
+    ID_energy_set(val)            #set calibrated energy in keV
+    ID_energy_set_eV(val)         #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
+    -------------------------------------------------------------
+    ID_calc_eV(mono_grating,ID_mode,hv_eV,QP_ratio) #calculate the set point for maximum flux
+
+
+## **kappa_angle_calcs**
+
+    fourc2kappa(theta,chi,phi)                   # converts between four-circle angles and kappa angles
+    kappa2fourc(kth,kappa,kphi)                   # converts between kappa dn four-circle angles
+
+## **kappa_det**
+defines kappa tth detector class and other functions
+
+    Kappa_Detector(kappa_Motors)       #for detset etc in kappa chamber
+        tthdet.set(det_name)           #sets the tth to a different detector
+        tthdet.get()                   #returns the current tth det_name
+        tth0_set()                     #resets the tth zero; d4 only
+
+
+## **kappa** 
+kappa specific functions
+
+    tey,d3,d4,mesh,tth_pv,tthdet = kappa_init('user_name)
+
+## **Logfile** 
+functions for writing logfile.txt, gets set by IEX_BL_config
+
+    log_print(comment)      #print a comment in the logfile
+    log_update()            #updates the logfile with the current info (used if script is aborted)
+    log_name_set(new_name)  #change name of logfile
+
+
+
+## **m3r**
+functions for dealing with m3r
+To Do - move m3r table to dictionary
+
+    m3r_tweak_pitch(tweak_value)      #tweaks the pitch of m3r
+    m3r_table()                       #go to the default position specified branch
+    m3r_branch()                      #returns the branch based on mirror position
+    m3r_switch_branch()               #moves the mirror to the default position for a given branch, does not close the shutter
+    m3r_centroid()                    #returns the centroid position for m3r
+    m3r_align  ()                     #aligns the m3r
+
+## **Motors** 
+motor class and common name functions
+
+    Motor                       #class definition get set in Beamline_Config
+    mvx(val)                    #moves motor x
+    dmvx(val)                   #relative move of x 
+    scanx(start,stop,step)      #scan of x motor
+    dscanx (start,stop,step)    #relative scan of x motor
+    ...
+
+## **resolution**
+
+    resolution()            #gives the resolution for the current settings
+
+## **scalers**
+
+    scaler_cts()            #sets the scaler counter for the current endstation
+
+## scanRecord
+functions and class for handling the scanRecord
+
+    saveData_get_all()  #returns dictions of fileSystem,subDir,scanNumber,baseName
+    mda_filepath()      #gets the full filepath from the current mda setting
+    mda_prefix()        #get the prefix from the current mda setting
+    mda_user_name()     #gets the user name from the current mda setting
+    mda_run_cycle()     #gets the run cycle from the current mda setting
+    mda_ioc()           #returns the ioc
+    mda_reset()         #resets the scanRecord base on init parameters
+
+
+    mda_fileNum()       #return next fileNum
+    last_mda()          #retruns the filenum for the last saved scan
+    -------------------------------------------------------------
+    ScanRecord #class for handling scanRecord_user
+    -------------------------------------------------------------
+    scan_fillin(VAL,RBV,start,stop,steps)   #fills in scanRecord linear mode
+    scan_fillin_table(VAL,RBV,my_table)     #fills in scanRecord table mode
+    scan_go()                               #starts a scan
+
+    scan_after_table_reset()                #sets back to linear and clears positioners
+
+    scan_positioners_clear()                #clears the positioners
+    scan_positioner_after_set()             #procs the after scan sequence
+    scan_positioner_settling_time_set()     #sets the settling time
+    scan_triggers_set()                     #sets the scan triggers
+    scan_triggers_clear()                   #clears the triggers
+    scan_detectors_set()                    #adds a detector
+
+    .empty_scan #scan with no positioners
+    .time_scan #scan with positioner readback as time and detector settling as minutes
+
+
+
+
+## **Scienta**
+base functions for taking spectra, called by electron_analyzer
+
+## **shutters**
+main shutter and branch shutter functions
+
+    shutter_check()         #checks and then opens main and branch shutters
+    main_shutter_open()     #checks status then opens if not open
+    main_shutter_close()    #checks status then closes if not closed
+    main_shutter_status()   #returns open=True/False
+    branch_shutter_open()   #checks status then opens iex.BL.mda.branch shuttter if not open
+    branch_shutter_close()  #checks status then closes iex.BL.mda.branch shuttter  if not closed
+    branch_shutter_status() #returns open=True/False
+
+## slits
+beamline slits and aperatures
+
+    slit_name_list()            #list all slits/apertures
+    slits_synch(slit_name)      #syncs the motor position with the slit table for a given slit
+    slits_synch_all()           #syncs all slits
+    slits_get_all()             #gets current values
+    slits_set #sets the slit/aperature to the specified size and position
+    slits_get #gets the slit/aperature size and position
+    slits_set_size
+    slits_set_center
+    slits_scan_size
+    slits_scan_center
+    slit1A_scribe_marks #moves the slits so that the scribe marks should align
+    slit1A_get/set
+    slit2B_get/set
+    slit2B_encoders_reset #resets the encords to be zero at the specified position
+    slit3C_get/set
+    slit3D_get/set
+    exit_slit #uses iex.BL.branch to set correct exit slit size
+
+#staff 
+folders_startup => makes folder structure for a new run
+
+#storage ring
+wait_for_beam => waits for storage ring current to be above ring_current
+
+#userCals: functions for filling in user calcs and string Sequences
+
+#utilities: general functions
+dateandtime => prints current date and time
+today => returns a string with the date
+print_warning_message => prints a warning message_string
+wait_for_it => waits for future time
+input_timeout => used to break for an input
+playsound 
+range_up/down => loop for noninteger counting (inclusive of last point)
+take_closest_value => takes the closest value from a list
+read_dict => reads text files in iexcode.IEX_dictionaries
+make_table => makes a table array from a list of lists 
+
+#valves: control valves via epics
+branch_valve_close/open
+valve_close/open
+
+#VLS_PGM: mono functions
+mono_get_all => returns the current mono settings from most common parameters
+mono_get_all_extended => returns all the current mono settings
+mono_grating_get/set
+mono_energy_get/set
+mono_reset_pitch => resets the motors after a following error
+mono_stop => stops the mono motors
+mono_enage => reenables the mono motors
+mono_limits_reset => sets the energy lower limit to 200
+mono_cff_print
+mono_parameters_get
+mono_parameters_history_read
+mono_parameters_history_write
+mono_temperature_interlock => moving this to EPS
+mono_scan_fillin/_table
+mono_scan_after
+mono_motor_move
+mono_motor_scan_fillin
+mono_zero_order
+mono_angles_set
+mono_pink_beam
+mono_grating_offset_set
+mono_mirror_offset_set
+mono_grating_mirror_offsets_set
+mono_grating_b2_set
+mono_cff_set
+mono_arm_set
+
+#xrays
+safe_state
+energy_get_all
+energy_get => retuns the mono energy
+getE => same as energy_get
+energy => set the ID, aperatures and mono
+qp => set the qp ratio
+apertures_set => decrease aperature size/cutting flux
+mvID => moves the ID to a given set point (not calibrated)
+mvID_calibrated => moves the ID for max flux
+mvmono => sets mono energy
+grating/_get => switches gratings/gets the current grating
+polarization/_get => changes the polariation/gets current polarization
+scanXAS => table scan of the energy 
+shutter_check => checks main and branch shutter
+switch_branch => moves m3R to default position for the branch; close/reopens shutters too
+get_mirros => gets all the FMB mirror positions
+slit => sets the exit_slit
+slit_get => gets the exit slit
+
+## Keithley_current_amplifiers
+Keithley specific functions
+
+    ca = Keithley(ca_crate, ca_num)   #class for Keithley current amplifiers
+        ca.get()                      #gets current values
+        ca.reset()                    #resets
+        ca.autoscale(On_Off)          #turn autoscaling on/off
+        ca.avg(num_averages)          #set averaging (1 or 0 is off)
+        ca_detector_list              #list of detectors which are used in a given branch ('b for beamline)
+        ca_average()                  #turns on averaging for all Keithleys in ca_list
+        ca_reset_all()                #resets all Keithleys in all branches
+
+## SRS_current_amplifiers
+    SRS specific functions
+    SRS => class for SRS current amplifiers
+    .get
+    .setgain
+
+current2flux => calculates the flux based on the current reading in an AUX100 photodiode
+flux2current => calculates the current reading for a given flux for and AUX100 photodiode
+
+
+
+
+# **Macros**
+
+## **IEX_cameras** 
+used for taking images from epics
+
+    cam_snap(cam_num)               # takes a single image
+    cam_scan_setup(cam_num)         #configures the scanRecord trigger an image
+    cam_live(cam_nume)              #puts the camera back in live/free-run mode
+    cam_done(cam_num)               #turns off acquisition