diff --git a/build/lib/iexcode/instruments/ARPES.py b/build/lib/iexcode/instruments/ARPES.py
index 63ace10ceedadd91f68bdcba2ec6f88b2cd6c56b..0ade96a6f90d489673abd2a03b6fd3cd0b4a4b91 100644
--- a/build/lib/iexcode/instruments/ARPES.py
+++ b/build/lib/iexcode/instruments/ARPES.py
@@ -5,20 +5,14 @@ from epics import caget,caput,PV
 
 import iexcode.instruments.cfg as iex
 from iexcode.instruments.IEX_endstations import Endstation
-#import iexcode.instruments.IEX_endstations as iex
-
-from iexcode.instruments.staff import staff_detector_dictionary
 
 from iexcode.instruments.files_and_folders import check_run,make_user_folders,folder_mda
 from iexcode.instruments.staff import staff_detector_dictionary
-from iexcode.instruments.Logfile import Logfile
+from iexcode.instruments.xrays import xrays_detector_dictionary,xrays_reset,xrays_get_all
 
 from iexcode.instruments.conversions_constants import *
 from iexcode.instruments.utilities import *
-
 from iexcode.instruments.userCalcs import userStringSeq_clear, userStringSeq_pvs
-from iexcode.instruments.scanRecord import ScanRecord
-from iexcode.instruments.xrays import BL_energy_tables, xrays_detector_dictionary,xrays_reset,xrays_get_all
 
 from iexcode.instruments.Motors import Motors
 from iexcode.instruments.current_amplifiers import *
@@ -29,14 +23,13 @@ from iexcode.instruments.slits import slit3C_get
 from iexcode.instruments.Lakeshore_335 import Lakeshore_reset
 from iexcode.instruments.electron_analyzer import EA_init_Motors,folders_EA,EA
 
-global tey,ca15
-global ARPES_Motors
-
 default_ioc = '29idARPES:'
+global tey, ca15
+
 #############################################################################
 def ARPES_init(*userName,**kwargs):
     """
-        user is an optional parameter
+        userName is an optional parameter
         kwargs:
         set_folders: sets the mda and EA folders (default => True)  
         reset: to reset the detectors in the IOC, etc (default => True)  
@@ -56,10 +49,8 @@ def ARPES_init(*userName,**kwargs):
     ARPES_Motors = Motors('ARPES',ARPES_motor_dictionary(),physical_motors,psuedo_motors)
 
     #endstation
-    #global BL
     iex.BL = Endstation('ARPES',kwargs['scan_ioc'],kwargs['xrays'],kwargs['BL_mode'],ARPES_Motors)
     
-
     #setting folders
     if kwargs['set_folders']:
         if iex.BL.mode == 'staff':
@@ -83,16 +74,17 @@ def ARPES_init(*userName,**kwargs):
         print("NOTE: Scienta IOC is not running")
     
     #global detectors
-    global tey,ca15
+    global tey, ca15
     tey = Keithley('c',1)
     ca15 = Keithley('b',15)
   
     #resetting everything
     if kwargs['reset']:
-        ARPES_reset()
+        ARPES_reset(**kwargs)
     
     print ('ARPES initalized')
-
+    #return any detectors or other parameters that you want access to from jupyter
+    return tey,ca15
 
 ##############################################################################################################
 ##############################             ARPES detectors and motors         ##############################
@@ -115,10 +107,16 @@ def ARPES_detector_dictionary(xrays=True):
     det_dict={
         14:"29idc:ca2:read",
         16:"29idc:ca1:read",
-        17:EA._statsPlugin+"Total_RBV",
+        17:"",
         18:"29idARPES:LS335:TC1:IN1",
         19:"29idARPES:LS335:TC1:IN2",
         }
+    
+    #add Scienta if ioc is on
+    if EA.connected: 
+       det_dict.update({17:EA._statsPlugin+"Total_RBV"})
+
+    #add detectors related to beamline
     if xrays: 
         det_dict.update(xrays_detector_dictionary())
     return det_dict
@@ -213,9 +211,9 @@ def ARPES_reset(**kwargs):
     #global BL
     #resetting the scanRecord
     if iex.BL.mode=='staff':
-        iex.BL.mda.detector_dictionary = staff_detector_dictionary()
+        iex.BL.mda.detector_dictionary = staff_detector_dictionary(kwargs['xrays'])
     else:
-        iex.BL.mda.detector_dictionary = ARPES_detector_dictionary()
+        iex.BL.mda.detector_dictionary = ARPES_detector_dictionary(kwargs['xrays'])
     
     iex.BL.mda.trigger_dictionary = ARPES_trigger_dictionary(**kwargs)
     iex.BL.mda.scan_before_sequence = ARPES_scan_before_sequence(**kwargs)
diff --git a/build/lib/iexcode/instruments/Motors.py b/build/lib/iexcode/instruments/Motors.py
index 2882fd9e5d883cb637d3b41d0c0d40ab19dd3861..fb75d6170f75cfb0849362e2a17dd3c329341557 100644
--- a/build/lib/iexcode/instruments/Motors.py
+++ b/build/lib/iexcode/instruments/Motors.py
@@ -161,9 +161,7 @@ class Motors:
         kwargs.setdefault('relative',False)
         kwargs.setdefault('scan_dim',1)
         kwargs.setdefault('execute',True)
-
-        from iexcode.instruments.IEX_endstations import BL
-        
+       
         #for kappa only
         kwargs.setdefault('cts',0.1)
         kwargs.setdefault('mpa',False)
diff --git a/build/lib/iexcode/instruments/files_and_folders.py b/build/lib/iexcode/instruments/files_and_folders.py
index e1a12660333fb359014b4e192c25fd8902a0bb49..1f85d5bc8ec66cfe0552bc5e9f744c89c63e4797 100644
--- a/build/lib/iexcode/instruments/files_and_folders.py
+++ b/build/lib/iexcode/instruments/files_and_folders.py
@@ -166,7 +166,7 @@ def folder_mda(run,folder,user_name,file_prefix,ioc,verbose=True):
         sleep(0.25) #needed so that it has time to write        
         caput(ioc+"saveData_subDir","/"+user_name+"mda")
 
-    caput(ioc+"saveData_baseName",file_prefix+"_")
+    caput(ioc+"saveData_baseName",file_prefix)
     caput(ioc+"saveData_scanNumber",FileNumber)
 
     print("\nioc set to:", ioc)
diff --git a/iexcode/instruments/ARPES.py b/iexcode/instruments/ARPES.py
index 63ace10ceedadd91f68bdcba2ec6f88b2cd6c56b..333e95697a476bdb8b7965e4814bdab2c8d506e5 100644
--- a/iexcode/instruments/ARPES.py
+++ b/iexcode/instruments/ARPES.py
@@ -5,20 +5,14 @@ from epics import caget,caput,PV
 
 import iexcode.instruments.cfg as iex
 from iexcode.instruments.IEX_endstations import Endstation
-#import iexcode.instruments.IEX_endstations as iex
-
-from iexcode.instruments.staff import staff_detector_dictionary
 
 from iexcode.instruments.files_and_folders import check_run,make_user_folders,folder_mda
 from iexcode.instruments.staff import staff_detector_dictionary
-from iexcode.instruments.Logfile import Logfile
+from iexcode.instruments.xrays import xrays_detector_dictionary,xrays_reset,xrays_get_all
 
 from iexcode.instruments.conversions_constants import *
 from iexcode.instruments.utilities import *
-
 from iexcode.instruments.userCalcs import userStringSeq_clear, userStringSeq_pvs
-from iexcode.instruments.scanRecord import ScanRecord
-from iexcode.instruments.xrays import BL_energy_tables, xrays_detector_dictionary,xrays_reset,xrays_get_all
 
 from iexcode.instruments.Motors import Motors
 from iexcode.instruments.current_amplifiers import *
@@ -29,19 +23,22 @@ from iexcode.instruments.slits import slit3C_get
 from iexcode.instruments.Lakeshore_335 import Lakeshore_reset
 from iexcode.instruments.electron_analyzer import EA_init_Motors,folders_EA,EA
 
-global tey,ca15
-global ARPES_Motors
-
 default_ioc = '29idARPES:'
+global tey, ca15
+
 #############################################################################
 def ARPES_init(*userName,**kwargs):
     """
-        user is an optional parameter
-        kwargs:
-        set_folders: sets the mda and EA folders (default => True)  
-        reset: to reset the detectors in the IOC, etc (default => True)  
-        xrays: sets global variable and detectors for x-ray (default => True) 
-        mode: used sets the detectors 'user ' / 'staff' (default => 'user' )  
+    used to intialize the Endstation class which carries scanRecord, logging ... parameters
+    returns global detectors relavent to this endstation (tey,ca15)
+
+        *userName is an optional parameter, will be prompted if set_folders=True
+
+        **kwargs:
+            set_folders: sets the mda and EA folders (default => True)  
+            reset: to reset the detectors in the IOC, etc (default => True)  
+            xrays: sets global variable and detectors for x-ray (default => True) 
+            mode: used sets the detectors 'user ' / 'staff' (default => 'user' )  
     """
     kwargs.setdefault('scan_ioc',default_ioc)
     kwargs.setdefault('xrays',True)
@@ -56,10 +53,8 @@ def ARPES_init(*userName,**kwargs):
     ARPES_Motors = Motors('ARPES',ARPES_motor_dictionary(),physical_motors,psuedo_motors)
 
     #endstation
-    #global BL
     iex.BL = Endstation('ARPES',kwargs['scan_ioc'],kwargs['xrays'],kwargs['BL_mode'],ARPES_Motors)
     
-
     #setting folders
     if kwargs['set_folders']:
         if iex.BL.mode == 'staff':
@@ -83,16 +78,17 @@ def ARPES_init(*userName,**kwargs):
         print("NOTE: Scienta IOC is not running")
     
     #global detectors
-    global tey,ca15
+    global tey, ca15
     tey = Keithley('c',1)
     ca15 = Keithley('b',15)
   
     #resetting everything
     if kwargs['reset']:
-        ARPES_reset()
+        ARPES_reset(**kwargs)
     
     print ('ARPES initalized')
-
+    #return any detectors or other parameters that you want access to from jupyter
+    return tey,ca15
 
 ##############################################################################################################
 ##############################             ARPES detectors and motors         ##############################
@@ -115,10 +111,16 @@ def ARPES_detector_dictionary(xrays=True):
     det_dict={
         14:"29idc:ca2:read",
         16:"29idc:ca1:read",
-        17:EA._statsPlugin+"Total_RBV",
+        17:"",
         18:"29idARPES:LS335:TC1:IN1",
         19:"29idARPES:LS335:TC1:IN2",
         }
+    
+    #add Scienta if ioc is on
+    if EA.connected: 
+       det_dict.update({17:EA._statsPlugin+"Total_RBV"})
+
+    #add detectors related to beamline
     if xrays: 
         det_dict.update(xrays_detector_dictionary())
     return det_dict
@@ -180,7 +182,6 @@ def folders_ARPES(user_name,**kwargs):
     kwargs.setdefault('ftp',False)
     kwargs.setdefault('debug',False)
 
-    #global BL
     run = kwargs['run']
 
     if kwargs['debug']:
@@ -193,12 +194,7 @@ def folders_ARPES(user_name,**kwargs):
     if kwargs["set_folders"]:
         # Set up MDA folder:
         folder_mda(run,iex.BL.folder,user_name,iex.BL.prefix,iex.BL.ioc)
-        sleep(5)
-        logfile_name_set(iex.BL.endstation)
-        sleep(2)
-        logfile_header(iex.BL.endstation,iex.BL.ioc,ARPES_log_header())
 
-        
         #Set up Scienta folders:
         if EA.connected: 
             userPath = "/net/s29data/export/data_29id"+iex.BL.folder+"/"+run+"/"+user_name+"/"
@@ -209,27 +205,27 @@ def folders_ARPES(user_name,**kwargs):
 def ARPES_reset(**kwargs):
     """
     resets scanRecord, current amplifiers, mono limits and lakeshore
-    """
-    #global BL
-    #resetting the scanRecord
+    """   
+    #writing default parameters to iex.BL.mda
     if iex.BL.mode=='staff':
-        iex.BL.mda.detector_dictionary = staff_detector_dictionary()
+        iex.BL.mda.detector_dictionary = staff_detector_dictionary(kwargs['xrays'])
     else:
-        iex.BL.mda.detector_dictionary = ARPES_detector_dictionary()
-    
+        iex.BL.mda.detector_dictionary = ARPES_detector_dictionary(kwargs['xrays'])
     iex.BL.mda.trigger_dictionary = ARPES_trigger_dictionary(**kwargs)
     iex.BL.mda.scan_before_sequence = ARPES_scan_before_sequence(**kwargs)
     iex.BL.mda.scan_after_sequence = ARPES_scan_after_sequence(**kwargs)
-    
+    #resetting the scanRecord
+    print("resetting the scanRecord - "+iex.BL.ioc)
     iex.BL.mda.reset_all()
 
     #resetting the current amplifiers
+    print("resetting the current amplifiers")
     if iex.BL.xrays:
         ca_reset_all()
     else:
         tey.reset()
 
-    #resetting mono and anyother beamline stuff
+    #resetting mono and other beamline stuff
     if iex.BL.xrays:
         xrays_reset()
 
@@ -241,6 +237,7 @@ def ARPES_reset(**kwargs):
         "TC1:OUT2:Cntrl":"B",
         "TC1:OUT1:Mode":"Closed Loop"
     }
+    print("resetting ARPES Lakeshore")
     Lakeshore_reset(pv,LS_355_defaults)
 
 ##############################################################################################################
@@ -325,8 +322,6 @@ def ARPES_scan_before_sequence(**kwargs):
     kwargs.setdefault('seq_num',9)
     seq_num=kwargs['seq_num']
 
-    #global BL
-
     scan_ioc = iex.BL.ioc
 
     before_scan_pv,before_scan_proc = userStringSeq_pvs(scan_ioc,seq_num)
@@ -348,7 +343,6 @@ def ARPES_ca_live_sequence(**kwargs):
     """
     """
     kwargs.setdefault('seq_num',7)
-    #global BL
 
     ca_live_sequence_proc = ca_live_sequence(iex.BL.ioc,kwargs['seq_num'],ARPES_detector_list())
     return ca_live_sequence_proc
@@ -370,7 +364,6 @@ def ARPES_scan_after_sequence(**kwargs):
     seq_num = kwargs['seq_num']
     scan_dim = kwargs['scan_dim']
 
-    #global BL
     scan_ioc = iex.BL.ioc
     
     after_scan_pv,after_scan_proc = userStringSeq_pvs(scan_ioc, seq_num)
@@ -411,7 +404,6 @@ def ARPES_detector_triggers_sequence(**kwargs):    # do we need to add 29idb:ca5
     kwargs.setdefault('seq_num',8)
     seq_num=kwargs['seq_num']
 
-    #global BL
     scan_ioc = iex.BL.ioc
     detector_triggers_pv,detector_triggers_proc = userStringSeq_pvs(scan_ioc, seq_num)
        
diff --git a/iexcode/instruments/IEX_endstations.py b/iexcode/instruments/IEX_endstations.py
index 2013e71d57874f6960d786b4a7a7c29bf8a140f2..02c8c14b6e48db5880a5acdc895a56f7285c53c9 100644
--- a/iexcode/instruments/IEX_endstations.py
+++ b/iexcode/instruments/IEX_endstations.py
@@ -6,6 +6,7 @@ from tkinter.messagebox import NO
 from epics import caput
 
 from iexcode.instruments.scanRecord import ScanRecord
+
 import iexcode.instruments.cfg as iex
 
 """
diff --git a/iexcode/instruments/MPA.py b/iexcode/instruments/MPA.py
index f3c6eb38ce8eb011ccb259957e00dd32004a694b..39dd7f36cd1ee05c82b63cdef0ffecd3f514b752 100644
--- a/iexcode/instruments/MPA.py
+++ b/iexcode/instruments/MPA.py
@@ -3,15 +3,16 @@ from os.path import dirname, join
 import socket
 
 from epics import caget, caput
+
+import iexcode.instruments.cfg as iex
+
 from iexcode.instruments.userCalcs import userCalcOut_clear,userStringSeq_clear
 from iexcode.instruments.scalers import Kappa_scaler
 from iexcode.instruments.AD_utilities import AD_ROI_setup
 from iexcode.instruments.scanRecord import ScanRecord
-#from iexcode.instruments.IEX_endstations import *
-#import iexcode.instruments.IEX_endstations as iex
-import iexcode.instruments.cfg as iex
 
-#global BL
+
+
 
 """
 To do, get busy record in the mpa ioc, get user calcs in the mpa ioc
@@ -27,6 +28,7 @@ userCalc_ioc = "29idTest:"
 DAC_pv = '29iddau1:dau1:011:DAC'
 HV_val_pv = "29idKappa:userCalcOut9.A"
 HV_rbv_pv = "29idKappa:userCalcOut10.OVAL"
+
 class MPA:
     """
     class for the MPA detector
@@ -50,7 +52,6 @@ class MPA:
 
         pass
 
-    
 
     def HV_pvs(self):
         """
diff --git a/iexcode/instruments/Motors.py b/iexcode/instruments/Motors.py
index 2882fd9e5d883cb637d3b41d0c0d40ab19dd3861..ade2e463d960e06db8efbd7fbb65dee982480ee2 100644
--- a/iexcode/instruments/Motors.py
+++ b/iexcode/instruments/Motors.py
@@ -3,8 +3,6 @@ from math import floor
 
 from epics import caget, caput
 
-#from iexcode.instruments.IEX_endstations import *
-#import iexcode.instruments.IEX_endstations as iex
 import iexcode.instruments.cfg as iex
 
 from iexcode.instruments.scalers import scaler_cts
@@ -161,9 +159,7 @@ class Motors:
         kwargs.setdefault('relative',False)
         kwargs.setdefault('scan_dim',1)
         kwargs.setdefault('execute',True)
-
-        from iexcode.instruments.IEX_endstations import BL
-        
+       
         #for kappa only
         kwargs.setdefault('cts',0.1)
         kwargs.setdefault('mpa',False)
diff --git a/iexcode/instruments/beamline.py b/iexcode/instruments/beamline.py
index 79819388f1de8fff7529aba494860b3abf01ddda..0883de0f8a2535e6c2cece2fc7742ea71a7e195f 100644
--- a/iexcode/instruments/beamline.py
+++ b/iexcode/instruments/beamline.py
@@ -9,8 +9,6 @@ from time import sleep
 
 from epics import PV
 
-#from iexcode.instruments.IEX_endstations import *
-#import iexcode.instruments.IEX_endstations as iex
 import iexcode.instruments.cfg as iex
 
 ##############################################################################################################
@@ -20,7 +18,6 @@ def log_print(comment=''):
     """
     prints a comment to the logfile
     """
-    #global BL
     try:
         iex.BL.mda.log.print(comment='')
     except:
@@ -30,7 +27,6 @@ def log_update():
     """
     updates the log file with the last scan info
     """
-    #global BL
     try:
         entry_list,pv_list, format_list = iex.BLlog.entries_function()
         iex.BL.mda.log.update(entry_list,pv_list,format_list)
@@ -38,7 +34,6 @@ def log_update():
         print('No logfile written')
 
 def log_name_set(file_name):
-    #global BL
     try: 
         iex.BL.mda.log.name_set(filename=file_name)
     except:
diff --git a/iexcode/instruments/files_and_folders.py b/iexcode/instruments/files_and_folders.py
index e1a12660333fb359014b4e192c25fd8902a0bb49..1f85d5bc8ec66cfe0552bc5e9f744c89c63e4797 100644
--- a/iexcode/instruments/files_and_folders.py
+++ b/iexcode/instruments/files_and_folders.py
@@ -166,7 +166,7 @@ def folder_mda(run,folder,user_name,file_prefix,ioc,verbose=True):
         sleep(0.25) #needed so that it has time to write        
         caput(ioc+"saveData_subDir","/"+user_name+"mda")
 
-    caput(ioc+"saveData_baseName",file_prefix+"_")
+    caput(ioc+"saveData_baseName",file_prefix)
     caput(ioc+"saveData_scanNumber",FileNumber)
 
     print("\nioc set to:", ioc)
diff --git a/iexcode/instruments/xrays.py b/iexcode/instruments/xrays.py
index 62bf9d9533a8688f786a2cd45cabf472ca1b0d3b..b6195ce98d709ffb6fedbd09e4b66624b9968b66 100644
--- a/iexcode/instruments/xrays.py
+++ b/iexcode/instruments/xrays.py
@@ -6,8 +6,7 @@ import numpy as np
 from time import sleep
 
 from epics import caget,caput
-#from iexcode.instruments.IEX_endstations import *
-#import iexcode.instruments.IEX_endstations as iex
+
 import iexcode.instruments.cfg as iex
 
 from iexcode.instruments.IEX_VPU import *
@@ -17,12 +16,10 @@ from iexcode.instruments.shutters import *
 from iexcode.instruments.gate_valves import *
 from iexcode.instruments.diagnostics import *
 from iexcode.instruments.m3r import *
-#from iexcode.instruments.Logfile import *
+from iexcode.instruments.beamline import log_update, endstation_cams_enable
 from iexcode.instruments.utilities import print_warning_message,make_table, take_closest_value
 from iexcode.instruments.current_amplifiers import ca_average
-from iexcode.instruments.beamline import endstation_cams_enable
-
-from iexcode.instruments.MPA import MPA
+from iexcode.instruments.Kappa import mpa
 
 
 ##############################################################################################################
@@ -31,8 +28,12 @@ from iexcode.instruments.MPA import MPA
 def test_function():
     print('hello world')
     
-def xrays_reset():
+def xrays_reset(verbose=True):
+    if verbose:
+        print("resetting the mono limits")
     mono_limits_reset()
+    if verbose:
+        print("resetting beamline encoders")
     xray_motor_encoder_sync()
 
 
@@ -181,7 +182,7 @@ def xrays_log_entries(**kwargs):
     format_list.append("s","s")
 
     try:
-        logfile_update(iex.BL.endstation,iex.BL.ioc,entry_list,pv_list,format_list)
+        log_update(iex.BL.endstation,iex.BL.ioc,entry_list,pv_list,format_list)
     except:
         print("scanlog did not write to file, check for errors.")
         
@@ -444,7 +445,7 @@ def scanXAS(ID_eV,start_stop_step_lists,**kwargs):
 
     #mpa
     if iex.BL.branch == "d" and kwargs["mcp"]:
-        mpa_HV_on()
+        mpa.HV_on()
 
     #Scanning
     if kwargs['execute']:
@@ -458,7 +459,7 @@ def scanXAS(ID_eV,start_stop_step_lists,**kwargs):
 
         if BL.branch == "d": 
             if kwargs["mcp"]: 
-                mpa_HV_off()
+                mpa.HV_off()
             print("WARNING: Mesh"+BL.branch+" is still In")        
 
 def scanXAS_BL(start_stop_step_lists,**kwargs):
@@ -509,7 +510,7 @@ def scanXAS_BL(start_stop_step_lists,**kwargs):
 
     #mpa
     if BL.branch == "d" and kwargs["mcp"]:
-        mpa_HV_on()
+        mpa.HV_on()
         
     #Scanning
     if kwargs['execute']:
@@ -524,7 +525,7 @@ def scanXAS_BL(start_stop_step_lists,**kwargs):
 
         if BL.branch == "d": 
             if kwargs["mcp"]: 
-                mpa_HV_off()
+                mpa.HV_off()
             print("WARNING: Mesh"+BL.branch+" is still In")  
 
 def BL_energy_tables(start_stop_step_lists):