diff --git a/include/libhqr.h b/include/libhqr.h
index d0da407578535972f5276da97c88251b3353c919..4f868646b0825269abdd3d985b4c3a929647f9a4 100644
--- a/include/libhqr.h
+++ b/include/libhqr.h
@@ -19,6 +19,7 @@
 #define _LIBHQR_H_
 
 #include "common.h"
+#include <stdio.h>
 
 BEGIN_C_DECLS
 
@@ -193,7 +194,7 @@ void libhqr_hqr_finalize( libhqr_tree_t *qrtree );
  * function for treewalk
  */
 
-void libhqr_treewalk(const libhqr_tree_t *qrtree,int k, int *tiles);
+void libhqr_treewalk(const libhqr_tree_t *qrtree,int k, int *tiles, FILE *tree);
 
 /*
  * Debugging functions
diff --git a/src/treedraw.c b/src/treedraw.c
index a051e2c1aded30df900c874c63d5b7f04747715f..f834e16e1f14f79b22dec38918648ccb8cd88832 100644
--- a/src/treedraw.c
+++ b/src/treedraw.c
@@ -22,7 +22,7 @@
  * Global array for color
  */
 
-char *color[4] = {"red", "blue", "green", "purple"};
+char *colortree[4] = {"red", "blue", "green", "purple"};
 
 /*
  * functions writing in the svg file
@@ -45,12 +45,12 @@ void libhqr_writeheader(FILE *tree){
  */
 
 void libhqr_drawTT(int x, int y, int w, int h, int k, FILE *tree){
-    if(fprintf(tree,"<rect x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" fill=\"%s\" /> \n", x, y, w, h, color[k%4]) < 0 )
+    if(fprintf(tree,"<rect x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" fill=\"%s\" /> \n", x, y, w, h, colortree[k%4]) < 0 )
         return;
 }
 
 void libhqr_drawTS(int x, int y, int w, int h, int k, FILE *tree){
-    if(fprintf(tree,"<rect x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" fill=\"%s\" /> \n", x, y, w, h, color[k%4]) < 0 )
+    if(fprintf(tree,"<rect x=\"%d\" y=\"%d\" width=\"%d\" height=\"%d\" fill=\"%s\" /> \n", x, y, w, h, colortree[k%4]) < 0 )
         return;
     int x2 = x + (w / 4);
     int y2 = y + (h / 4);
@@ -60,7 +60,7 @@ void libhqr_drawTS(int x, int y, int w, int h, int k, FILE *tree){
 }
 
 void libhqr_drawline(int x1, int y1, int x2, int y2, int k, FILE *tree){
-    if(fprintf(tree,"<line x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" style=\"fill:none;stroke:%s;stroke-width:2px;\"/> \n", x1, y1, x2, y2, color[k%4]) < 0 ) return;
+    if(fprintf(tree,"<line x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" style=\"fill:none;stroke:%s;stroke-width:2px;\"/> \n", x1, y1, x2, y2, colortree[k%4]) < 0 ) return;
 }
 
 void libhqr_writeend(FILE *tree){
diff --git a/src/treewalk.c b/src/treewalk.c
index 7d2a2dcc38ad41adaf6326ca8c9fe8e52e5bea6b..09bf97462eb37fbd8ff2fc2d4dee8ab505c5acd2 100644
--- a/src/treewalk.c
+++ b/src/treewalk.c
@@ -14,6 +14,7 @@
  *
  */
 #include "libhqr.h"
+#include "libdraw.h"
 #include "queue.h"
 #include <stdio.h>
 #include <assert.h>
@@ -35,14 +36,14 @@
  *         Table stocking the tiles and their step
  *
  */
-void libhqr_treewalk(const libhqr_tree_t *qrtree, int k, int *tiles)
+void libhqr_treewalk(const libhqr_tree_t *qrtree, int k, int *tiles, FILE *tree)
 {
     int tsid = -1, ttid = -1;
     int p = k;
     int pivot = k;
     libhqr_queue_tile_t *tt = libhqr_queue_tile_new();
     libhqr_queue_tile_t *ts = libhqr_queue_tile_new();
-    int y;
+    int y, ordinate1, ordinate2, ordinate3, ordinate4, absciss1, absciss2, absciss3, absciss4;
     libhqr_queue_tile_push(&tt, k);
 
     while( tt )
@@ -74,9 +75,18 @@ void libhqr_treewalk(const libhqr_tree_t *qrtree, int k, int *tiles)
             printf("POP TS: %d\n", tsid);
             printf("Call function on (%d, %d)\n",
                    qrtree->currpiv(qrtree, k, tsid), tsid );
+            /* Drawing the horizontal lines */
+            ordinate1 = ordinate2 = 100 + 100 * tsid;
+            ordinate3 = ordinate4 = 100 + 100 * qrtree->currpiv(qrtree, k, tsid);
+            absciss1 = 100 + 100 * tiles[tsid];
+            absciss3 = 100 + 100 * tiles[qrtree->currpiv(qrtree, k, tsid)];
+            /* Increasing the step */
             y = libhqr_imax(tiles[tsid],  tiles[qrtree->currpiv(qrtree, k, tsid)]) + 1;
             tiles[tsid] = tiles[qrtree->currpiv(qrtree, k, tsid)] = y;
-            printf("Step %d\n", y );
+            absciss2 = 100 +100 * tiles[tsid];
+            absciss4 = 100 + 100 * tiles[qrtree->currpiv(qrtree, k, tsid)];
+            libhqr_drawline( absciss1, ordinate1, absciss2, ordinate2, k, tree);
+            libhqr_drawline( absciss3, ordinate3, absciss4, ordinate4, k, tree);
             tsid = libhqr_queue_tile_head(&ts);
         }
         pivot = p = ttid;
diff --git a/testings/testing_treedraw.c b/testings/testing_treedraw.c
index bb5c9e5ec4831c67175032b6f85c4229891ffe24..d4d8bb45cbb04a4ea59c46abf7f67ce8918ad9fe 100644
--- a/testings/testing_treedraw.c
+++ b/testings/testing_treedraw.c
@@ -43,17 +43,11 @@ main(int argc, char ** argv)
     }
     FILE *tree = fopen("tree.svg","w+");
     libhqr_writeheader(tree);
-    for (k = 0; k < 2; k++){
-        libhqr_treewalk(&qrtree, k, tiles);
+    for (k = 0; k < 3; k++){
+        libhqr_treewalk(&qrtree, k, tiles, tree);
 
-        /* Drawing the lines */
-        for (i = 0; i < maxMN; i++){
-            /* Drawing the horizontal line */
-            x1 = 100;
-            y1 = y2 = 100 + 100 * i;
-            x2 = 100 + 100*tiles[i];
-            libhqr_drawline(x1, y1, x2, y2, k, tree);
-            /* Drawing the vertical line */
+        /* Drawing the vertical lines */
+        for (i = k; i < maxMN; i++){
             if (i > 0){
                 x1 = x2 = 100 + 100 * tiles[i];
                 y1 = 100 + 100 * i;
@@ -63,25 +57,14 @@ main(int argc, char ** argv)
         }
 
         /* Drawing the rectangles */
-        for (i = 1; i < maxMN; i++){
-            if(qrtree.gettype(&qrtree, k, i) == 0){
-                x1 = 75 + 100 * tiles[i];
-                y1 = 75 + 100 * i;
-                libhqr_drawTS(x1, y1, WIDTH, HEIGHT, k, tree);
-                j = qrtree.currpiv(&qrtree, k, i);
-                x1 = 75 + 100 * tiles[i];
-                y1 = 75 + 100 * j;
-                libhqr_drawTT(x1, y1, WIDTH, HEIGHT, k, tree);
-            }
-            else {
-                x1 = 75 + 100 * tiles[i];
-                y1 = 75 + 100 * i;
-                libhqr_drawTS(x1, y1, WIDTH, HEIGHT, k, tree);
-                j = qrtree.currpiv(&qrtree, k, i);
-                x1 = 75 + 100 * tiles[i];
-                y1 = 75 + 100 * j;
-                libhqr_drawTT(x1, y1, WIDTH, HEIGHT, k, tree);
-            }
+        for (i = k + 1; i < maxMN; i++){
+            x1 = 75 + 100 * tiles[i];
+            y1 = 75 + 100 * i;
+            libhqr_drawTS(x1, y1, WIDTH, HEIGHT, k, tree);
+            j = qrtree.currpiv(&qrtree, k, i);
+            x1 = 75 + 100 * tiles[i];
+            y1 = 75 + 100 * j;
+            libhqr_drawTT(x1, y1, WIDTH, HEIGHT, k, tree);
         }
     }
     libhqr_writeend(tree);
diff --git a/testings/testing_treewalk.c b/testings/testing_treewalk.c
index 1c6f22e1dcac43e51cb41329522502a5577dbb4c..ca656de38610ccfe6940e5f285ef073b410b575b 100644
--- a/testings/testing_treewalk.c
+++ b/testings/testing_treewalk.c
@@ -25,6 +25,7 @@ main(int argc, char ** argv)
     libhqr_tiledesc_t matrix;
     int *tiles;
     int maxMN, rc ;
+    FILE *tree = fopen("tree.svg","w+");
     /*
      * Test treewalk for HQR trees
      */
@@ -40,7 +41,7 @@ main(int argc, char ** argv)
     }
     rc = libhqr_tree_check( &matrix, &qrtree );
     printf("%d\n", rc);
-    libhqr_treewalk( &qrtree, 0, tiles);
+    libhqr_treewalk( &qrtree, 0, tiles, tree);
     libhqr_hqr_finalize( &qrtree );
     free(tiles);
 }