diff --git a/client/dap_client.c b/client/dap_client.c
index abf594bbe9991e5e7bc232eb2b2509f0e6b77634..03b95589fb10eda82e1fa30786722d67ba7723ab 100644
--- a/client/dap_client.c
+++ b/client/dap_client.c
@@ -13,7 +13,7 @@
  */
 int dap_client_init()
 {
-    dap_client_remote();
+    dap_client_remote_init();
     log_it(L_INFO, "Init DAP client module");
     return 0;
 }
diff --git a/client/dap_client_remote.c b/client/dap_client_remote.c
index cc44acb862eb181166b8cc763a2ad265f9e5f9e4..c4c849dac0cb4b877ff88852c5cffafba9f0dc2f 100644
--- a/client/dap_client_remote.c
+++ b/client/dap_client_remote.c
@@ -25,11 +25,16 @@
 #include <unistd.h>
 #include <string.h>
 
+#include <ev.h>
 
 #include "dap_common.h"
 #include "dap_loop.h"
 #include "dap_client_remote.h"
-#include <ev.h>
+
+#ifdef DAP_SERVER
+#include "dap_server.h"
+#endif
+
 #define LOG_TAG "dap_client_remote"
 
 
@@ -59,21 +64,26 @@ void dap_client_deinit()
  */
 dap_client_remote_t * dap_client_remote_create(dap_server_t * sh, int s, ev_io* w_client)
 {
+#ifdef DAP_SERVER
     pthread_mutex_lock(&sh->mutex_on_hash);
+#endif
     log_it(L_DEBUG,"Client structure create");
 
-    dap_client_t * ret=(dap_client_t *) calloc(1,sizeof(dap_client_t));
+    dap_client_remote_t * ret=DAP_NEW_Z(dap_client_remote_t);
     ret->socket=s;
+#ifdef DAP_SERVER
     ret->server=sh;
+#endif
     ret->watcher_client = w_client;
     ret->_ready_to_read=true;
 
+#ifdef DAP_SERVER
     HASH_ADD_INT( sh->clients, socket, ret);
-
     if(sh->client_new_callback)
         sh->client_new_callback(ret,NULL); // Init internal structure
 
     pthread_mutex_unlock(&sh->mutex_on_hash);
+#endif
     return ret;
 }
 
@@ -83,12 +93,14 @@ dap_client_remote_t * dap_client_remote_create(dap_server_t * sh, int s, ev_io*
  * @param sh
  * @return
  */
-dap_client_t * dap_client_find(int sock, struct dap_server * sh)
+dap_client_remote_t * dap_client_find(int sock, struct dap_server * sh)
 {
+    dap_client_remote_t * ret=NULL;
+#ifdef DAP_SERVER
     pthread_mutex_lock(&sh->mutex_on_hash);
-    dap_client_t * ret=NULL;
     HASH_FIND_INT(sh->clients,&sock,ret);
     pthread_mutex_unlock(&sh->mutex_on_hash);
+#endif
     return ret;
 }
 
@@ -97,7 +109,7 @@ dap_client_t * dap_client_find(int sock, struct dap_server * sh)
  * @param sc
  * @param isReady
  */
-void dap_client_ready_to_read(dap_client_t * sc,bool is_ready)
+void dap_client_ready_to_read(dap_client_remote_t * sc,bool is_ready)
 {
     if(is_ready != sc->_ready_to_read) {
 
@@ -119,7 +131,7 @@ void dap_client_ready_to_read(dap_client_t * sc,bool is_ready)
  * @param sc
  * @param isReady
  */
-void dap_client_ready_to_write(dap_client_t * sc,bool is_ready)
+void dap_client_ready_to_write(dap_client_remote_t * sc,bool is_ready)
 {
     if(is_ready != sc->_ready_to_write) {
 
@@ -142,8 +154,9 @@ void dap_client_ready_to_write(dap_client_t * sc,bool is_ready)
  * @brief safe_client_remove Removes the client from the list
  * @param sc Client instance
  */
-void dap_client_remove(dap_client_t *sc, struct dap_server * sh)
+void dap_client_remove(dap_client_remote_t *sc, struct dap_server * sh)
 {
+#ifdef DAP_SERVER
     pthread_mutex_lock(&sh->mutex_on_hash);
 
     log_it(DEBUG, "Client structure remove");
@@ -158,6 +171,7 @@ void dap_client_remove(dap_client_t *sc, struct dap_server * sh)
         close(sc->socket);
     free(sc);
     pthread_mutex_unlock(&sh->mutex_on_hash);
+#endif
 }
 
 /**
@@ -167,7 +181,7 @@ void dap_client_remove(dap_client_t *sc, struct dap_server * sh)
  * @param data_size Size of data to write
  * @return Number of bytes that were placed into the buffer
  */
-size_t dap_client_write(dap_client_t *sc, const void * data, size_t data_size)
+size_t dap_client_write(dap_client_remote_t *sc, const void * data, size_t data_size)
 {
      data_size = ((sc->buf_out_size+data_size)<(sizeof(sc->buf_out)))?data_size:(sizeof(sc->buf_out)-sc->buf_out_size );
      memcpy(sc->buf_out+sc->buf_out_size,data,data_size);
@@ -177,22 +191,22 @@ size_t dap_client_write(dap_client_t *sc, const void * data, size_t data_size)
 
 /**
  * @brief dap_client_write_f Write formatted text to the client
- * @param sc Client instance
- * @param format Format
+ * @param a_client Client instance
+ * @param a_format Format
  * @return Number of bytes that were placed into the buffer
  */
-size_t dap_client_write_f(dap_client_t *sc, const char * format,...)
+size_t dap_client_write_f(dap_client_remote_t *a_client, const char * a_format,...)
 {
-    size_t max_data_size = sizeof(sc->buf_out)-sc->buf_out_size;
+    size_t max_data_size = sizeof(a_client->buf_out)-a_client->buf_out_size;
     va_list ap;
-    va_start(ap,format);
-    int ret=vsnprintf(sc->buf_out+sc->buf_out_size,max_data_size,format,ap);
+    va_start(ap,a_format);
+    int ret=vsnprintf(a_client->buf_out+a_client->buf_out_size,max_data_size,a_format,ap);
     va_end(ap);
     if(ret>0){
-        sc->buf_out_size+=ret;
+        a_client->buf_out_size+=ret;
         return ret;
     }else{
-        log_it(ERROR,"Can't write out formatted data '%s'",format);
+        log_it(L_ERROR,"Can't write out formatted data '%s'",a_format);
         return 0;
     }
 }
@@ -204,12 +218,12 @@ size_t dap_client_write_f(dap_client_t *sc, const char * format,...)
  * @param data_size Size of data to read
  * @return Actual bytes number that were read
  */
-size_t dap_client_read(dap_client_t *sc, void * data, size_t data_size)
+size_t dap_client_read(dap_client_remote_t *sc, void * data, size_t data_size)
 {
 	
-	printf("Size of package: %d\n", (int)data_size);
-	// дамп пакета
-	hexdump(data, data_size);
+    //log_it(L_DEBUG, "Size of package: %d\n", (int)data_size);
+    //
+    // hexdump(data, data_size);  packet dump
 
     if (data_size < sc->buf_in_size) {
         memcpy(data, sc->buf_in, data_size);
@@ -230,7 +244,7 @@ size_t dap_client_read(dap_client_t *sc, void * data, size_t data_size)
  * @param cl Client instance
  * @param shrink_size Size on wich we shrink the buffer with shifting it left
  */
-void dap_client_shrink_buf_in(dap_client_t * cl, size_t shrink_size)
+void dap_client_shrink_buf_in(dap_client_remote_t * cl, size_t shrink_size)
 {
     if((shrink_size==0)||(cl->buf_in_size==0) ){
         //log_it(WARNING, "DBG_#003");
diff --git a/client/dap_client_remote.h b/client/dap_client_remote.h
index e72b691b3c0bec1ec4123d856d2c644e41addc92..b458e50610015bf9af22e8a32beda855055b4cc8 100644
--- a/client/dap_client_remote.h
+++ b/client/dap_client_remote.h
@@ -28,7 +28,7 @@
 #include <ev.h>
 
 
-struct dap_server;
+typedef struct dap_server dap_server_t;
 struct dap_client_remote;
 
 typedef void (*dap_client_remote_callback_t) (struct dap_client_remote *,void * arg); // Callback for specific client operations
@@ -59,7 +59,7 @@ typedef struct dap_client_remote{
 
     UT_hash_handle hh;
 
-    void * internal; // Internal data to specific client type, usualy states for state machine
+    void * _inheritor; // Internal data to specific client type, usualy states for state machine
 } dap_client_remote_t; // Node of bidirectional list of clients
 
 
@@ -67,20 +67,20 @@ typedef struct dap_client_remote{
 int dap_client_remote_init(); //  Init clients module
 void dap_client_remote_deinit(); // Deinit clients module
 
-extern dap_client_t * dap_client_create(struct dap_server * sh, int s, ev_io* w_client); // Create new client and add it to the list
-extern dap_client_t * dap_client_find(int sock, struct dap_server * sh); // Find client by socket
+dap_client_remote_t * dap_client_create(struct dap_server * sh, int s, ev_io* w_client); // Create new client and add it to the list
+dap_client_remote_t * dap_client_find(int sock, struct dap_server * sh); // Find client by socket
 
-extern bool dap_client_is_ready_to_read(dap_client_t * sc);
-extern bool dap_client_is_ready_to_write(dap_client_t * sc);
-extern void dap_client_ready_to_read(dap_client_t * sc,bool is_ready);
-extern void dap_client_ready_to_write(dap_client_t * sc,bool is_ready);
+bool dap_client_is_ready_to_read(dap_client_remote_t * sc);
+bool dap_client_is_ready_to_write(dap_client_remote_t * sc);
+void dap_client_ready_to_read(dap_client_remote_t * sc,bool is_ready);
+void dap_client_ready_to_write(dap_client_remote_t * sc,bool is_ready);
 
-extern size_t dap_client_write(dap_client_t *sc, const void * data, size_t data_size);
-extern size_t dap_client_write_f(dap_client_t *sc, const char * format,...);
-extern size_t dap_client_read(dap_client_t *sc, void * data, size_t data_size);
+size_t dap_client_write(dap_client_remote_t *sc, const void * data, size_t data_size);
+size_t dap_client_write_f(dap_client_remote_t *a_client, const char * a_format,...);
+size_t dap_client_read(dap_client_remote_t *sc, void * data, size_t data_size);
 
-extern void dap_client_remove(dap_client_t *sc, struct dap_server * sh); // Removes the client from the list
+void dap_client_remove(dap_client_remote_t *sc, struct dap_server * sh); // Removes the client from the list
 
-extern void dap_client_shrink_buf_in(dap_client_t * cl, size_t shrink_size);
+void dap_client_shrink_buf_in(dap_client_remote_t * cl, size_t shrink_size);
 
 #endif
diff --git a/core/dap_loop.c b/core/dap_loop.c
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/core/dap_loop.h b/core/dap_loop.h
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/core/dap_worker.c b/core/dap_worker.c
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/core/dap_worker.h b/core/dap_worker.h
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/http/dap_http_client.c b/http/dap_http_client.c
index d3947dbdfd5a4c473718f61fd45eb9015a2b6730..1efed3a91b94dd32f3d346ec25ea36928e4223b1 100644
--- a/http/dap_http_client.c
+++ b/http/dap_http_client.c
@@ -243,7 +243,7 @@ cnt:switch(cl_ht->state_read){
                     free(url_cpy1);
                     free(url_cpy2);
                 }else{
-                    log_it(WARNING, "Input: Wrong request line '%s'",buf_line);
+                    log_it(L_WARNING, "Input: Wrong request line '%s'",buf_line);
                     cl->buf_in_size=0;
                     cl_ht->state_read=DAP_HTTP_CLIENT_STATE_NONE;
                     dap_client_ready_to_read(cl_ht->client,false);
@@ -253,7 +253,7 @@ cnt:switch(cl_ht->state_read){
                     cl_ht->state_write=DAP_HTTP_CLIENT_STATE_START;
                 }
             }else{
-                log_it(WARNING,"Too big line in request, more than %llu symbols - thats very strange",sizeof(buf_line)-3);
+                log_it(L_WARNING,"Too big line in request, more than %llu symbols - thats very strange",sizeof(buf_line)-3);
                 cl->buf_in_size=0;
                 cl_ht->state_read=DAP_HTTP_CLIENT_STATE_NONE;
                 dap_client_ready_to_read(cl_ht->client,false);
@@ -275,14 +275,15 @@ cnt:switch(cl_ht->state_read){
                 parse_ret=dap_http_header_parse(cl_ht,buf_line);
               //  log_it(WARNING, "++ ALL HEADERS TO PARSE [%s]", buf_line);
                 if(parse_ret<0)
-                    log_it(WARNING,"Input: not a valid header '%s'",buf_line);
+                    log_it(L_WARNING,"Input: not a valid header '%s'",buf_line);
                 else if(parse_ret==1){
-                    log_it(INFO,"Input: HTTP headers are over");
+                    log_it(L_INFO,"Input: HTTP headers are over");
+#ifdef DAP_SERVER
                     if(cl_ht->proc->access_callback){
                         bool isOk=true;
                         cl_ht->proc->access_callback(cl_ht,&isOk);
                         if(!isOk){
-                            log_it(NOTICE,"Access restricted");
+                            log_it(L_NOTICE,"Access restricted");
                             cl_ht->state_read=DAP_HTTP_CLIENT_STATE_NONE;
                             dap_client_ready_to_read(cl_ht->client,false);
                             dap_client_ready_to_write(cl_ht->client,true);
@@ -294,6 +295,7 @@ cnt:switch(cl_ht->state_read){
 
                     if(cl_ht->proc->headers_read_callback)
                         cl_ht->proc->headers_read_callback(cl_ht,NULL);
+#endif
                      // If no headers callback we go to the DATA processing
                     if(cl_ht->in_content_length ){
                         cl_ht->state_read=DAP_HTTP_CLIENT_STATE_DATA;
@@ -311,12 +313,14 @@ cnt:switch(cl_ht->state_read){
         case DAP_HTTP_CLIENT_STATE_DATA:{//Read the data
          //   log_it(WARNING, "DBG_#002 [%s] [%s]",             cl_ht->in_query_string, cl_ht->url_path);
             int read_bytes=0;
+#ifdef DAP_SERVER
             if(cl_ht->proc->data_read_callback){
                 //while(cl_ht->client->buf_in_size){
                     cl_ht->proc->data_read_callback(cl_ht,&read_bytes);
                     dap_client_shrink_buf_in(cl,read_bytes);
                 //}
             }else
+#endif
                 cl->buf_in_size=0;
         } break;
         case DAP_HTTP_CLIENT_STATE_NONE:{
@@ -335,7 +339,7 @@ cnt:switch(cl_ht->state_read){
  * @param cl HTTP Client instance
  * @param arg Additional argument (usualy not used)
  */
-void dap_http_client_write(struct dap_client * cl,void * arg)
+void dap_http_client_write(dap_client_remote_t * cl,void * arg)
 {
 
     (void) arg;
@@ -344,10 +348,12 @@ void dap_http_client_write(struct dap_client * cl,void * arg)
     switch(cl_ht->state_write){
         case DAP_HTTP_CLIENT_STATE_NONE: return;
         case DAP_HTTP_CLIENT_STATE_START:{
+#ifdef DAP_SERVER
             if(cl_ht->proc)
                 if(cl_ht->proc->headers_write_callback)
                     cl_ht->proc->headers_write_callback(cl_ht,NULL);
-            log_it(DEBUG,"Output: HTTP response with %u status code",cl_ht->reply_status_code);
+#endif
+            log_it(L_DEBUG,"Output: HTTP response with %u status code",cl_ht->reply_status_code);
             dap_client_write_f(cl,"HTTP/1.1 %u %s\r\n",cl_ht->reply_status_code, cl_ht->reply_reason_phrase[0]?cl_ht->reply_reason_phrase:"UNDEFINED");
             dap_http_client_out_header_generate(cl_ht);
 
@@ -356,12 +362,12 @@ void dap_http_client_write(struct dap_client * cl,void * arg)
         case DAP_HTTP_CLIENT_STATE_HEADERS:{
             dap_http_header_t * hdr=cl_ht->out_headers;
             if(hdr==NULL){
-                log_it(DEBUG, "Output: headers are over (reply status code %u)",cl_ht->reply_status_code);
+                log_it(L_DEBUG, "Output: headers are over (reply status code %u)",cl_ht->reply_status_code);
                 dap_client_write_f(cl,"\r\n");
                 if(cl_ht->out_content_length || cl_ht->out_content_ready){
                     cl_ht->state_write=DAP_HTTP_CLIENT_STATE_DATA;
                 }else{
-                    log_it(DEBUG,"Nothing to output");
+                    log_it(L_DEBUG,"Nothing to output");
                     cl_ht->state_write=DAP_HTTP_CLIENT_STATE_NONE;
                     dap_client_ready_to_write(cl,false);
 
@@ -375,9 +381,11 @@ void dap_http_client_write(struct dap_client * cl,void * arg)
             }
         }break;
         case DAP_HTTP_CLIENT_STATE_DATA:{
+#ifdef DAP_SERVER
             if(cl_ht->proc)
                 if(cl_ht->proc->data_write_callback)
                     cl_ht->proc->data_write_callback(cl_ht,NULL);
+#endif
         }break;
     }
 }
@@ -399,19 +407,20 @@ void dap_http_client_out_header_generate(dap_http_client_t *cl_ht)
         }
         if(cl_ht->out_content_type[0]){
             dap_http_header_add(&cl_ht->out_headers,"Content-Type",cl_ht->out_content_type);
-            log_it(DEBUG,"output: Content-Type = '%s'",cl_ht->out_content_type);
+            log_it(L_DEBUG,"output: Content-Type = '%s'",cl_ht->out_content_type);
         }
         if(cl_ht->out_content_length){
             snprintf(buf,sizeof(buf),"%llu",(unsigned long long)cl_ht->out_content_length);
             dap_http_header_add(&cl_ht->out_headers,"Content-Length",buf);
-            log_it(DEBUG,"output: Content-Length = %llu",cl_ht->out_content_length);
+            log_it(L_DEBUG,"output: Content-Length = %llu",cl_ht->out_content_length);
         }
     }
     if(cl_ht->out_connection_close ||  (!cl_ht->keep_alive) )
         dap_http_header_add(&cl_ht->out_headers,"Connection","Close");
-
+#ifdef DAP_SERVER
     dap_http_header_add(&cl_ht->out_headers,"Server-Name", cl_ht->http->server_name);
-    log_it(DEBUG,"Output: Headers generated");
+#endif
+    log_it(L_DEBUG,"Output: Headers generated");
 }
 
 /**
@@ -419,11 +428,13 @@ void dap_http_client_out_header_generate(dap_http_client_t *cl_ht)
  * @param cl HTTP Client instance
  * @param arg Additional argument (usualy not used)
  */
-void dap_http_client_error(struct dap_client * cl,void * arg)
+void dap_http_client_error(struct dap_client_remote * cl,void * arg)
 {
     (void) arg;
     dap_http_client_t * cl_ht=DAP_HTTP_CLIENT(cl);
+#ifdef DAP_SERVER
     if(cl_ht->proc)
         if(cl_ht->proc->error_callback)
         cl_ht->proc->error_callback(cl_ht,arg);
+#endif
 }
diff --git a/http/dap_http_header.c b/http/dap_http_header.c
index c4e84a7822bf362c6c9e1e85a91ef27fd557bceb..29798dab558997bfb6d053840896681a736c7c4e 100644
--- a/http/dap_http_header.c
+++ b/http/dap_http_header.c
@@ -23,7 +23,7 @@
 #include <stdarg.h>
 #include <string.h>
 #include <stdlib.h>
-#include "common.h"
+#include "dap_common.h"
 #include "dap_client.h"
 #include "dap_http_client.h"
 #include "dap_http_header.h"
@@ -37,7 +37,7 @@
  */
 int dap_http_header_init()
 {
-    log_it(NOTICE, "Initialized HTTP headers module");
+    log_it(L_NOTICE, "Initialized HTTP headers module");
     return 0;
 }
 
@@ -46,7 +46,7 @@ int dap_http_header_init()
  */
 void dap_http_header_deinit()
 {
-    log_it(INFO, "HTTP headers module deinit");
+    log_it(L_INFO, "HTTP headers module deinit");
 }
 
 
@@ -67,7 +67,7 @@ int dap_http_header_parse(struct dap_http_client * cl_ht, const char * str)
     if( str_len==0 )
         return 1;
 
-    //log_it(DEBUG, "Parse header string '%s'",str);
+    //log_it(L_DEBUG, "Parse header string '%s'",str);
     for(pos=1; pos<str_len;pos++)
         if(str[pos]==':'){
             size_t name_len;
@@ -88,7 +88,7 @@ int dap_http_header_parse(struct dap_http_client * cl_ht, const char * str)
 
             if(strcmp(name,"Connection")==0){
                 if(strcmp(value,"Keep-Alive")==0){
-                    log_it(INFO, "Input: Keep-Alive connection detected");
+                    log_it(L_INFO, "Input: Keep-Alive connection detected");
                     cl_ht->keep_alive=true;
                 }
             }else if(strcmp(name,"Content-Type")==0){
@@ -100,14 +100,14 @@ int dap_http_header_parse(struct dap_http_client * cl_ht, const char * str)
             }
 
 
-            //log_it(DEBUG, "Input: Header\t%s '%s'",name,value);
+            //log_it(L_DEBUG, "Input: Header\t%s '%s'",name,value);
 
             dap_http_header_add(&cl_ht->in_headers,name,value);
             return 0;
         }
 
 
-    log_it(ERROR,"Input: Wasn't found ':' symbol in the header");
+    log_it(L_ERROR,"Input: Wasn't found ':' symbol in the header");
     return -1;
 }
 
@@ -123,7 +123,7 @@ int dap_http_header_parse(struct dap_http_client * cl_ht, const char * str)
 dap_http_header_t* dap_http_header_add(dap_http_header_t ** top, const char*name, const char * value)
 {
     dap_http_header_t * nh = (dap_http_header_t*) calloc(1,sizeof(dap_http_header_t));
-  //  log_it(DEBUG,"Added header %s",name);
+  //  log_it(L_DEBUG,"Added header %s",name);
     nh->name=strdup(name);
     nh->value=strdup(value);
     nh->next=*top;
@@ -136,7 +136,6 @@ dap_http_header_t* dap_http_header_add(dap_http_header_t ** top, const char*name
 
 struct dap_http_header* dap_http_out_header_add(dap_http_client_t * ht, const char*name, const char * value)
 {
-
     return dap_http_header_add(&ht->out_headers,name,value);
 }