diff --git a/src/drv/CMakeLists.txt b/src/drv/CMakeLists.txt
index 52b2a08e7ede9ad031332553286d1c54649223c5..3cdf506e9093fb6ea6a73de33e7d522497d03804 100644
--- a/src/drv/CMakeLists.txt
+++ b/src/drv/CMakeLists.txt
@@ -4,7 +4,7 @@ add_subdirectory(gpstime/tests)
 add_subdirectory(gpstime/gps_module_utils)
 add_subdirectory(python)
 
-add_library(shmem STATIC shmem.c rfm.c)
+add_library(shmem STATIC shmem.c)
 target_include_directories(shmem PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include)
 target_include_directories(shmem PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/mbuf)
 target_compile_options(shmem PRIVATE -fPIC)
diff --git a/src/drv/rfm.c b/src/drv/rfm.c
deleted file mode 100644
index a2c1b414c54de4e45e666adccda675190e469883..0000000000000000000000000000000000000000
--- a/src/drv/rfm.c
+++ /dev/null
@@ -1,70 +0,0 @@
-///	@file src/drv/rfm.c
-/// 	@brief Routines for finding shared memory locations.
-
-#include <sys/mman.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-
-#include <fcntl.h>
-#include <time.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <signal.h>
-#include <ctype.h>
-
-#include "mbuf/mbuf.h"
-
-#include "findSharedMemory.h"
-
-
-///  Search shared memory device file names in /rtl_mem_*
-///	@param[in] *sys_name	Name of system, required to attach shared memory.
-///	@return			Pointer to start of shared memory segment for this system.
-volatile void *
-findSharedMemory(char *sys_name)
-{
-    int ss_mb = 64;
-    if (!strcmp(sys_name, "ipc")) ss_mb = 32;
-    if (!strcmp(sys_name, "shmipc")) ss_mb = 16;
-
-    return findSharedMemorySize(sys_name, ss_mb);
-}
-
-volatile void *
-findSharedMemorySize(char *sys_name, int size_mb)
-{
-    volatile unsigned char *addr = 0;
-    char *s;
-    int fd;
-    char sys[128];
-    strcpy(sys, sys_name);
-    for(s = sys; *s; s++) *s=tolower(*s);
-
-
-    int size_bytes = size_mb*1024*1024;
-    printf("Making mbuff area %s with size %d\n", sys, size_bytes);
-
-    if ((fd = open ("/dev/mbuf", O_RDWR | O_SYNC)) < 0) {
-        fprintf(stderr, "Couldn't open /dev/mbuf read/write\n");
-        return 0;
-    }
-
-    struct mbuf_request_struct req = {0, {0,}};
-    req.size = size_bytes;
-    strcpy(req.name, sys);
-    if (ioctl (fd, IOCTL_MBUF_ALLOCATE, &req) < req.size) return NULL;
-
-    addr = (volatile unsigned char *)mmap(0, size_bytes, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
-    if (addr == MAP_FAILED) {
-        printf("return was %d\n", errno);
-        perror("mmap");
-        _exit(-1);
-    }
-    printf(" %s mmapped address is %p\n", sys, addr);
-    return addr;
-}
-
diff --git a/src/drv/shmem.c b/src/drv/shmem.c
index a77c05336962fb87674f76c35b751758219a2d50..597618a3d856d9abd469592acae5e019decc262e 100644
--- a/src/drv/shmem.c
+++ b/src/drv/shmem.c
@@ -12,7 +12,7 @@
 #include <unistd.h>
 
 #include "drv/shmem.h"
-#include "mbuf.h"
+#include "../drv/mbuf/mbuf.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -156,7 +156,7 @@ shmem_open_mbuf( const char* sys_name, size_t size_mb )
 
     if ( buffer_len < (int)req_size )
     {
-        fprintf( stderr, "Buffer length was less than the requested size\n" );
+        fprintf( stderr, "Returned buffer length (%d) was less than the requested size (%d)\n", buffer_len, req_size );
         goto cleanup;
     }
     intl->req_size_ = req_size;
@@ -296,7 +296,11 @@ shmem_open( const char* sys_name, size_t size_mb )
         return shmem_open_posix( sys_name + strlen( SHMEM_POSIX_PREFIX ),
                                  size_mb );
     }
+#if DEFAULT_TO_SHMEM_BUFFERS
+    return shmem_open_posix( sys_name, size_mb );
+#else //We default to mbuf buffers for now
     return shmem_open_mbuf( sys_name, size_mb );
+#endif
 }
 
 void
@@ -344,4 +348,4 @@ shmem_wrap_memory_arbitrary( volatile void* data,
 
 #ifdef __cplusplus
 }
-#endif
\ No newline at end of file
+#endif
diff --git a/src/epics/edcu/CMakeLists.txt b/src/epics/edcu/CMakeLists.txt
index 3863c819c1a3ff2a4b02ca46de1e712e230f3885..7ceb0f333a9b5a47a49aaae9034cba5485f5931a 100644
--- a/src/epics/edcu/CMakeLists.txt
+++ b/src/epics/edcu/CMakeLists.txt
@@ -1,12 +1,7 @@
 if (Boost_FOUND)
 
     add_executable(standalone_edc
-            standalone_edcu.cc
-            ${CMAKE_CURRENT_SOURCE_DIR}/../../drv/rfm.c)
-    #target_compile_options(standalone_edc PRIVATE -fsanitize=address)
-    #target_link_libraries(standalone_edc PRIVATE asan)
-    #target_compile_options(standalone_edc PRIVATE
-    #        -fstack-protector -fstack-protector-strong)
+            standalone_edcu.cc)
     target_include_directories(standalone_edc PUBLIC
             "${CMAKE_CURRENT_SOURCE_DIR}/../../include"
             "${CMAKE_CURRENT_SOURCE_DIR}/../../include/drv"
@@ -18,7 +13,8 @@ if (Boost_FOUND)
             pv::simple_pv
             ${Boost_LIBRARIES}
             ${CMAKE_THREAD_LIBS_INIT}
-            driver::gpsclock)
+            driver::gpsclock
+            driver::shmem)
     target_requires_cpp11(standalone_edc PUBLIC)
 
     configure_file(test/epics_test.py ${CMAKE_CURRENT_BINARY_DIR}/epics_test.py COPYONLY)
@@ -33,4 +29,4 @@ if (Boost_FOUND)
 
 else(Boost_FOUND)
     message(WARNING "The standalone_edc will not be build as boost was not found")
-endif (Boost_FOUND)
\ No newline at end of file
+endif (Boost_FOUND)
diff --git a/src/epics/edcu/standalone_edcu.cc b/src/epics/edcu/standalone_edcu.cc
index f453d9cba9644ca458672d399a613d6672aa99f3..d040034169cd4eee290c1df73b4b99e1c070dced 100644
--- a/src/epics/edcu/standalone_edcu.cc
+++ b/src/epics/edcu/standalone_edcu.cc
@@ -47,11 +47,10 @@ of this distribution.
 #include <rapidjson/writer.h>
 #include <rapidjson/stringbuffer.h>
 
-extern "C" {
-#include "findSharedMemory.h"
+#include "drv/shmem.h"
 #include "crc.h"
 #include "param.h"
-}
+
 #include "cadef.h"
 #include "fb.h"
 #include "../../drv/gpstime/gpstime.h"
@@ -309,10 +308,6 @@ int gpstime_index = -1;
 int internal_channel_count = 0;
 
 daqd_c                           daqd_edcu1;
-static struct rmIpcStr*          dipc;
-static struct rmIpcStr*          sipc;
-static char*                     shmDataPtr;
-static struct cdsDaqNetGdsTpNum* shmTpTable;
 static const int                 buf_size = DAQ_DCU_BLOCK_SIZE;
 static const int                 header_size =
     sizeof( struct rmIpcStr ) + sizeof( struct cdsDaqNetGdsTpNum );
@@ -339,7 +334,12 @@ public:
     {
         if ( sync_source != nullptr && strcmp( sync_source, "-" ) != 0 )
         {
-            auto sync_addr = (void*)findSharedMemory( (char*)sync_source );
+            sipc_shm_ptr_ = std::unique_ptr< shmem::shmem >
+                            (
+                              new shmem::shmem(sync_source, DEFAULT_SHMEM_ALLOC_SIZE_MB)
+                            );
+            auto sync_addr = sipc_shm_ptr_->mapping<char>();
+
             sipc_ = (volatile struct rmIpcStr*)( (char*)sync_addr +
                                                  CDS_DAQ_NET_IPC_OFFSET );
         }
@@ -389,6 +389,7 @@ public:
 private:
     int                               cycle_{ 0 };
     std::unique_ptr< GPS::gps_clock > gps_clock_{ nullptr };
+    std::unique_ptr< shmem::shmem >  sipc_shm_ptr_;
     volatile struct rmIpcStr*         sipc_{ nullptr };
 };
 
@@ -1104,7 +1105,7 @@ copyDaqData( char* daqData )
 
 // **************************************************************************
 void
-edcuWriteData( int daqBlockNum, unsigned long cycle_gps_time, int dcuId )
+edcuWriteData( int daqBlockNum, unsigned long cycle_gps_time, int dcuId, shmem::shmem & daq_shmem)
 // **************************************************************************
 {
     char* daqData;
@@ -1119,10 +1120,19 @@ edcuWriteData( int daqBlockNum, unsigned long cycle_gps_time, int dcuId )
     edcuLoadSpecial( gpstime_index, static_cast< int >( daqd_edcu1.gpsTime ) );
 
     buf_size = DAQ_DCU_BLOCK_SIZE;
-    daqData = (char*)( shmDataPtr + ( buf_size * daqBlockNum ) );
+    daqData = (char*)( (daq_shmem.mapping<char>() + CDS_DAQ_NET_DATA_OFFSET)
+                       + ( buf_size * daqBlockNum )
+                     );
+
 
     unsigned int data_size = copyDaqData( daqData );
-    ;
+
+	struct rmIpcStr* dipc = (struct rmIpcStr*)( daq_shmem.mapping<char>() + 
+												CDS_DAQ_NET_IPC_OFFSET ); 
+
+	struct cdsDaqNetGdsTpNum* shmTpTable = (struct cdsDaqNetGdsTpNum*)( daq_shmem.mapping<char>() +
+                                              CDS_DAQ_NET_GDS_TP_TABLE_OFFSET );
+
 
     dipc->dcuId = dcuId;
     dipc->crc = daqFileCrc;
@@ -1137,37 +1147,6 @@ edcuWriteData( int daqBlockNum, unsigned long cycle_gps_time, int dcuId )
     dipc->cycle = daqBlockNum; // Triggers sending of data by mx_stream.
 }
 
-// **************************************************************************
-EdcuClock
-edcuInitialize( const std::string& mbuf_name,
-                const char*        sync_source,
-                int                delay_ms )
-// **************************************************************************
-{
-    void* sync_addr = nullptr;
-    sipc = nullptr;
-
-    const std::string   daq( "_daq" );
-    std::vector< char > shmem_fname;
-    shmem_fname.reserve( mbuf_name.size( ) + daq.size( ) + 1 );
-    std::copy( mbuf_name.begin( ),
-               mbuf_name.end( ),
-               std::back_inserter( shmem_fname ) );
-    std::copy( daq.begin( ), daq.end( ), std::back_inserter( shmem_fname ) );
-    shmem_fname.emplace_back( '\0' );
-
-    // Find start of DAQ shared memory
-    void* dcu_addr = (void*)findSharedMemory( shmem_fname.data( ) );
-
-    // Find the IPC area to communicate with mxstream
-    dipc = (struct rmIpcStr*)( (char*)dcu_addr + CDS_DAQ_NET_IPC_OFFSET );
-    // Find the DAQ data area.
-    shmDataPtr = (char*)( (char*)dcu_addr + CDS_DAQ_NET_DATA_OFFSET );
-    shmTpTable = (struct cdsDaqNetGdsTpNum*)( (char*)dcu_addr +
-                                              CDS_DAQ_NET_GDS_TP_TABLE_OFFSET );
-
-    return EdcuClock( sync_source, delay_ms );
-}
 
 std::pair< std::string, int >
 parse_address( const std::string& str )
@@ -1321,7 +1300,14 @@ main( int argc, char* argv[] )
     // EDCU STUFF
     // ********************************************************************************************************
 
-    auto clock = edcuInitialize( daqsharedmemname, sync_source, delay_ms );
+    std::string model_name(sync_source);
+    std::transform(model_name.begin(), model_name.end(), model_name.begin(), ::tolower);
+	EdcuClock clock( model_name.c_str(), delay_ms );
+    std::string shmmem_name(daqsharedmemname);
+    std::transform(shmmem_name.begin(), shmmem_name.end(), shmmem_name.begin(), ::tolower);
+	shmem::shmem daq_shmem = shmem::shmem(shmmem_name + "_daq", DEFAULT_SHMEM_ALLOC_SIZE_MB);
+
+
     edcuCreateChanList( daqd_edcu1, daqFile, &daqFileCrc, internal_channels );
     std::cout << "The edc dcuid = " << daqd_edcu1.dcuid << "\n";
 
@@ -1386,8 +1372,10 @@ main( int argc, char* argv[] )
         daqd_edcu1.gpsTime = now.sec;
         daqd_edcu1.epicsSync = clock.cycle( );
 
-        edcuWriteData(
-            daqd_edcu1.epicsSync, daqd_edcu1.gpsTime, daqd_edcu1.dcuid );
+        edcuWriteData(daqd_edcu1.epicsSync, 
+                      daqd_edcu1.gpsTime, 
+                      daqd_edcu1.dcuid, 
+                      daq_shmem );
 
         transmit_time = transmit_time + time_step;
 
diff --git a/src/epics/seq/sdf_monitor.c b/src/epics/seq/sdf_monitor.c
index cab7c70b588da56043a098d4ebe373d13825ea39..ea52db5e765b92e00e9043313d1ccef2b516ee53 100644
--- a/src/epics/seq/sdf_monitor.c
+++ b/src/epics/seq/sdf_monitor.c
@@ -1,6 +1,6 @@
-///	@file /src/epics/seq/sdf_monitor.c
-///	@brief Contains required 'main' function to startup EPICS sequencers, along with supporting routines. 
-///<		This code is taken from EPICS example included in the EPICS distribution and modified for LIGO use.
+/// @file /src/epics/seq/sdf_monitor.c
+/// @brief Contains required 'main' function to startup EPICS sequencers, along with supporting routines. 
+///<        This code is taken from EPICS example included in the EPICS distribution and modified for LIGO use.
 
 /********************COPYRIGHT NOTIFICATION**********************************
 This software was developed under a United States Government license
@@ -39,45 +39,46 @@ of this distribution.
 
 #include <daqmap.h>
 #include <param.h>
-// #include "fm10Gen.h"
-#include "findSharedMemory.h"
+#include "drv/shmem.h"
 #include "cadef.h"
 #include "fb.h"
 #include "../../drv/gpstime/gpstime.h"
 #include "util/user/check_file_crc.h"
 
-#define GSDF_MAX_CHANS	30000
-// Gloabl variables		****************************************************************************************
-char timechannel[256];		///< Name of the GPS time channel for timestamping.
-char reloadtimechannel[256];	///< Name of EPICS channel which contains the BURT reload requests.
+#define GSDF_MAX_CHANS  30000
+// Gloabl variables     ****************************************************************************************
+char timechannel[256];      ///< Name of the GPS time channel for timestamping.
+char reloadtimechannel[256];    ///< Name of EPICS channel which contains the BURT reload requests.
 struct timespec t;
 char logfilename[128];
 char logfiledir[128];
 char gsdflogfilename[128];
 char statelogfilename[128];
 unsigned char naughtyList[GSDF_MAX_CHANS][64];
+shmem_handle g_dcu_shm_handle = NULL;
 
-// Function prototypes		****************************************************************************************
+
+// Function prototypes      ****************************************************************************************
 void getSdfTime(char *);
 void logFileEntry(char *);
 
 unsigned long daqFileCrc;
 typedef struct gsdf_c {
-	int num_chans;
-	int con_chans;
-	int val_events;
-	int con_events;
-	double channel_value[GSDF_MAX_CHANS];
-	char channel_name[GSDF_MAX_CHANS][64];
-	char channel_string[GSDF_MAX_CHANS][64];
-	int channel_status[GSDF_MAX_CHANS];
-	int channel_type[GSDF_MAX_CHANS];
-	long gpsTime;
-	long epicsSync;
+    int num_chans;
+    int con_chans;
+    int val_events;
+    int con_events;
+    double channel_value[GSDF_MAX_CHANS];
+    char channel_name[GSDF_MAX_CHANS][64];
+    char channel_string[GSDF_MAX_CHANS][64];
+    int channel_status[GSDF_MAX_CHANS];
+    int channel_type[GSDF_MAX_CHANS];
+    long gpsTime;
+    long epicsSync;
 } gsdf_c;
 
-#define MY_DBL_TYPE	0
-#define MY_STR_TYPE	1
+#define MY_DBL_TYPE 0
+#define MY_STR_TYPE 1
 
 gsdf_c gsdf;
 static struct rmIpcStr *dipc;
@@ -129,11 +130,11 @@ void waitGpsTrigger(unsigned long gpssec, int cycle)
 {
 unsigned long gpsSec, gpsuSec;
 int gpsx;
-	do{
-		usleep(1000);
-		gpsSec = symm_gps_time(&gpsuSec, &gpsx);
-		gpsuSec /= 1000;
-	}while(gpsSec < gpssec || gpsuSec < timemarks[cycle]); 
+    do{
+        usleep(1000);
+        gpsSec = symm_gps_time(&gpsuSec, &gpsx);
+        gpsuSec /= 1000;
+    }while(gpsSec < gpssec || gpsuSec < timemarks[cycle]); 
 }
 
 // **************************************************************************
@@ -150,28 +151,28 @@ int symm_gps_ok() {
 unsigned long symm_initialize()
 // **************************************************************************
 {
-	symmetricom_fd =  open ("/dev/gpstime", O_RDWR | O_SYNC);
-	if (symmetricom_fd < 0) {
-	       perror("/dev/gpstime");
-	       exit(1);
-	}
-	unsigned long gpsSec, gpsuSec;
-	int gpsx;
-	int gpssync;
-	gpssync =  symm_gps_ok();
-	gpsSec = symm_gps_time(&gpsuSec, &gpsx);
-	printf("GPS SYNC = %d %d\n",gpssync,gpsx);
-	printf("GPS SEC = %ld  USEC = %ld  OTHER = %d\n",gpsSec,gpsuSec,gpsx);
-	// Set system to start 2 sec from now.
-	gpsSec += 2;
-	return(gpsSec);
+    symmetricom_fd =  open ("/dev/gpstime", O_RDWR | O_SYNC);
+    if (symmetricom_fd < 0) {
+           perror("/dev/gpstime");
+           exit(1);
+    }
+    unsigned long gpsSec, gpsuSec;
+    int gpsx;
+    int gpssync;
+    gpssync =  symm_gps_ok();
+    gpsSec = symm_gps_time(&gpsuSec, &gpsx);
+    printf("GPS SYNC = %d %d\n",gpssync,gpsx);
+    printf("GPS SEC = %ld  USEC = %ld  OTHER = %d\n",gpsSec,gpsuSec,gpsx);
+    // Set system to start 2 sec from now.
+    gpsSec += 2;
+    return(gpsSec);
 }
 
 // **************************************************************************
 void connectCallback(struct connection_handler_args args) {
 // **************************************************************************
         unsigned long chnum = (unsigned long)ca_puser(args.chid);
-	gsdf.channel_status[chnum] = args.op == CA_OP_CONN_UP? 0: 0xbad;
+    gsdf.channel_status[chnum] = args.op == CA_OP_CONN_UP? 0: 0xbad;
         if (args.op == CA_OP_CONN_UP) gsdf.con_chans++; else gsdf.con_chans--;
         gsdf.con_events++;
 }
@@ -184,29 +185,29 @@ char timestring[256];
 FILE *statelog;
 char state[64];
 char newfile[256];
- 	gsdf.val_events++;
+    gsdf.val_events++;
         if (args.status != ECA_NORMAL) {
-        	return;
+            return;
         }
         if (args.type == DBR_FLOAT) {
-        	float val = *((float *)args.dbr);
+            float val = *((float *)args.dbr);
                 gsdf.channel_value[(unsigned long)args.usr] = val;
         } else if (args.type == DBR_DOUBLE) {
-        	double val1 = *((double *)args.dbr);
+            double val1 = *((double *)args.dbr);
                 gsdf.channel_value[(unsigned long)args.usr] = val1;
-		// printf("Channel %s changed to %lf\n",gsdf.channel_name[(unsigned long)args.usr],val1);
+        // printf("Channel %s changed to %lf\n",gsdf.channel_name[(unsigned long)args.usr],val1);
         }else{
-		strcpy(gsdf.channel_string[(unsigned long)args.usr],(char *)args.dbr);
-		getSdfTime2(timestring, 256);
-		printf("Time is %s\n",timestring);
-		printf("Channel %s has value %s\n",gsdf.channel_name[(unsigned long)args.usr],gsdf.channel_string[(unsigned long)args.usr]);
-		statelog = fopen(statelogfilename,"a");
-		fprintf(statelog,"%s %s\n",gsdf.channel_string[(unsigned long)args.usr],timestring);
-		fclose(statelog);
-		sprintf(newfile,"%sdata/%s",logfiledir,timestring);
-		printf("Ready to write %s\n",newfile);
-		gsdfWriteData(newfile);
-	}
+        strcpy(gsdf.channel_string[(unsigned long)args.usr],(char *)args.dbr);
+        getSdfTime2(timestring, 256);
+        printf("Time is %s\n",timestring);
+        printf("Channel %s has value %s\n",gsdf.channel_name[(unsigned long)args.usr],gsdf.channel_string[(unsigned long)args.usr]);
+        statelog = fopen(statelogfilename,"a");
+        fprintf(statelog,"%s %s\n",gsdf.channel_string[(unsigned long)args.usr],timestring);
+        fclose(statelog);
+        sprintf(newfile,"%sdata/%s",logfiledir,timestring);
+        printf("Ready to write %s\n",newfile);
+        gsdfWriteData(newfile);
+    }
 }
 
 // **************************************************************************
@@ -230,29 +231,29 @@ dbAddr daddr;
 
 
 
-	for(ii=0;ii<40;ii++)
+    for(ii=0;ii<40;ii++)
         {
-	 sprintf(s, "%s_%s_STAT%d", pref,"SDF_SP", ii);
-	 status = dbNameToAddr(s,&saddr);
-	 status = dbPutField(&saddr,DBR_UCHAR,clearString,16);
+     sprintf(s, "%s_%s_STAT%d", pref,"SDF_SP", ii);
+     status = dbNameToAddr(s,&saddr);
+     status = dbPutField(&saddr,DBR_UCHAR,clearString,16);
 
-	 sprintf(s1, "%s_%s_STAT%d_BURT", pref,"SDF_SP", ii);
-	 status = dbNameToAddr(s1,&baddr);
-	 status = dbPutField(&baddr,DBR_UCHAR,clearString,flength);
+     sprintf(s1, "%s_%s_STAT%d_BURT", pref,"SDF_SP", ii);
+     status = dbNameToAddr(s1,&baddr);
+     status = dbPutField(&baddr,DBR_UCHAR,clearString,flength);
 
-	 sprintf(s2, "%s_%s_STAT%d_LIVE", pref,"SDF_SP", ii);
-	 status = dbNameToAddr(s2,&maddr);
-	 status = dbPutField(&maddr,DBR_UCHAR,clearString,flength);
+     sprintf(s2, "%s_%s_STAT%d_LIVE", pref,"SDF_SP", ii);
+     status = dbNameToAddr(s2,&maddr);
+     status = dbPutField(&maddr,DBR_UCHAR,clearString,flength);
 
-	 sprintf(s3, "%s_%s_STAT%d_TIME", pref,"SDF_SP", ii);
-	 status = dbNameToAddr(s3,&taddr);
-	 status = dbPutField(&taddr,DBR_UCHAR,clearString,flength);
+     sprintf(s3, "%s_%s_STAT%d_TIME", pref,"SDF_SP", ii);
+     status = dbNameToAddr(s3,&taddr);
+     status = dbPutField(&taddr,DBR_UCHAR,clearString,flength);
 
-	  sprintf(s4, "%s_%s_STAT%d_DIFF", pref,"SDF_SP", ii);
-	  status = dbNameToAddr(s4,&daddr);
-	  status = dbPutField(&daddr,DBR_UCHAR,clearString,flength);
+      sprintf(s4, "%s_%s_STAT%d_DIFF", pref,"SDF_SP", ii);
+      status = dbNameToAddr(s4,&daddr);
+      status = dbPutField(&daddr,DBR_UCHAR,clearString,flength);
 
-	 }
+     }
 
 
 }
@@ -264,15 +265,15 @@ int gsdfFindUnconnChannels()
 int ii;
 int dcc = 0;
 
-	for (ii=0;ii<gsdf.num_chans;ii++)
-	{
-		if(gsdf.channel_status[ii] != 0)
-		{
-			sprintf(naughtyList[dcc],"%s",gsdf.channel_name[ii]);
-			dcc ++;
-		}
-	}
-	return(dcc);
+    for (ii=0;ii<gsdf.num_chans;ii++)
+    {
+        if(gsdf.channel_status[ii] != 0)
+        {
+            sprintf(naughtyList[dcc],"%s",gsdf.channel_name[ii]);
+            dcc ++;
+        }
+    }
+    return(dcc);
 }
 // **************************************************************************
 int gsdfReportUnconnChannels(char *pref, int dc, int offset)
@@ -294,53 +295,53 @@ int lineNum = 0;
 int erucError = 0;
 
 
-	myindex = offset * 40;
-	if(myindex > dc) {
-		myindex = 0;
-		erucError = -1;
-	}
-	rc = myindex + 40;
-	if(rc > dc) rc = dc;
-	// printf("Naught =  %d to %d\n",myindex,rc);
-	// printf("In error listing \n");
-	for (ii=myindex;ii<rc;ii++)
-	{
-		sprintf(s, "%s_%s_STAT%d", pref,"SDF_SP", (ii - myindex));
-		status = dbNameToAddr(s,&saddr);
-		if(status) 
-		{
-			printf("Can't connect to %s\n",s);
-		} else {
-			sprintf(tmpstr,"%s",naughtyList[ii]);
-			status = dbPutField(&saddr,DBR_UCHAR,tmpstr,flength);
-			numDisp ++;
-		}
-		sprintf(sl, "%s_SDF_LINE_%d", pref, (ii - myindex));
-		status = dbNameToAddr(sl,&laddr);
-		if(status) 
-		{
-			printf("Can't connect to %s\n",s);
-		} else {
-			lineNum = ii + 1;
-			status = dbPutField(&laddr,DBR_LONG,&lineNum,1);
-		}
-	}
-	// Clear out remaining reporting channels.
-	sprintf(tmpstr,"%s","  ");
-	for (ii=numDisp;ii<40;ii++) {
-		sprintf(s, "%s_%s_STAT%d", pref,"SDF_SP", ii);
-		status = dbNameToAddr(s,&saddr);
-		status = dbPutField(&saddr,DBR_UCHAR,tmpstr,flength);
-		sprintf(sl, "%s_SDF_LINE_%d", pref, (ii - myindex));
-		status = dbNameToAddr(sl,&laddr);
-		lineNum = ii + 1;
-		status = dbPutField(&laddr,DBR_LONG,&lineNum,1);
-	}
-	 char speStat[256]; sprintf(speStat, "%s_%s", pref, "SDF_TABLE_ENTRIES");             // Setpoint diff counter
-	 status = dbNameToAddr(speStat,&sperroraddr);                    // Get Address
-	 status = dbPutField(&sperroraddr,DBR_LONG,&dc,1);          // Init to zero.
-
-	return(erucError);
+    myindex = offset * 40;
+    if(myindex > dc) {
+        myindex = 0;
+        erucError = -1;
+    }
+    rc = myindex + 40;
+    if(rc > dc) rc = dc;
+    // printf("Naught =  %d to %d\n",myindex,rc);
+    // printf("In error listing \n");
+    for (ii=myindex;ii<rc;ii++)
+    {
+        sprintf(s, "%s_%s_STAT%d", pref,"SDF_SP", (ii - myindex));
+        status = dbNameToAddr(s,&saddr);
+        if(status) 
+        {
+            printf("Can't connect to %s\n",s);
+        } else {
+            sprintf(tmpstr,"%s",naughtyList[ii]);
+            status = dbPutField(&saddr,DBR_UCHAR,tmpstr,flength);
+            numDisp ++;
+        }
+        sprintf(sl, "%s_SDF_LINE_%d", pref, (ii - myindex));
+        status = dbNameToAddr(sl,&laddr);
+        if(status) 
+        {
+            printf("Can't connect to %s\n",s);
+        } else {
+            lineNum = ii + 1;
+            status = dbPutField(&laddr,DBR_LONG,&lineNum,1);
+        }
+    }
+    // Clear out remaining reporting channels.
+    sprintf(tmpstr,"%s","  ");
+    for (ii=numDisp;ii<40;ii++) {
+        sprintf(s, "%s_%s_STAT%d", pref,"SDF_SP", ii);
+        status = dbNameToAddr(s,&saddr);
+        status = dbPutField(&saddr,DBR_UCHAR,tmpstr,flength);
+        sprintf(sl, "%s_SDF_LINE_%d", pref, (ii - myindex));
+        status = dbNameToAddr(sl,&laddr);
+        lineNum = ii + 1;
+        status = dbPutField(&laddr,DBR_LONG,&lineNum,1);
+    }
+     char speStat[256]; sprintf(speStat, "%s_%s", pref, "SDF_TABLE_ENTRIES");             // Setpoint diff counter
+     status = dbNameToAddr(speStat,&sperroraddr);                    // Get Address
+     status = dbPutField(&sperroraddr,DBR_LONG,&dc,1);          // Init to zero.
+
+    return(erucError);
 }
 
 // **************************************************************************
@@ -355,61 +356,61 @@ char errMsg[64];
 char line[128];
 char *newname;
 
-	// sprintf(daqfile, "%s%s", fdir, "EDCU.ini");
-	gsdf.num_chans = 0;
-	daqfileptr = fopen(daqfilename,"r");
-	if(daqfileptr == NULL) {
-		sprintf(errMsg,"DAQ FILE ERROR: FILE %s DOES NOT EXIST\n",daqfilename);
-	        logFileEntry(errMsg);
+    // sprintf(daqfile, "%s%s", fdir, "EDCU.ini");
+    gsdf.num_chans = 0;
+    daqfileptr = fopen(daqfilename,"r");
+    if(daqfileptr == NULL) {
+        sprintf(errMsg,"DAQ FILE ERROR: FILE %s DOES NOT EXIST\n",daqfilename);
+            logFileEntry(errMsg);
+        }
+    gsdflog = fopen(gsdflogfilename,"w");
+    if(daqfileptr == NULL) {
+        sprintf(errMsg,"DAQ FILE ERROR: FILE %s DOES NOT EXIST\n",gsdflogfilename);
+            logFileEntry(errMsg);
+        }
+    while(fgets(line,sizeof line,daqfileptr) != NULL) {
+        fprintf(gsdflog,"%s",line);
+        status = strlen(line);
+        if(strncmp(line,"[",1) == 0 && status > 0) {
+            if(strstr(line,"string") != NULL) {
+                printf("Found string type %s \n",line);
+                gsdf.channel_type[gsdf.num_chans] = MY_STR_TYPE;
+            } else {
+                gsdf.channel_type[gsdf.num_chans] = MY_DBL_TYPE;
+            }
+            newname = strtok(line,"]");
+            // printf("status = %d New name = %s and %s\n",status,line,newname);
+            newname = strtok(line,"[");
+            // printf("status = %d New name = %s and %s\n",status,line,newname);
+            if(strcmp(newname,"default") == 0) {
+                printf("DEFAULT channel = %s\n", newname);
+            } else {
+                // printf("NEW channel = %s\n", newname);
+                sprintf(gsdf.channel_name[gsdf.num_chans],"%s",newname);
+                gsdf.num_chans ++;
+            }
         }
-	gsdflog = fopen(gsdflogfilename,"w");
-	if(daqfileptr == NULL) {
-		sprintf(errMsg,"DAQ FILE ERROR: FILE %s DOES NOT EXIST\n",gsdflogfilename);
-	        logFileEntry(errMsg);
+    }
+    fclose(daqfileptr);
+    fclose(gsdflog);
+
+    xferInfo.crcLength = 4 * gsdf.num_chans;
+    printf("CRC data length = %d\n",xferInfo.crcLength);
+
+         chid chid1;
+    ca_context_create(ca_enable_preemptive_callback);
+        for (i = 0; i < gsdf.num_chans; i++) {
+         status = ca_create_channel(gsdf.channel_name[i], connectCallback, (void *)i, 0, &chid1);
+         if(gsdf.channel_type[i] == MY_STR_TYPE) {
+        printf("Found the string channel = %s\n",gsdf.channel_name[i]);
+            status = ca_create_subscription(DBR_STRING, 0, chid1, DBE_VALUE,
+                 subscriptionHandler, (void *)i, 0);
+         } else {
+            status = ca_create_subscription(DBR_DOUBLE, 0, chid1, DBE_VALUE,
+                 subscriptionHandler, (void *)i, 0);
         }
-	while(fgets(line,sizeof line,daqfileptr) != NULL) {
-		fprintf(gsdflog,"%s",line);
-		status = strlen(line);
-		if(strncmp(line,"[",1) == 0 && status > 0) {
-			if(strstr(line,"string") != NULL) {
-				printf("Found string type %s \n",line);
-				gsdf.channel_type[gsdf.num_chans] = MY_STR_TYPE;
-			} else {
-				gsdf.channel_type[gsdf.num_chans] = MY_DBL_TYPE;
-			}
-			newname = strtok(line,"]");
-			// printf("status = %d New name = %s and %s\n",status,line,newname);
-			newname = strtok(line,"[");
-			// printf("status = %d New name = %s and %s\n",status,line,newname);
-			if(strcmp(newname,"default") == 0) {
-				printf("DEFAULT channel = %s\n", newname);
-			} else {
-				// printf("NEW channel = %s\n", newname);
-				sprintf(gsdf.channel_name[gsdf.num_chans],"%s",newname);
-				gsdf.num_chans ++;
-			}
-		}
-	}
-	fclose(daqfileptr);
-	fclose(gsdflog);
-
-	xferInfo.crcLength = 4 * gsdf.num_chans;
-	printf("CRC data length = %d\n",xferInfo.crcLength);
-
-	     chid chid1;
-	ca_context_create(ca_enable_preemptive_callback);
-     	for (i = 0; i < gsdf.num_chans; i++) {
-	     status = ca_create_channel(gsdf.channel_name[i], connectCallback, (void *)i, 0, &chid1);
-	     if(gsdf.channel_type[i] == MY_STR_TYPE) {
-		printf("Found the string channel = %s\n",gsdf.channel_name[i]);
-	     	status = ca_create_subscription(DBR_STRING, 0, chid1, DBE_VALUE,
-			     subscriptionHandler, (void *)i, 0);
-	     } else {
-	     	status = ca_create_subscription(DBR_DOUBLE, 0, chid1, DBE_VALUE,
-			     subscriptionHandler, (void *)i, 0);
-		}
-	}
-	timeIndex = 0;
+    }
+    timeIndex = 0;
 }
 
 // **************************************************************************
@@ -419,15 +420,15 @@ void gsdfWriteData(char *filename)
 int ii;
 FILE *log;
 
-		
-	log = fopen(filename,"w");
-	for(ii=0;ii<gsdf.num_chans;ii++) {
-		if(gsdf.channel_type[ii] == MY_STR_TYPE)
-			fprintf(log,"%s %s STRING\n",gsdf.channel_name[ii],gsdf.channel_string[ii]);
-		else
-			fprintf(log,"%s %.15e DOUBLE\n",gsdf.channel_name[ii],gsdf.channel_value[ii]);
-	}
-	fclose(log);
+        
+    log = fopen(filename,"w");
+    for(ii=0;ii<gsdf.num_chans;ii++) {
+        if(gsdf.channel_type[ii] == MY_STR_TYPE)
+            fprintf(log,"%s %s STRING\n",gsdf.channel_name[ii],gsdf.channel_string[ii]);
+        else
+            fprintf(log,"%s %.15e DOUBLE\n",gsdf.channel_name[ii],gsdf.channel_value[ii]);
+    }
+    fclose(log);
 }
 
 // **************************************************************************
@@ -435,218 +436,230 @@ void gsdfInitialize(char *shmem_fname)
 // **************************************************************************
 {
 
-	// Find start of DAQ shared memory
-	void *dcu_addr = findSharedMemory(shmem_fname);
-	// Find the IPC area to communicate with mxstream
-	dipc = (struct rmIpcStr *)((char *)dcu_addr + CDS_DAQ_NET_IPC_OFFSET);
-	// Find the DAQ data area.
-        shmDataPtr = (char *)((char *)dcu_addr + CDS_DAQ_NET_DATA_OFFSET);
+    // Find start of DAQ shared memory
+    g_dcu_shm_handle = shmem_open(shmem_fname, DEFAULT_SHMEM_ALLOC_SIZE_MB); //<model>_daq
+    volatile void * dcu_addr = shmem_mapping(g_dcu_shm_handle);
+
+    // Find the IPC area to communicate with mxstream
+    dipc = (struct rmIpcStr *)((char *)dcu_addr + CDS_DAQ_NET_IPC_OFFSET);
+    // Find the DAQ data area.
+    shmDataPtr = (char *)((char *)dcu_addr + CDS_DAQ_NET_DATA_OFFSET);
+}
+
+void gsdfDeinitialize()
+{
+    shmem_close(g_dcu_shm_handle);
 }
 
 
 /// Routine for reading GPS time from model EPICS record.
-///	@param[out] timestring 	Pointer to char string in which GPS time is to be written.
+/// @param[out] timestring  Pointer to char string in which GPS time is to be written.
 void getSdfTime(char *timestring)
 {
 
-	dbAddr paddr;
-	long ropts = 0;
-	long nvals = 1;
-	long status;
+    dbAddr paddr;
+    long ropts = 0;
+    long nvals = 1;
+    long status;
 
-	status = dbNameToAddr(timechannel,&paddr);
-	status = dbGetField(&paddr,DBR_STRING,timestring,&ropts,&nvals,NULL);
+    status = dbNameToAddr(timechannel,&paddr);
+    status = dbGetField(&paddr,DBR_STRING,timestring,&ropts,&nvals,NULL);
 }
 
 /// Routine for logging messages to ioc.log file.
-/// 	@param[in] message Ptr to string containing message to be logged.
+///     @param[in] message Ptr to string containing message to be logged.
 void logFileEntry(char *message)
 {
-	FILE *log;
-	char timestring[256];
-	long status;
-	dbAddr paddr;
-
-	getSdfTime(timestring);
-	log = fopen(logfilename,"a");
-	if(log == NULL) {
-		status = dbNameToAddr(reloadtimechannel,&paddr);
-		status = dbPutField(&paddr,DBR_STRING,"ERR - NO LOG FILE FOUND",1);
-	} else {
-		fprintf(log,"%s\n%s\n",timestring,message);
-		fprintf(log,"***************************************************\n");
-		fclose(log);
-	}
+    FILE *log;
+    char timestring[256];
+    long status;
+    dbAddr paddr;
+
+    getSdfTime(timestring);
+    log = fopen(logfilename,"a");
+    if(log == NULL) {
+        status = dbNameToAddr(reloadtimechannel,&paddr);
+        status = dbPutField(&paddr,DBR_STRING,"ERR - NO LOG FILE FOUND",1);
+    } else {
+        fprintf(log,"%s\n%s\n",timestring,message);
+        fprintf(log,"***************************************************\n");
+        fclose(log);
+    }
 
 }
 
 /// Called on EPICS startup; This is generic EPICS provided function, modified for LIGO use.
 int main(int argc,char *argv[])
 {
-	// Addresses for SDF EPICS records.
-	// Initialize request for file load on startup.
-	long status;
-	int request;
-	int daqTrigger;
-	long ropts = 0;
-	long nvals = 1;
-	int rdstatus = 0;
-	char timestring[128];
-	int ii;
-	int fivesectimer = 0;
-	long coeffFileCrc;
-	char modfilemsg[] = "Modified File Detected ";
-	struct stat st = {0};
-	char filemsg[128];
-	char logmsg[256];
-	unsigned int pageNum = 0;
-	unsigned int dataDump = 0;
+    // Addresses for SDF EPICS records.
+    // Initialize request for file load on startup.
+    long status;
+    int request;
+    int daqTrigger;
+    long ropts = 0;
+    long nvals = 1;
+    int rdstatus = 0;
+    char timestring[128];
+    int ii;
+    int fivesectimer = 0;
+    long coeffFileCrc;
+    char modfilemsg[] = "Modified File Detected ";
+    struct stat st = {0};
+    char filemsg[128];
+    char logmsg[256];
+    unsigned int pageNum = 0;
+    unsigned int dataDump = 0;
 
 printf("Entering main\n");
     if(argc>=2) {
         iocsh(argv[1]);
-	printf("Executing post script commands\n");
-	// Get environment variables from startup command to formulate EPICS record names.
-	char *pref = getenv("PREFIX");
-	char *modelname =  getenv("SDF_MODEL");
-	char daqsharedmemname[64];
-	sprintf(daqsharedmemname, "%s%s", modelname, "_daq");
-	char *targetdir =  getenv("TARGET_DIR");
-	char *daqFile =  getenv("DAQ_FILE");
-	char *daqDir =  getenv("DAQ_DIR");
-	char *coeffFile =  getenv("COEFF_FILE");
-	char *logdir = getenv("LOG_DIR");
-	if(stat(logdir, &st) == -1) mkdir(logdir,0777);
-	// strcat(sdf,"_safe");
-	printf("My prefix is %s\n",pref);
-	sprintf(logfilename, "%s%s", logdir, "/ioc.log");
-	sprintf(logfiledir,"%s%s",logdir,"/");
-	printf("LOG FILE = %s\n",logfilename);
+    printf("Executing post script commands\n");
+    // Get environment variables from startup command to formulate EPICS record names.
+    char *pref = getenv("PREFIX");
+    char *modelname =  getenv("SDF_MODEL");
+    char daqsharedmemname[64];
+    sprintf(daqsharedmemname, "%s%s", modelname, "_daq");
+    char *targetdir =  getenv("TARGET_DIR");
+    char *daqFile =  getenv("DAQ_FILE");
+    char *daqDir =  getenv("DAQ_DIR");
+    char *coeffFile =  getenv("COEFF_FILE");
+    char *logdir = getenv("LOG_DIR");
+    if(stat(logdir, &st) == -1) mkdir(logdir,0777);
+    // strcat(sdf,"_safe");
+    printf("My prefix is %s\n",pref);
+    sprintf(logfilename, "%s%s", logdir, "/ioc.log");
+    sprintf(logfiledir,"%s%s",logdir,"/");
+    printf("LOG FILE = %s\n",logfilename);
 sleep(2);
-	// **********************************************
-	//
-	dbAddr eccaddr;
-	char eccname[256]; sprintf(eccname, "%s_%s", pref, "GSDF_CHAN_CONN");			// Number of setting channels in EPICS db
-	status = dbNameToAddr(eccname,&eccaddr);
-
-	dbAddr chcntaddr;
-	// char chcntname[256]; sprintf(chcntname, "%s", "X1:DAQ-FEC_54_EPICS_CHAN_CNT");	// Request to monitor all channels.
-	char chcntname[256]; sprintf(chcntname, "%s_%s", pref, "GSDF_CHAN_CNT");	// Request to monitor all channels.
-	status = dbNameToAddr(chcntname,&chcntaddr);		// Get Address.
-
-	dbAddr chnotfoundaddr;
-	char cnfname[256]; sprintf(cnfname, "%s_%s", pref, "GSDF_CHAN_NOCON");		// Number of channels not found.
-	status = dbNameToAddr(cnfname,&chnotfoundaddr);
-
-	dbAddr daqbyteaddr;
-	char daqbytename[256]; sprintf(daqbytename, "%s_%s", pref, "DAQ_BYTE_COUNT");	// Request to monitor all channels.
-	status = dbNameToAddr(daqbytename,&daqbyteaddr);		// Get Address.
-
-	dbAddr daqmsgaddr;
-	char moddaqfilemsg[256]; sprintf(moddaqfilemsg, "%s_%s", pref, "MSGDAQ");	// Record to write if DAQ file changed.
-	status = dbNameToAddr(moddaqfilemsg,&daqmsgaddr);
-
-	sprintf(timechannel,"%s_%s", pref, "TIME_STRING");
-	// printf("timechannel = %s\n",timechannel);
-	
-	dbAddr reloadtimeaddr;
-	sprintf(reloadtimechannel,"%s_%s", pref, "MSGDAQ");			// Time of last BURT reload
-	status = dbNameToAddr(reloadtimechannel,&reloadtimeaddr);
-
-	getSdfTime(timestring);
-	status = dbPutField(&reloadtimeaddr,DBR_STRING,timestring,1);
-
-	dbAddr gpstimedisplayaddr;
-	char gpstimedisplayname[256]; sprintf(gpstimedisplayname, "%s_%s", pref, "TIME_DIAG");	// SDF Save command.
-	status = dbNameToAddr(gpstimedisplayname,&gpstimedisplayaddr);		// Get Address.
-
-	dbAddr pagereqaddr;
-	char pagereqname[256]; sprintf(pagereqname, "%s_%s", pref, "SDF_PAGE");	// SDF Save command.
-	status = dbNameToAddr(pagereqname,&pagereqaddr);		// Get Address.
-
-	dbAddr datadumpaddr;
-	char datadumpname[256]; sprintf(datadumpname, "%s_%s", pref, "GSDF_DUMP_DATA");	// SDF Save command.
-	status = dbNameToAddr(datadumpname,&datadumpaddr);		// Get Address.
+    // **********************************************
+    //
+    dbAddr eccaddr;
+    char eccname[256]; sprintf(eccname, "%s_%s", pref, "GSDF_CHAN_CONN");           // Number of setting channels in EPICS db
+    status = dbNameToAddr(eccname,&eccaddr);
+
+    dbAddr chcntaddr;
+    // char chcntname[256]; sprintf(chcntname, "%s", "X1:DAQ-FEC_54_EPICS_CHAN_CNT");   // Request to monitor all channels.
+    char chcntname[256]; sprintf(chcntname, "%s_%s", pref, "GSDF_CHAN_CNT");    // Request to monitor all channels.
+    status = dbNameToAddr(chcntname,&chcntaddr);        // Get Address.
+
+    dbAddr chnotfoundaddr;
+    char cnfname[256]; sprintf(cnfname, "%s_%s", pref, "GSDF_CHAN_NOCON");      // Number of channels not found.
+    status = dbNameToAddr(cnfname,&chnotfoundaddr);
+
+    dbAddr daqbyteaddr;
+    char daqbytename[256]; sprintf(daqbytename, "%s_%s", pref, "DAQ_BYTE_COUNT");   // Request to monitor all channels.
+    status = dbNameToAddr(daqbytename,&daqbyteaddr);        // Get Address.
+
+    dbAddr daqmsgaddr;
+    char moddaqfilemsg[256]; sprintf(moddaqfilemsg, "%s_%s", pref, "MSGDAQ");   // Record to write if DAQ file changed.
+    status = dbNameToAddr(moddaqfilemsg,&daqmsgaddr);
+
+    sprintf(timechannel,"%s_%s", pref, "TIME_STRING");
+    // printf("timechannel = %s\n",timechannel);
+    
+    dbAddr reloadtimeaddr;
+    sprintf(reloadtimechannel,"%s_%s", pref, "MSGDAQ");         // Time of last BURT reload
+    status = dbNameToAddr(reloadtimechannel,&reloadtimeaddr);
+
+    getSdfTime(timestring);
+    status = dbPutField(&reloadtimeaddr,DBR_STRING,timestring,1);
+
+    dbAddr gpstimedisplayaddr;
+    char gpstimedisplayname[256]; sprintf(gpstimedisplayname, "%s_%s", pref, "TIME_DIAG");  // SDF Save command.
+    status = dbNameToAddr(gpstimedisplayname,&gpstimedisplayaddr);      // Get Address.
+
+    dbAddr pagereqaddr;
+    char pagereqname[256]; sprintf(pagereqname, "%s_%s", pref, "SDF_PAGE"); // SDF Save command.
+    status = dbNameToAddr(pagereqname,&pagereqaddr);        // Get Address.
+
+    dbAddr datadumpaddr;
+    char datadumpname[256]; sprintf(datadumpname, "%s_%s", pref, "GSDF_DUMP_DATA"); // SDF Save command.
+    status = dbNameToAddr(datadumpname,&datadumpaddr);      // Get Address.
 
 // EDCU STUFF ********************************************************************************************************
-	
-	sprintf(gsdflogfilename, "%s%s", logdir, "/gsdf.log");
-	sprintf(statelogfilename, "%s%s", logdir, "/state.log");
-printf("Going to initialize\n");
-	gsdfInitialize(daqsharedmemname);
-	gsdfCreateChanList(daqFile);
-	status = dbPutField(&chcntaddr,DBR_LONG,&gsdf.num_chans,1);
-	int datarate = gsdf.num_chans * 4 / 1000;
-	status = dbPutField(&daqbyteaddr,DBR_LONG,&datarate,1);
+    
+    sprintf(gsdflogfilename, "%s%s", logdir, "/gsdf.log");
+    sprintf(statelogfilename, "%s%s", logdir, "/state.log");
+    printf("Going to initialize\n");
+    gsdfInitialize(daqsharedmemname);
+    gsdfCreateChanList(daqFile);
+    status = dbPutField(&chcntaddr,DBR_LONG,&gsdf.num_chans,1);
+    int datarate = gsdf.num_chans * 4 / 1000;
+    status = dbPutField(&daqbyteaddr,DBR_LONG,&datarate,1);
 
 // Start SPECT
-	gsdf.gpsTime = symm_initialize();
-	gsdf.epicsSync = 0;
+    gsdf.gpsTime = symm_initialize();
+    gsdf.epicsSync = 0;
 
 // End SPECT
-	for (ii=0;ii<GSDF_MAX_CHANS;ii++) gsdf.channel_status[ii] = 0xbad;
-
-	int dropout = 0;
-	int numDC = 0;
-	int cycle = 0;
-	int numReport = 0;
-
-	// Initialize DAQ and COEFF file CRC checksums for later compares.
-	daqFileCrc = checkFileCrc(daqFile);
-	printf("DAQ file CRC = %u \n",daqFileCrc);  
-	coeffFileCrc = checkFileCrc(coeffFile);
-	sprintf(logmsg,"%s\n%s = %u\n%s = %d","GSDF code restart","File CRC",daqFileCrc,"Chan Cnt",gsdf.num_chans);
-	logFileEntry(logmsg);
-	gsdfClearSdf(pref);
-	// Start Infinite Loop 		*******************************************************************************
-	for(;;) {
-		dropout = 0;
-		waitGpsTrigger(gsdf.gpsTime, gsdf.epicsSync);
-		// printf("GSDF %ld - %d\n",gsdf.gpsTime,gsdf.epicsSync);
-		status = dbPutField(&gpstimedisplayaddr,DBR_LONG,&gsdf.gpsTime,1);		// Init to zero.
-		gsdf.epicsSync = (gsdf.epicsSync + 1) % 16;
-		if (gsdf.epicsSync == 0) gsdf.gpsTime ++;
-		status = dbPutField(&daqbyteaddr,DBR_LONG,&datarate,1);
-		int conChans = gsdf.con_chans;
-		status = dbPutField(&eccaddr,DBR_LONG,&conChans,1);
-		// if((conChans != gsdf.num_chans) || (numDC != 0)) numDC = gsdfReportUnconnChannels(pref);
-		// if(conChans != gsdf.num_chans) numDC = gsdfReportUnconnChannels(pref);
-		if (gsdf.epicsSync == 0) {
-			status = dbGetField(&pagereqaddr,DBR_USHORT,&pageNum,&ropts,&nvals,NULL);
-			// printf("Page is %d\n",pageNum);
-			numDC = gsdfFindUnconnChannels();
-			numReport = gsdfReportUnconnChannels(pref,numDC,pageNum);
-			if(numReport == -1) {
-				pageNum = 0;
-				status = dbPutField(&pagereqaddr,DBR_USHORT,&pageNum,1);		// Init to zero.
-			}
-			status = dbGetField(&datadumpaddr,DBR_USHORT,&dataDump,&ropts,&nvals,NULL);
-			if(dataDump) {
-				printf("Received data request\n");
-				gsdfWriteData("/tmp/gsdfdata");
-				dataDump = 0;
-				status = dbPutField(&datadumpaddr,DBR_USHORT,&dataDump,1);		// Init to zero.
-			}
-		}
-		status = dbPutField(&chnotfoundaddr,DBR_LONG,&numDC,1);
+    for (ii=0;ii<GSDF_MAX_CHANS;ii++) gsdf.channel_status[ii] = 0xbad;
+
+    int dropout = 0;
+    int numDC = 0;
+    int cycle = 0;
+    int numReport = 0;
+
+    // Initialize DAQ and COEFF file CRC checksums for later compares.
+    daqFileCrc = checkFileCrc(daqFile);
+    printf("DAQ file CRC = %u \n",daqFileCrc);  
+    coeffFileCrc = checkFileCrc(coeffFile);
+    sprintf(logmsg,"%s\n%s = %u\n%s = %d","GSDF code restart","File CRC",daqFileCrc,"Chan Cnt",gsdf.num_chans);
+    logFileEntry(logmsg);
+    gsdfClearSdf(pref);
+    // Start Infinite Loop      *******************************************************************************
+    for(;;) {
+        dropout = 0;
+        waitGpsTrigger(gsdf.gpsTime, gsdf.epicsSync);
+        // printf("GSDF %ld - %d\n",gsdf.gpsTime,gsdf.epicsSync);
+        status = dbPutField(&gpstimedisplayaddr,DBR_LONG,&gsdf.gpsTime,1);      // Init to zero.
+        gsdf.epicsSync = (gsdf.epicsSync + 1) % 16;
+        if (gsdf.epicsSync == 0) gsdf.gpsTime ++;
+        status = dbPutField(&daqbyteaddr,DBR_LONG,&datarate,1);
+        int conChans = gsdf.con_chans;
+        status = dbPutField(&eccaddr,DBR_LONG,&conChans,1);
+        // if((conChans != gsdf.num_chans) || (numDC != 0)) numDC = gsdfReportUnconnChannels(pref);
+        // if(conChans != gsdf.num_chans) numDC = gsdfReportUnconnChannels(pref);
+        if (gsdf.epicsSync == 0) {
+            status = dbGetField(&pagereqaddr,DBR_USHORT,&pageNum,&ropts,&nvals,NULL);
+            // printf("Page is %d\n",pageNum);
+            numDC = gsdfFindUnconnChannels();
+            numReport = gsdfReportUnconnChannels(pref,numDC,pageNum);
+            if(numReport == -1) {
+                pageNum = 0;
+                status = dbPutField(&pagereqaddr,DBR_USHORT,&pageNum,1);        // Init to zero.
+            }
+            status = dbGetField(&datadumpaddr,DBR_USHORT,&dataDump,&ropts,&nvals,NULL);
+            if(dataDump) {
+                printf("Received data request\n");
+                gsdfWriteData("/tmp/gsdfdata");
+                dataDump = 0;
+                status = dbPutField(&datadumpaddr,DBR_USHORT,&dataDump,1);      // Init to zero.
+            }
+        }
+        status = dbPutField(&chnotfoundaddr,DBR_LONG,&numDC,1);
 
         // printf("GSDF C1 = %f status = %d\n",gsdf.channel_value[2],gsdf.channel_status[2]);
-	// printf("Channels CONN = %d   NO_CONN = %d TIME = %ld SYNC = %ld \n",gsdf.con_chans,(gsdf.num_chans - gsdf.con_chans),gsdf.gpsTime, gsdf.epicsSync);
+    // printf("Channels CONN = %d   NO_CONN = %d TIME = %ld SYNC = %ld \n",gsdf.con_chans,(gsdf.num_chans - gsdf.con_chans),gsdf.gpsTime, gsdf.epicsSync);
         //printf("GSDF C2 = %f\n",gsdf.channel_value[1]);
-		fivesectimer = (fivesectimer + 1) % 50;		// Increment 5 second timer for triggering CRC checks.
-		// Check file CRCs every 5 seconds.
-		// DAQ and COEFF file checking was moved from skeleton.st to here RCG V2.9.
-		if(!fivesectimer) {
-			status = checkFileCrc(daqFile);
-			if(status != daqFileCrc) {
-				daqFileCrc = status;
-				status = dbPutField(&daqmsgaddr,DBR_STRING,modfilemsg,1);
-				logFileEntry("Detected Change to DAQ Config file.");
-			}
-		}
-	}
-	sleep(0xfffffff);
-    } else
-    	iocsh(NULL);
+        fivesectimer = (fivesectimer + 1) % 50;     // Increment 5 second timer for triggering CRC checks.
+        // Check file CRCs every 5 seconds.
+        // DAQ and COEFF file checking was moved from skeleton.st to here RCG V2.9.
+        if(!fivesectimer) {
+            status = checkFileCrc(daqFile);
+            if(status != daqFileCrc) {
+                daqFileCrc = status;
+                status = dbPutField(&daqmsgaddr,DBR_STRING,modfilemsg,1);
+                logFileEntry("Detected Change to DAQ Config file.");
+            }
+        }
+    }
+    sleep(0xfffffff);
+    } else {
+        iocsh(NULL);
+    }
+
+    //This is not going to get called because we don't have a clean way to exit
+    gsdfDeinitialize(); //Clean up shared memory
+
     return(0);
 }
diff --git a/src/epics/util/Userspace_CMakeLists.cmake b/src/epics/util/Userspace_CMakeLists.cmake
index 219f6fbeb9373a9c069074ec42c70375f425e6f4..c23639aa26cdbccc054183e878542686de68d1c3 100644
--- a/src/epics/util/Userspace_CMakeLists.cmake
+++ b/src/epics/util/Userspace_CMakeLists.cmake
@@ -39,7 +39,7 @@ list(APPEND COMMON_SRC_LIST "${CMAKE_CURRENT_SOURCE_DIR}/${MODEL_NAME}_core.c"
                      "${CMAKE_CURRENT_SOURCE_DIR}/src/include/drv/daqLib.c"
                      "${CMAKE_CURRENT_SOURCE_DIR}/src/fe/rcguserCommon.c"
                      "${CMAKE_CURRENT_SOURCE_DIR}/src/fe/commDataUsp.c"
-                     "${CMAKE_CURRENT_SOURCE_DIR}/src/drv/rfm.c")
+                     "${CMAKE_CURRENT_SOURCE_DIR}/src/drv/shmem.c")
 
 
 if(BUILD_USP_GPSCLOCK)
@@ -69,6 +69,8 @@ list(APPEND LIB_SRC_LIST ${COMMON_SRC_LIST} "${CMAKE_CURRENT_SOURCE_DIR}/src/fe/
 add_library(${LIB_NAME} ${LIB_SRC_LIST})
 target_include_directories(${LIB_NAME} PUBLIC ${INC_DIRS})
 
+target_link_libraries(${LIB_NAME} PUBLIC -lrt)
+
 if (${USE_STDLIB_MATH})
     target_link_libraries(${LIB_NAME} PUBLIC -lm)
 endif()
diff --git a/src/epics/util/lib/createEpicsMakefile.pm b/src/epics/util/lib/createEpicsMakefile.pm
index 9d62d2ad001ac744993b33306cc451de73ef5b30..636475c861ff67556c6f46dd7a6ae3aa66a94cb5 100644
--- a/src/epics/util/lib/createEpicsMakefile.pm
+++ b/src/epics/util/lib/createEpicsMakefile.pm
@@ -30,11 +30,10 @@ my ($fileName) = @_;
 	print OUTME "SRC += $::rcg_src_dir/src/epics/seq/main.cc\n";
 	}
 	print OUTME "SRC += $::rcg_src_dir/src/epics/seq/sdf_file_loaded.c\n";
-	print OUTME "SRC += $::rcg_src_dir/src/drv/rfm.c\n";
+	print OUTME "SRC += $::rcg_src_dir/src/drv/shmem.c\n";
 	print OUTME "SRC += $::rcg_src_dir/src/drv/param.c\n";
 	print OUTME "SRC += $::rcg_src_dir/src/drv/crc.c\n";
 	print OUTME "SRC += $::rcg_src_dir/src/drv/fmReadCoeff.c\n";
-	#print OUTME "SRC += src/epics/seq/get_local_time.st\n";
 	if ($::userspacegps)
 	{
 		print OUTME "SRC += $::rcg_src_dir/src/drv/gpsclock.c\n";
@@ -46,7 +45,6 @@ my ($fileName) = @_;
 		print OUTME "\L\.st\n";
 	}
 	print OUTME "\n";
-	#print OUTME "DB += src/epics/db/local_time.db\n";
 	print OUTME "DB += \$(MODEL_EPICS_SRC_DIR)/";
 	print OUTME "$::skeleton";
 	print OUTME "1\.db\n";
diff --git a/src/epics/util/skeleton.st b/src/epics/util/skeleton.st
index 01335bebbc31f3c9fc56cfd94342ca085785aeec..8a01f1fd13903740b780b6219a15ff9f550d9e9a 100644
--- a/src/epics/util/skeleton.st
+++ b/src/epics/util/skeleton.st
@@ -35,7 +35,7 @@ program %SEQUENCER_NAME%
 %% #define FM_SUBSYS_NUM  1
 %% #include "fmReadCoeff.h"
 %% #include "feComms.h"
-%% #include "findSharedMemory.h"
+%% #include "drv/shmem.h"
 %% #include "sdf_file_loaded.h"
 %% #define FE_ERROR_CFC 0x400
 
@@ -68,6 +68,7 @@ program %SEQUENCER_NAME%
 %DECL1%
 
 #if defined(RFM_EPICS)
+%% static shmem_handle g_rfm_shm_handle = NULL; 
 %% static volatile RFM_FE_COMMS *pRfm;
 %% static volatile VME_COEF *pVmeCoeff;
 %% static volatile FILT_MOD *pFilt;
@@ -200,6 +201,9 @@ int prev_seqTrig = 0;
 %% static fmReadCoeff fmc = {
 %%  "lho", "h1", "xxx", 0, {{"", "", MAX_MODULES, fmmap0, 0}},
 %% };
+%% char system_lower[ 128 ];
+%% char *s_hold;
+
 
 %% static const double conv = 0.000152588;
 %% static const int mask[2] = {0xAAA0,0x30AA};
@@ -301,15 +305,16 @@ assign tcsEnable to "{ifo}:TCS-SERVO_EN";
 
 
 %% static DAQ_INFO_BLOCK *info;
+%% static shmem_handle  g_base_shm_handle = NULL;
 %% static volatile void *base;
 %% static DAQ_INFO_BLOCK infoTmp;
 %% static GDS_INFO_BLOCK gdsTmp;
+%% static shmem_handle g_gdsInfo_shm_handle = NULL;
 %% static GDS_INFO_BLOCK *gdsInfo;
 %% static char site[160];
 %% static char ifo[160];
 %% static char daqsys[160];
 %% static char gdssmname[64];
-%% static char gdssmname[64];
 %% static int last_gds_tp[32];
 
 %% char fName[4][256];                                                   /* MA */
@@ -360,6 +365,16 @@ assign tcsEnable to "{ifo}:TCS-SERVO_EN";
 %%   gdsInfo->totalchans = gdsTmp.totalchans;
 %% }
 
+%% static void detach_shmem() {
+#ifndef NO_DAQ_IN_SKELETON
+%%   shmem_close(g_base_shm_handle);
+#endif
+#if defined(RFM_EPICS)
+%%   shmem_close(g_rfm_shm_handle);
+%%   shmem_close(g_gdsInfo_shm_handle);
+#endif 
+%% }
+
 
 ss monitorFilt{
  
@@ -417,12 +432,18 @@ state init
 %%	}
 %%    }
 %%  }
-%% strcpy(gdssmname,fmc.system);
-%% strcat(gdssmname,"_gds");
+
+%% //Convert the system (model) name to a lower case version
+%% strcpy(system_lower, fmc.system);
+%% for(s_hold = system_lower; *s_hold; s_hold++) *s_hold=tolower(*s_hold);
+%% strcpy(gdssmname, system_lower);
+%% strcat(gdssmname, "_gds");
+
 
 #if defined(RFM_EPICS)
 %%  printf("Init Sequencer %s; system %d fmcsystem = %s\n", fmc.subSys[0].name, sysnum,fmc.system);
-%%  pRfm = (RFM_FE_COMMS *) findSharedMemory(fmc.system);
+%%  g_rfm_shm_handle = shmem_open(system_lower, DEFAULT_SHMEM_ALLOC_SIZE_MB);
+%%  pRfm = (RFM_FE_COMMS *) shmem_mapping(g_rfm_shm_handle);
 %%  pFilt = (FILT_MOD *)(&pRfm->%EPICS_FILT_VAR%);
 %%  pVmeCoeff = (VME_COEF*)(&pRfm->%EPICS_COEFF_VAR%);
 %%  pEpics = (%EPICS_TYPE%*)(&pRfm->%EPICS_EPICS_VAR%);
@@ -433,10 +454,13 @@ state init
 %%  printf("%s pVmeCoeff size is 0x%lx\n", fmc.subSys[0].name, sizeof(*pVmeCoeff));
 %%  printf("%s pEpics is at 0x%lx\n", fmc.subSys[0].name, ((unsigned long)pEpics-(unsigned long)pRfm));
 %%  printf("%s pEpics is at 0x%lx\n", fmc.subSys[0].name, ((unsigned long)pRfm));
-%%  gdsInfo = (GDS_INFO_BLOCK *) findSharedMemory(gdssmname);
+%%  g_gdsInfo_shm_handle = shmem_open(gdssmname, DEFAULT_SHMEM_ALLOC_SIZE_MB); 
+%%  gdsInfo = (GDS_INFO_BLOCK *) shmem_mapping(g_gdsInfo_shm_handle);
 %%  printf("%s gdsinfo is at 0x%lx\n", gdssmname, (unsigned long)gdsInfo);
 #endif
 
+atexit(detach_shmem);
+
 %% strcpy(fName[0], "/opt/rtcds/");                                        /* MA */
 %% strcat_lower(fName[0], fmc.site);                                     /* MA */
 %% strcat(fName[0], "/");                                          /* MA */
@@ -924,7 +948,17 @@ state daqInit
         strcpy(site, macValueGet("site"));
         strcpy(ifo, macValueGet("ifo"));
         strcpy(daqsys, macValueGet("sysfile"));
-%%      base = findSharedMemory(daqsys);
+
+%%      strcpy(system_lower, daqsys);
+%%      for(s_hold = system_lower; *s_hold; s_hold++) *s_hold=tolower(*s_hold);
+%%
+%%      g_base_shm_handle = shmem_open(system_lower, DEFAULT_SHMEM_ALLOC_SIZE_MB);
+%%      if (g_base_shm_handle == 0) {
+%%          fprintf(stderr, "shmem_open failed, buffer name %s.\n", system_lower);
+%%          exit(1);
+%%      }
+%% 
+%%      base = shmem_mapping(g_base_shm_handle);
 %%      info = (DAQ_INFO_BLOCK *)(base + DAQ_INFO_ADDRESS);
         pvPut(dcuId);
 %%      rfm_assign(pEpics->epicsInput.dcuId, dcuId);
diff --git a/src/fe/map.c b/src/fe/map.c
index 790e981b447e87db33a2b57b2b320849e4c93374..9199ee32ce407c79a19f6280bcb4f1b668981f20 100644
--- a/src/fe/map.c
+++ b/src/fe/map.c
@@ -157,7 +157,7 @@ mapPciModulesVirtual( CDS_HARDWARE* pCds )
     {
         if ( pCds->cards_used[ i ].type == GSC_18AO8 )
         {
-            sprintf( fname, "%s_%d\n", "IO_DEV_", i );
+            sprintf( fname, "%s_%d", "IO_DEV_", i );
             ret = mbuf_allocate_area( fname, 8 * 4 * 65536, (volatile void **)&_device_shm );
             if ( ret != MBUF_KERNEL_CODE_OK )
             {
@@ -174,7 +174,7 @@ mapPciModulesVirtual( CDS_HARDWARE* pCds )
         }
         if ( pCds->cards_used[ i ].type == GSC_16AO16 )
         {
-            sprintf( fname, "%s_%d\n", "IO_DEV_", i );
+            sprintf( fname, "%s_%d", "IO_DEV_", i );
             ret = mbuf_allocate_area( fname, 16 * 4 * 65536, (volatile void **)&_device_shm );
             if ( ret != MBUF_KERNEL_CODE_OK )
             {
@@ -191,7 +191,7 @@ mapPciModulesVirtual( CDS_HARDWARE* pCds )
         }
         if ( pCds->cards_used[ i ].type == GSC_20AO8 )
         {
-            sprintf( fname, "%s_%d\n", "IO_DEV_", i );
+            sprintf( fname, "%s_%d", "IO_DEV_", i );
             ret = mbuf_allocate_area( fname, 8 * 4 * 65536, (volatile void **)&_device_shm );
             if ( ret != MBUF_KERNEL_CODE_OK )
             {
@@ -208,7 +208,7 @@ mapPciModulesVirtual( CDS_HARDWARE* pCds )
         }
         if ( pCds->cards_used[ i ].type == GSC_16AI64SSA )
         {
-            sprintf( fname, "%s_%d\n", "IO_DEV_", i );
+            sprintf( fname, "%s_%d", "IO_DEV_", i );
             ret = mbuf_allocate_area( fname, 32 * 4 * 128, (volatile void **)&_device_shm );
             if ( ret != MBUF_KERNEL_CODE_OK )
             {
diff --git a/src/fe/rcguser.c b/src/fe/rcguser.c
index b25d8594a514ab72d01afb2e926a21faf5ce51b6..a803868f89896b325dcac202a5051a1c5b8e3561 100644
--- a/src/fe/rcguser.c
+++ b/src/fe/rcguser.c
@@ -37,7 +37,7 @@ extern int   fe_start_app_user( );
 int
 main( int argc, char** argv )
 {
-    int  status = 0;
+    int  status = 0, mainReturn = 0;
     int  ii, jj, kk; /// @param ii,jj,kk default loop counters
     char fname[ 128 ]; /// @param fname[128] Name of shared mem area to allocate
                        /// for DAQ data
@@ -78,7 +78,6 @@ main( int argc, char** argv )
     printl( "configured to use %d cards\n", cards );
     cdsPciModules.cards = cards;
     cdsPciModules.cards_used = cards_used;
-    // return -1;
     printl( "Initializing PCI Modules\n" );
     cdsPciModules.adcCount = 0;
     cdsPciModules.dacCount = 0;
@@ -99,7 +98,8 @@ main( int argc, char** argv )
     if ( !cdsPciModules.adcCount )
     {
         printl( "No ADC cards found - exiting\n" );
-        return -1;
+        mainReturn = -1;
+        goto cleanup;
     }
     printl( "%d PCI cards found \n", status );
     if ( status < cards )
@@ -135,7 +135,8 @@ main( int argc, char** argv )
     }
     if ( cnt == 10 )
     {
-        return -1;
+        mainReturn = -1;
+        goto cleanup;
     }
 
     pLocalEpics->epicsInput.vmeReset = 0;
@@ -147,5 +148,9 @@ main( int argc, char** argv )
     // Start the control loop software
     fe_start_app_user( );
 
-    return 0;
+    cleanup:
+    detach_shared_memory();
+
+    return mainReturn;
+
 }
diff --git a/src/fe/rcguserCommon.c b/src/fe/rcguserCommon.c
index d02fdf309b4006362cf4498079281f70a2e89e86..189d861f75fbf24c4b38b963525fb87c56c32530 100644
--- a/src/fe/rcguserCommon.c
+++ b/src/fe/rcguserCommon.c
@@ -3,11 +3,13 @@
 
 #include "print_io_info.h"
 #include "controller.h"
-#include "findSharedMemory.h"
 #include "util/printl.h"
+#include "drv/shmem.h"
 
 #include <stddef.h>
 #include <stdio.h>
+#include <string.h>
+#include <ctype.h>
 
 // **********************************************************************************************
 // Capture SIGHALT from ControlC
@@ -22,81 +24,111 @@ intHandler( int signal)
 // **********************************************************************************************
 
 int
-attach_shared_memory( char* sysname )
+attach_shared_memory( const char* sysname )
 {
 
+    char * s;
     char         shm_name[ 64 ];
+    char         sysname_lower[ 64 ];
+
+    //Build lower case version of the system (model) name
+    strcpy(sysname_lower, sysname);
+    for(s = sysname_lower; *s; s++) *s = tolower(*s);
+
 
     // epics shm used to communicate with model's EPICS process
-    sprintf( shm_name, "%s", sysname );
-    _epics_shm = (volatile char*) findSharedMemory( sysname );
-    if ( _epics_shm == NULL )
+    g_epics_shm_handle = shmem_open(sysname_lower, SHMEM_EPICS_SIZE_MB);
+    if ( g_epics_shm_handle == NULL )
     {
-        printl( "mbuf_allocate_area() failed; ret = %p\n", _epics_shm );
+        printl( "shmem_open(%s, %d) failed; ret = %d\n",
+                sysname, SHMEM_EPICS_SIZE_MB, g_epics_shm_handle );
         return -1;
     }
+    _epics_shm = shmem_mapping(g_epics_shm_handle);
     printl( "EPICSM at %p\n", _epics_shm );
 
     // testpoint config shm used to control testpoints from awgtpman
-    sprintf( shm_name, "%s%s", sysname, SHMEM_TESTPOINT_SUFFIX );
-    _tp_shm = (volatile TESTPOINT_CFG *) findSharedMemory( sysname );
-    if ( _tp_shm == NULL )
+    sprintf( shm_name, "%s%s", sysname_lower, SHMEM_TESTPOINT_SUFFIX );
+    g_tp_shm_handle = shmem_open(shm_name, SHMEM_TESTPOINT_SIZE_MB);
+    if ( g_tp_shm_handle == NULL )
     {
-        printl( "mbuf_allocate_area(tp) failed; ret = %p\n", _tp_shm );
+        printl( "shmem_open(%s, %d) failed; ret = %d\n",
+                shm_name, SHMEM_TESTPOINT_SIZE_MB, g_tp_shm_handle );
         return -1;
     }
+    _tp_shm = shmem_mapping(g_tp_shm_handle);
     printl( "TPSM at %p\n", _tp_shm );
     
     // awg data shm used to stream data from awgtpman
-    sprintf( shm_name, "%s%s", sysname, SHMEM_AWG_SUFFIX );
-    _awg_shm = (volatile AWG_DATA *) findSharedMemory( sysname );
-    if ( _awg_shm == NULL )
+    sprintf( shm_name, "%s%s", sysname_lower, SHMEM_AWG_SUFFIX );
+    g_awg_shm_handle = shmem_open(shm_name, SHMEM_AWG_SIZE_MB);
+    if ( g_awg_shm_handle == NULL )
     {
-        printl( "mbuf_allocate_area(awg) failed; ret = %p\n", _awg_shm );
+        printl( "shmem_open(%s, %d) failed; ret = %d\n", 
+                shm_name, SHMEM_AWG_SIZE_MB, g_awg_shm_handle );
         return -1;
     }
+    _awg_shm = shmem_mapping(g_awg_shm_handle);
     printl( "AWGSM at %p\n", _awg_shm );
     
     // ipc_shm used to communicate with IOP
-    _ipc_shm = (char*)findSharedMemory( "ipc" );
-    if ( _ipc_shm == NULL )
+    g_ipc_shm_handle = shmem_open( SHMEM_IOMEM_NAME, SHMEM_IOMEM_SIZE_MB);
+    if ( g_ipc_shm_handle == NULL )
     {
-        printl( "mbuf_allocate_area(ipc) failed; ret = %p\n", _ipc_shm );
+        printl( "shmem_open(%s, %d) failed; ret = %d\n",
+                SHMEM_IOMEM_NAME, SHMEM_IOMEM_SIZE_MB, g_ipc_shm_handle );
         return -1;
     }
+    _ipc_shm = shmem_mapping(g_ipc_shm_handle);
     printl( "IPC    at %p\n", _ipc_shm );
     ioMemData = (volatile IO_MEM_DATA*)( ( (char*)_ipc_shm ) + 0x4000 );
     printl("IOMEM  at %p size 0x%lx\n", ioMemData, sizeof( IO_MEM_DATA ) );
     printl( "%d PCI cards found\n", ioMemData->totalCards );
 
     // DAQ is via shared memory
-    sprintf( shm_name, "%s_daq", sysname );
-    _daq_shm = (char*) findSharedMemory( shm_name );
-    if ( _daq_shm == NULL )
+    sprintf( shm_name, "%s_daq", sysname_lower );
+    g_daq_shm_handle = shmem_open(shm_name, DEFAULT_SHMEM_ALLOC_SIZE_MB);
+    if ( g_daq_shm_handle == NULL )
     {
-        printl( "mbuf_allocate_area() failed; ret = %p\n", _daq_shm );
+        printl( "shmem_open(%s, %d) failed; ret = %d\n",
+                shm_name, DEFAULT_SHMEM_ALLOC_SIZE_MB, g_daq_shm_handle );
         return -1;
     }
+    _daq_shm = shmem_mapping(g_daq_shm_handle);
     printl( "DAQSM at %p\n", _daq_shm );
     daqPtr = (struct rmIpcStr*)_daq_shm;
 
     // shmipc is used to send SHMEM IPC data between processes on same computer
-    _shmipc_shm = (char*) findSharedMemory( "shmipc" );
-    if ( _shmipc_shm == NULL )
+    g_shmipc_shm_handle = shmem_open(SHMEM_IPCCOMMS_NAME, SHMEM_IPCCOMMS_SIZE_MB); 
+    if ( g_shmipc_shm_handle == NULL )
     {
-        printl( "mbuf_allocate_area() failed; ret = %p\n", _shmipc_shm );
+        printl( "shmem_open(%s, %d) failed; ret = %d\n",
+                SHMEM_IPCCOMMS_NAME, SHMEM_IPCCOMMS_SIZE_MB, g_shmipc_shm_handle );
         return -1;
     }
+    _shmipc_shm = shmem_mapping(g_shmipc_shm_handle);
 
     // Open new IO shared memory in support of no hardware I/O
-    _io_shm = (char*) findSharedMemory( "virtual_io_space" );
-    if ( _io_shm == NULL )
+    g_io_shm_handle = shmem_open("virtual_io_space", DEFAULT_SHMEM_ALLOC_SIZE_MB);
+    if ( g_io_shm_handle == NULL )
     {
-        printl( "mbuf_allocate_area() failed; ret = %p\n", _io_shm );
+        printl( "shmem_open(%s, %d) failed; ret = %d\n",
+                "virtual_io_space", DEFAULT_SHMEM_ALLOC_SIZE_MB, g_io_shm_handle );
         return -1;
     }
+    _io_shm = shmem_mapping(g_io_shm_handle);
     ioMemDataIop = (volatile IO_MEM_DATA_IOP*)( ( (char*)_io_shm ) );
 
     return 0;
 }
 
+void detach_shared_memory()
+{
+    shmem_close(g_epics_shm_handle);
+    shmem_close(g_tp_shm_handle);
+    shmem_close(g_awg_shm_handle);
+    shmem_close(g_ipc_shm_handle);
+    shmem_close(g_daq_shm_handle);
+    shmem_close(g_shmipc_shm_handle);
+    shmem_close(g_io_shm_handle);
+}
diff --git a/src/fe/rcguserCommon.h b/src/fe/rcguserCommon.h
index a96b62aa093bf0852db792f3893e4c914e9813d4..55e3673e298f66dc63904ee871a65c7113ba74cf 100644
--- a/src/fe/rcguserCommon.h
+++ b/src/fe/rcguserCommon.h
@@ -6,7 +6,7 @@ extern "C" {
 #endif
 
 void intHandler( int dummy );
-int attach_shared_memory( char* sysname );
+int attach_shared_memory( const char* sysname );
 
 #ifdef __cplusplus
 }
diff --git a/src/fe/rcguserIop.c b/src/fe/rcguserIop.c
index fa8e1345893a3fec6cd9829ae28f1109214b4897..ce6200baa466d6f5fad0a0288aa29498d9a603c5 100644
--- a/src/fe/rcguserIop.c
+++ b/src/fe/rcguserIop.c
@@ -19,7 +19,6 @@
 
 #include "rcguserCommon.h"
 #include "controllerko.h" //tdsControl, tdsCount, etc
-#include "findSharedMemory.h"
 #include "controller.h" //daqArea
 #include "feComms.h" //RFM_FE_COMMS
 #include "util/printl.h"
diff --git a/src/include/controller.c b/src/include/controller.c
index e2fd98dfde268b249c62b9578ac3a6db7630c2e6..b9fb759720627f030ff47330d3ed8fc285006ce8 100644
--- a/src/include/controller.c
+++ b/src/include/controller.c
@@ -37,14 +37,31 @@ char fp[ 64 * 1024 ];
 
 
 char*          build_date = __DATE__ " " __TIME__;
+
+//
+// Pointers to shared memory blocks
+//
+shmem_handle g_epics_shm_handle;
 volatile char* _epics_shm; ///< Ptr to EPICS shared memory area
+
+shmem_handle g_tp_shm_handle;
 volatile TESTPOINT_CFG  *_tp_shm;
+
+shmem_handle g_awg_shm_handle;
 volatile AWG_DATA *_awg_shm;
+
+shmem_handle g_ipc_shm_handle;
 volatile char*          _ipc_shm; ///< Ptr to inter-process communication area
+
+shmem_handle g_daq_shm_handle;
 volatile char*          _daq_shm; ///< Ptr to frame builder comm shared mem area
-// char*          _gds_shm; ///< Ptr to frame builder comm shared mem area
+
+shmem_handle g_shmipc_shm_handle;
 volatile char*          _shmipc_shm; ///< Ptr to IOP I/O data to/from User app shared mem area
+
+shmem_handle g_io_shm_handle;
 volatile char*          _io_shm; ///< Ptr to user space I/O area
+
 int            daq_fd; ///< File descriptor to share memory file
 
 long                      daqBuffer; // Address for daq dual buffers in daqLib.c
diff --git a/src/include/controller.h b/src/include/controller.h
index 64ac95800d60e3c5bd676d935ca206ae7044d08a..9e5cdd32dc5abd72fd9428916dfe9e2a3a6766aa 100644
--- a/src/include/controller.h
+++ b/src/include/controller.h
@@ -5,6 +5,7 @@
 #include "fm10Gen_types.h" //FILT_MOD 
 #include "daq_core_defs.h" //DAQ_DCU_SIZE
 
+#include "drv/shmem.h"
 #include "../shmem/shmem_all.h" //TESTPOINT_CFG, AWG_DATA
 
 
@@ -274,14 +275,28 @@ extern char fp[ 64 * 1024 ];
 
 
 extern char*          build_date ;
+
 extern volatile char* _epics_shm; ///< Ptr to EPICS shared memory area
+extern shmem_handle g_epics_shm_handle;
+
 extern volatile TESTPOINT_CFG  *_tp_shm;
+extern shmem_handle g_tp_shm_handle;
+
 extern volatile AWG_DATA *_awg_shm;
+extern shmem_handle g_awg_shm_handle;
+
 extern volatile char*          _ipc_shm; ///< Ptr to inter-process communication area
+extern shmem_handle g_ipc_shm_handle;
+
 extern volatile char*          _daq_shm; ///< Ptr to frame builder comm shared mem area
-//extern  char*          _gds_shm; ///< Ptr to frame builder comm shared mem area
+extern shmem_handle g_daq_shm_handle;
+
 extern volatile char*          _shmipc_shm; ///< Ptr to IOP I/O data to/from User app shared mem area
+extern shmem_handle g_shmipc_shm_handle;
+
 extern volatile char*          _io_shm; ///< Ptr to user space I/O area
+extern shmem_handle g_io_shm_handle;
+
 extern int            daq_fd; ///< File descriptor to share memory file
 
 extern long                      daqBuffer; // Address for daq dual buffers in daqLib.c
diff --git a/src/include/drv/shmem.h b/src/include/drv/shmem.h
index c0d4da4497368d08910a3d1a92a31ad3a9b4807a..fd2d2fa96a52520582195c4d25fcf7212065e25f 100644
--- a/src/include/drv/shmem.h
+++ b/src/include/drv/shmem.h
@@ -8,8 +8,10 @@
 extern "C" {
 #endif
 
-extern volatile void* findSharedMemory( char* sys_name );
-extern volatile void* findSharedMemorySize( char* sys_name, int size );
+#include <stddef.h>
+
+#define DEFAULT_SHMEM_ALLOC_SIZE_MB 64
+
 
 extern int shmem_format_name( char* dest, const char* src, size_t n );
 // extern volatile void* shmem_open_segment(const char *sys_name, size_t
diff --git a/src/include/findSharedMemory.h b/src/include/findSharedMemory.h
deleted file mode 100644
index b03777685fc9dd1238d1d35b7988d931fa0c3a71..0000000000000000000000000000000000000000
--- a/src/include/findSharedMemory.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef LIGO_FINDSHAREDMEMORY_H 
-#define LIGO_FINDSHAREDMEMORY_H
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-volatile void* findSharedMemory( char* );
-volatile void* findSharedMemorySize( char*, int size_mb );
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/src/local_dc/CMakeLists.txt b/src/local_dc/CMakeLists.txt
index d70be10d2db0d78a331ed14ef43288d8c466e251..51ff45da5d119dadb7dad5cfc75dd68162e577dc 100644
--- a/src/local_dc/CMakeLists.txt
+++ b/src/local_dc/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_executable(local_dc local_dc.c ${CMAKE_CURRENT_SOURCE_DIR}/../drv/rfm.c)
+add_executable(local_dc local_dc.c ${CMAKE_CURRENT_SOURCE_DIR}/../drv/shmem.c)
 
 target_link_libraries(local_dc PUBLIC
         args
diff --git a/src/shmem/shmem_all.h b/src/shmem/shmem_all.h
index 812244a048c7291674ef97e88eeeb2916b6a7759..53e5e9d2737d1a0e379d50adf1f5c3f36ac99e1a 100644
--- a/src/shmem/shmem_all.h
+++ b/src/shmem/shmem_all.h
@@ -9,5 +9,6 @@
 #include "shmem_awg.h"
 #include "shmem_iomem.h"
 #include "shmem_testpoint.h"
+#include "shmem_ipccomms.h"
 
 #endif // DAQD_TRUNK_SHMEM_ALL_H
diff --git a/src/shmem/shmem_ipccomms.h b/src/shmem/shmem_ipccomms.h
new file mode 100644
index 0000000000000000000000000000000000000000..6c45eff7761d49d85301475cfdedb64d173b7518
--- /dev/null
+++ b/src/shmem/shmem_ipccomms.h
@@ -0,0 +1,13 @@
+//
+// Created by ezekiel.dohmen 05/06/2022
+//
+
+#ifndef SHMEM_IPC_COMMS_H
+#define SHMEM_IPC_COMMS_H
+
+#define SHMEM_IPCCOMMS_NAME "shmipc"
+#define SHMEM_IPCCOMMS_SIZE_MB 16
+#define SHMEM_IPCCOMMS_SIZE ( SHMEM_IPCCOMMS_SIZE_MB * 1024 * 1024 )
+
+#endif // SHMEM_IPC_COMMS_H
+