diff --git a/openair3/NAS/UE/EMM/Detach.c b/openair3/NAS/UE/EMM/Detach.c
index f29a632805914c5e987e496d32729f88d6b40a32..44fbe951819b949ceeda8f5a8b70658f70356483 100644
--- a/openair3/NAS/UE/EMM/Detach.c
+++ b/openair3/NAS/UE/EMM/Detach.c
@@ -85,20 +85,6 @@ void *_emm_detach_t3421_handler(void *);
  */
 static int _emm_detach_abort(nas_user_t *user, emm_proc_detach_type_t type);
 
-/*
- * Internal data used for detach procedure
- */
-static struct {
-#define EMM_DETACH_COUNTER_MAX  5
-  unsigned int count;      /* Counter used to limit the number of
-                  * subsequently detach attempts    */
-  int switch_off;      /* UE switch-off indicator     */
-  emm_proc_detach_type_t type; /* Type of the detach procedure
-                  * currently in progress       */
-} _emm_detach_data = {0, FALSE, EMM_DETACH_TYPE_RESERVED};
-
-
-
 /****************************************************************************/
 /******************  E X P O R T E D    F U N C T I O N S  ******************/
 /****************************************************************************/
@@ -128,7 +114,6 @@ static struct {
  **                                                                        **
  ** Outputs:     None                                                      **
  **      Return:    RETURNok, RETURNerror                      **
- **      Others:    _emm_detach_data                           **
  **                                                                        **
  ***************************************************************************/
 int emm_proc_detach(nas_user_t *user, emm_proc_detach_type_t type, int switch_off)
@@ -137,15 +122,16 @@ int emm_proc_detach(nas_user_t *user, emm_proc_detach_type_t type, int switch_of
 
   emm_sap_t emm_sap;
   emm_as_data_t *emm_as = &emm_sap.u.emm_as.u.data;
+  emm_detach_data_t *emm_detach_data = user->emm_data->emm_detach_data;
   int rc;
 
   LOG_TRACE(INFO, "EMM-PROC  - Initiate EPS detach type = %s (%d)",
             _emm_detach_type_str[type], type);
 
   /* Initialize the detach procedure internal data */
-  _emm_detach_data.count = 0;
-  _emm_detach_data.switch_off = switch_off;
-  _emm_detach_data.type = type;
+  emm_detach_data->count = 0;
+  emm_detach_data->switch_off = switch_off;
+  emm_detach_data->type = type;
 
   /* Setup EMM procedure handler to be executed upon receiving
    * lower layer notification */
@@ -202,12 +188,13 @@ int emm_proc_detach_request(void *args)
 {
   LOG_FUNC_IN;
 
-  nas_user_t *user=args;
+  nas_user_t *user = args;
   emm_timers_t *emm_timers = user->emm_data->emm_timers;
+  emm_detach_data_t *emm_detach_data = user->emm_data->emm_detach_data;
   emm_sap_t emm_sap;
   int rc;
 
-  if ( !_emm_detach_data.switch_off ) {
+  if ( !emm_detach_data->switch_off ) {
     /* Start T3421 timer */
     emm_timers->T3421.id = nas_timer_start(emm_timers->T3421.sec, _emm_detach_t3421_handler, user);
     LOG_TRACE(INFO, "EMM-PROC  - Timer T3421 (%d) expires in %ld seconds",
@@ -289,7 +276,6 @@ int emm_proc_detach_accept(void* args)
  **                                                                        **
  ** Inputs:  is_initial:    Not used                                   **
  **          args:      Not used                                   **
- **      Others:    _emm_detach_data                           **
  **                                                                        **
  ** Outputs:     None                                                      **
  **      Return:    RETURNok, RETURNerror                      **
@@ -300,7 +286,8 @@ int emm_proc_detach_failure(int is_initial, void *args)
 {
   LOG_FUNC_IN;
 
-  nas_user_t *user=args;
+  nas_user_t *user = args;
+  emm_detach_data_t *emm_detach_data = user->emm_data->emm_detach_data;
   emm_timers_t *emm_timers = user->emm_data->emm_timers;
   emm_sap_t emm_sap;
   int rc;
@@ -317,7 +304,7 @@ int emm_proc_detach_failure(int is_initial, void *args)
    * Notify EMM that detach procedure has to be restarted
    */
   emm_sap.primitive = EMMREG_DETACH_INIT;
-  emm_sap.u.emm_reg.u.detach.switch_off = _emm_detach_data.switch_off;
+  emm_sap.u.emm_reg.u.detach.switch_off = emm_detach_data->switch_off;
   rc = emm_sap_send(user, &emm_sap);
 
   LOG_FUNC_RETURN(rc);
@@ -335,7 +322,6 @@ int emm_proc_detach_failure(int is_initial, void *args)
  **      The  detach procedure shall be aborted.                   **
  **                                                                        **
  ** Inputs:  args:      not used                                   **
- **      Others:    _emm_detach_data                           **
  **                                                                        **
  ** Outputs:     None                                                      **
  **      Return:    RETURNok, RETURNerror                      **
@@ -348,9 +334,10 @@ int emm_proc_detach_release(void *args)
 
   LOG_TRACE(WARNING, "EMM-PROC  - NAS signalling connection released");
 
-  nas_user_t *user=args;
+  nas_user_t *user = args;
+  emm_detach_data_t *emm_detach_data = user->emm_data->emm_detach_data;
   /* Abort the detach procedure */
-  int rc = _emm_detach_abort(user, _emm_detach_data.type);
+  int rc = _emm_detach_abort(user, emm_detach_data->type);
 
   LOG_FUNC_RETURN(rc);
 }
@@ -379,7 +366,6 @@ int emm_proc_detach_release(void *args)
  **      the detach procedure shall be aborted.                    **
  **                                                                        **
  ** Inputs:  args:      handler parameters                         **
- **      Others:    _emm_detach_data                           **
  **                                                                        **
  ** Outputs:     None                                                      **
  **      Return:    None                                       **
@@ -390,17 +376,18 @@ void *_emm_detach_t3421_handler(void *args)
 {
   LOG_FUNC_IN;
 
-  nas_user_t *user=args;
+  nas_user_t *user = args;
+  emm_detach_data_t *emm_detach_data = user->emm_data->emm_detach_data;
   emm_timers_t *emm_timers = user->emm_data->emm_timers;
   int rc;
 
   /* Increment the retransmission counter */
-  _emm_detach_data.count += 1;
+  emm_detach_data->count += 1;
 
   LOG_TRACE(WARNING, "EMM-PROC  - T3421 timer expired, "
-            "retransmission counter = %d", _emm_detach_data.count);
+            "retransmission counter = %d", emm_detach_data->count);
 
-  if (_emm_detach_data.count < EMM_DETACH_COUNTER_MAX) {
+  if (emm_detach_data->count < EMM_DETACH_COUNTER_MAX) {
     /* Retransmit the Detach Request message */
     emm_sap_t emm_sap;
     emm_as_data_t *emm_as = &emm_sap.u.emm_as.u.data;
@@ -413,9 +400,9 @@ void *_emm_detach_t3421_handler(void *args)
     emm_as->NASmsg.length = 0;
     emm_as->NASmsg.value = NULL;
     /* Set the detach type */
-    emm_as->type = _emm_detach_data.type;
+    emm_as->type = emm_detach_data->type;
     /* Set the switch-off indicator */
-    emm_as->switch_off = _emm_detach_data.switch_off;
+    emm_as->switch_off = emm_detach_data->switch_off;
     /* Set the EPS mobile identity */
     emm_as->guti = user->emm_data->guti;
     emm_as->ueid = 0;
@@ -438,7 +425,7 @@ void *_emm_detach_t3421_handler(void *args)
     }
   } else {
     /* Abort the detach procedure */
-    rc = _emm_detach_abort(user, _emm_detach_data.type);
+    rc = _emm_detach_abort(user, emm_detach_data->type);
   }
 
   LOG_FUNC_RETURN(NULL);
@@ -457,7 +444,6 @@ void *_emm_detach_t3421_handler(void *args)
  ** Description: Aborts the detach procedure                               **
  **                                                                        **
  ** Inputs:  type:      not used                                   **
- **      Others:    _emm_detach_data                           **
  **                                                                        **
  ** Outputs:     None                                                      **
  **      Return:    RETURNok, RETURNerror                      **
diff --git a/openair3/NAS/UE/EMM/emmData.h b/openair3/NAS/UE/EMM/emmData.h
index bb7aff5c47a39729ab0532088fcae8aa47e0f530..a9921c8c8b8e46e8224b048831f549902ea0a122 100644
--- a/openair3/NAS/UE/EMM/emmData.h
+++ b/openair3/NAS/UE/EMM/emmData.h
@@ -47,6 +47,7 @@ Description Defines internal private data handled by EPS Mobility
 #include "nas_timer.h"
 
 #include "esmData.h"
+#include "emm_proc_defs.h"
 
 
 
@@ -93,6 +94,18 @@ Description Defines internal private data handled by EPS Mobility
 /************************  G L O B A L    T Y P E S  ************************/
 /****************************************************************************/
 
+/*
+ * Internal data used for detach procedure
+ */
+typedef struct {
+#define EMM_DETACH_COUNTER_MAX  5
+  unsigned int count;      /* Counter used to limit the number of
+                  * subsequently detach attempts    */
+  int switch_off;      /* UE switch-off indicator     */
+  emm_proc_detach_type_t type; /* Type of the detach procedure
+                  * currently in progress       */
+} emm_detach_data_t;
+
 /*
  * --------------------------------------------------------------------------
  * EPS NAS security context handled by EPS Mobility Management sublayer in
@@ -343,6 +356,7 @@ typedef struct emm_data_s {
    * ----------------------------------------
    */
   emm_timers_t *emm_timers;
+  emm_detach_data_t *emm_detach_data;
 } emm_data_t;
 
 
diff --git a/openair3/NAS/UE/EMM/emm_main.c b/openair3/NAS/UE/EMM/emm_main.c
index a19fa546486713dc991a79798b2e9aee8f8c4b21..95ab7872f836884e556bd6c19ef98bda1b561e33 100644
--- a/openair3/NAS/UE/EMM/emm_main.c
+++ b/openair3/NAS/UE/EMM/emm_main.c
@@ -41,6 +41,7 @@ Description Defines the EPS Mobility Management procedure call manager,
 #include "nas_log.h"
 #include "emmData.h"
 #include "MobileIdentity.h"
+#include "emm_proc_defs.h"
 
 #include "memory.h"
 #include "usim_api.h"
@@ -105,6 +106,12 @@ void _emm_timers_initialize(emm_timers_t *emm_timers) {
   emm_timers->T3430.sec = T3430_DEFAULT_VALUE;
 }
 
+void _emm_detach_initialize(emm_detach_data_t *emm_detach) {
+  emm_detach->count = 0;
+  emm_detach->switch_off = FALSE;
+  emm_detach->type = EMM_DETACH_TYPE_RESERVED;
+}
+
 /****************************************************************************
  **                                                                        **
  ** Name:    emm_main_initialize()                                     **
@@ -393,6 +400,16 @@ void emm_main_initialize(nas_user_t *user, emm_indication_callback_t cb, const c
   }
   _emm_timers_initialize(user->emm_data->emm_timers);
 
+  /*
+   * Initialize Internal data used for detach procedure
+   */
+  user->emm_data->emm_detach_data = calloc(1, sizeof(emm_detach_data_t));
+  if ( user->emm_data->emm_detach_data == NULL ) {
+    LOG_TRACE(ERROR, "EMM-MAIN - Failed to alloc emm_timers");
+    // FIXME stop here
+  }
+  _emm_detach_initialize(user->emm_data->emm_detach_data);
+
   /*
    * Initialize the user notification callback
    */
diff --git a/openair3/NAS/UE/EMM/emm_proc.h b/openair3/NAS/UE/EMM/emm_proc.h
index 85c0ea9ef13c99c6b1f636adba6315d1e0dd507f..ca307b3f3a76d9d692c76bca614c083bf903ee72 100644
--- a/openair3/NAS/UE/EMM/emm_proc.h
+++ b/openair3/NAS/UE/EMM/emm_proc.h
@@ -48,33 +48,6 @@ Description Defines the EPS Mobility Management procedures executed at
 /*********************  G L O B A L    C O N S T A N T S  *******************/
 /****************************************************************************/
 
-/* Type of network attachment */
-typedef enum {
-  EMM_ATTACH_TYPE_EPS = 0,
-  EMM_ATTACH_TYPE_IMSI,
-  EMM_ATTACH_TYPE_EMERGENCY,
-  EMM_ATTACH_TYPE_RESERVED,
-} emm_proc_attach_type_t;
-
-/* Type of network detach */
-typedef enum {
-  EMM_DETACH_TYPE_EPS = 0,
-  EMM_DETACH_TYPE_IMSI,
-  EMM_DETACH_TYPE_EPS_IMSI,
-  EMM_DETACH_TYPE_REATTACH,
-  EMM_DETACH_TYPE_NOT_REATTACH,
-  EMM_DETACH_TYPE_RESERVED,
-} emm_proc_detach_type_t;
-
-/* Type of requested identity */
-typedef enum {
-  EMM_IDENT_TYPE_NOT_AVAILABLE = 0,
-  EMM_IDENT_TYPE_IMSI,
-  EMM_IDENT_TYPE_IMEI,
-  EMM_IDENT_TYPE_IMEISV,
-  EMM_IDENT_TYPE_TMSI
-} emm_proc_identity_type_t;
-
 /****************************************************************************/
 /************************  G L O B A L    T Y P E S  ************************/
 /****************************************************************************/
diff --git a/openair3/NAS/UE/EMM/emm_proc_defs.h b/openair3/NAS/UE/EMM/emm_proc_defs.h
new file mode 100644
index 0000000000000000000000000000000000000000..3779626ac0c384bc3c6fa997d6d12aaaf1be0e60
--- /dev/null
+++ b/openair3/NAS/UE/EMM/emm_proc_defs.h
@@ -0,0 +1,31 @@
+#ifndef _EMM_PROC_DEFS_H
+#define _EMM_PROC_DEFS_H
+
+/* Type of network attachment */
+typedef enum {
+  EMM_ATTACH_TYPE_EPS = 0,
+  EMM_ATTACH_TYPE_IMSI,
+  EMM_ATTACH_TYPE_EMERGENCY,
+  EMM_ATTACH_TYPE_RESERVED,
+} emm_proc_attach_type_t;
+
+/* Type of network detach */
+typedef enum {
+  EMM_DETACH_TYPE_EPS = 0,
+  EMM_DETACH_TYPE_IMSI,
+  EMM_DETACH_TYPE_EPS_IMSI,
+  EMM_DETACH_TYPE_REATTACH,
+  EMM_DETACH_TYPE_NOT_REATTACH,
+  EMM_DETACH_TYPE_RESERVED,
+} emm_proc_detach_type_t;
+
+/* Type of requested identity */
+typedef enum {
+  EMM_IDENT_TYPE_NOT_AVAILABLE = 0,
+  EMM_IDENT_TYPE_IMSI,
+  EMM_IDENT_TYPE_IMEI,
+  EMM_IDENT_TYPE_IMEISV,
+  EMM_IDENT_TYPE_TMSI
+} emm_proc_identity_type_t;
+
+#endif