diff --git a/include/blc_command.h b/include/blc_command.h
index 84cc23d25272700ea999d73599b557faaaba5264..d0da62cbbf42b683e68e3b75cb4c703bce4d62e7 100644
--- a/include/blc_command.h
+++ b/include/blc_command.h
@@ -28,6 +28,8 @@ Few functions helping for pseudo realtime applications.
 
 #include "blc_tools.h"
 
+#define BLC_COMMAND_LOOP_THREAD() for(blc_command_loop_init(-2); blc_command_loop_start();blc_command_loop_end())
+
 /**
  period in microseconds
  0 for system as fast as possible, -1 for blocking on keyborad, -2 blocking after first iteration.
@@ -126,6 +128,10 @@ void blc_command_loop_init(long loop_period);
 int blc_command_loop_start();
 void blc_command_loop_end();
 
+/**Wait until the blc_loop_stop. 
+ Return the loop_thred pointer (always NULL for now)*/
+void *blc_loop_wait_stop();
+
 /** Stop a textual program
  * - Send a quitting message with the name of the app on stderr.
  * - Send 'q' and flush on stdout if it is a piped output
diff --git a/include/blc_program.h b/include/blc_program.h
index d6ced8b98d21a7f9b7ed4ebcd4259d25363f600a..3ab7eaab6117fcf8b94cff9fc56794bfa9d5f816 100644
--- a/include/blc_program.h
+++ b/include/blc_program.h
@@ -29,6 +29,7 @@
 #include "blc_core.h"
 #include "blc_command.h"
 
+
 START_EXTERN_C
 
 ///Set the desciption of the program used for help. A copy of desciption is done (strdup).
diff --git a/src/blc_command.cpp b/src/blc_command.cpp
index 43751df283296432cbba45c57e7d8bc463c1398b..9fd6e79133684cfc90f9ff492c89cff947127657 100644
--- a/src/blc_command.cpp
+++ b/src/blc_command.cpp
@@ -33,6 +33,7 @@
 #include "blc_tools.h"
 #include "blc_program.h"
 
+
 //Identical to argparse in Python
 #define POSITIONAL_ARGUMENTS_TITLE "\npositional arguments:\n"
 #define OPTIONAL_ARGUMENTS_TITLE "\noptional arguments:\n"
@@ -48,6 +49,7 @@ typedef struct
     void *user_data;
 }blc_command;
 
+
 // Static means it is only existing in this file
 static blc_command *blc_commands = NULL;
 static int blc_commands_nb = 0;
@@ -102,6 +104,7 @@ void blc_command_add(const char *command_name, type_blc_command_cb callback, con
     APPEND_ITEM(&blc_commands, &blc_commands_nb, &tmp_command);
 }
 
+
 void blc_command_remove(const char *command_name){
     int i;
     
@@ -113,6 +116,8 @@ void blc_command_remove(const char *command_name){
     REMOVE_ITEM_POSITION(&blc_commands, &blc_commands_nb, i);
 }
 
+
+
 void blc_command_interpret_string(char const *input_string, size_t size){
     char const*parameter;
     char *parameter2;
diff --git a/src/blc_loop.cpp b/src/blc_loop.cpp
index 09f683b31e7f70852e01e6cc658efdf3a400b807..dd895d0b9de01b46198d895f7c006735b85a972b 100644
--- a/src/blc_loop.cpp
+++ b/src/blc_loop.cpp
@@ -14,8 +14,10 @@ struct timeval blc_loop_timer;
 static uint blc_period=0;
 static uint blc_duration=0;
 static uint blc_duration_min=UINT_MAX, blc_duration_max=0;
+
 static long blc_current_duration;
 static int intermediate_iteration;
+
 long blc_command_loop_period=-2; //unitialised
 uint64_t blc_loop_iteration_limit=UINT64_MAX;
 uint64_t blc_loop_iteration=0;
@@ -190,6 +192,7 @@ static void *command_thread_interpret_loop(void *){
     while(blc_status!=BLC_QUIT){
         blc_command_interpret_block();
         if (blc_command_loop_period==-1) BLC_PTHREAD_CHECK(pthread_mutex_unlock(&mutex_lock_keyboard), NULL);
+        //blc_command_interpret();
     }
     return NULL;
 }
@@ -229,6 +232,7 @@ void blc_command_loop_init(long loop_period){
 int blc_command_loop_start(){
     int continue_value;
     int i;
+    //We wait before counting the duration time as the time for waiting does not matter
     
     if (blc_profile_file) gettimeofday(&profile_timer, NULL); //this is only for profiling
 
@@ -294,3 +298,9 @@ void blc_command_loop_end(){
     intermediate_iteration++;
     blc_loop_iteration++;
 }
+
+void *blc_loop_wait_stop(){
+    void *result;
+    SYSTEM_ERROR_CHECK(pthread_join(loop_thread, &result), -1, NULL);
+    return result;
+}
diff --git a/src/blc_program.cpp b/src/blc_program.cpp
index 6202f18af9540bfd47ec3a8a36618c181ab891a3..627c3d25e430841c1e0262ab37d532081c72b998 100644
--- a/src/blc_program.cpp
+++ b/src/blc_program.cpp
@@ -176,6 +176,7 @@ static void blc_program_option_interpret(int *argc, char **argv[])
     type_program_option *program_option;
     char pipe_name[PATH_MAX+1];
     
+    blc_program_name = basename(*argv[0]);
     
     //We store enough room for all the optional letters + ':' + terminating null char
     optstring = MANY_ALLOCATIONS(blc_program_options_nb*2+1, char);