diff --git a/include/libdraw.h b/include/libdraw.h
new file mode 100644
index 0000000000000000000000000000000000000000..020abbee5122587c7d323edd6c98f011f9957074
--- /dev/null
+++ b/include/libdraw.h
@@ -0,0 +1,48 @@
+/**
+  *
+  * @file libdraw.h - header for all the functions of drawing.
+  *
+  * PaStiX symbol structure routines
+  *
+  * @copyright 2017 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
+  *                      Univ. Bordeaux. All rights reserved.
+  *
+  * @version 1.0.0
+  * @author Raphael Boucherie
+  * @author Matthieu Faverge
+  * @date 2017-04-04
+  *
+  **/
+
+#include <stdio.h>
+#ifndef _LIBDRAW_H_
+#define _LIBDRAW_H_
+
+#undef BEGIN_C_DECLS
+#undef END_C_DECLS
+#if defined(c_plusplus) || defined(__cplusplus)
+# define BEGIN_C_DECLS extern "C" {
+# define END_C_DECLS }
+#else
+#define BEGIN_C_DECLS          /* empty */
+#define END_C_DECLS            /* empty */
+#endif
+
+BEGIN_C_DECLS
+
+/*
+ * function for treedraw
+ */
+
+void libhqr_writeheader(FILE *tree);
+void libhqr_writecss();
+void libhqr_writeend(FILE *tree);
+void libhqr_drawTT(int x, int y, int k, FILE *tree);
+void libhqr_drawTS(int x, int y, FILE *tree);
+void libhqr_drawline(int x1, int y1, int x2, int y2, FILE *tree);
+
+
+  
+END_C_DECLS
+
+#endif /* _LIBDRAW_H_ */
diff --git a/src/treedraw.c b/src/treedraw.c
index e0d8b4f66b900949a048265594e5a3e070b832d2..9fa354d93d8ff5bd06eac5cbe46f8c854701872c 100644
--- a/src/treedraw.c
+++ b/src/treedraw.c
@@ -1,6 +1,8 @@
 /**
   *
-  * @file treedraw.c
+  * @file treedraw.c - All the functions required for drawing tree are here.
+  *                    TT and TS tiles are drawn in rectangle.
+  *
   *
   * PaStiX symbol structure routines
   *
@@ -9,53 +11,35 @@
   *
   * @version 1.0.0
   * @author Raphael Boucherie
-  * @author Matthieu Faverge
+  * @author Mathieu Faverge
   * @date 2017-04-04
   *
   **/
 
-#include "libhqr.h"
-#include <assert.h>
-#include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
-#include <math.h>
-//#if defined(LIBHQR_HAVE_STRING_H)
-#include <string.h>
-//#endif  /* defined(PARSEC_HAVE_STRING_H) */
-#define PRINT_PIVGEN 0
-#ifdef PRINT_PIVGEN
-#define myassert( test ) {if ( ! (test) ) return -1;}
-#else
-#define myassert(test) {assert((test)); return -1;}
-#endif
-
+#include "libdraw.h"
 
-void libhqr_writeheader(){
-  FILE *tree = fopen("tree.svg", "w+");
+void libhqr_writeheader(FILE *tree){
   if(fprintf(tree, "<?xml version=\"1.0\" standalone=\"no\"?>\n") < 0) return;
   if(fprintf(tree, "<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \n \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\n ") < 0) return;
-  if(fprintf(tree, "<svg width=\"2000\" height=\"2000\" version=\"1.1\" \n xmlns=\"http://www.w3.org/2000/svg\">") <0) return;
+  if(fprintf(tree, "<svg width=\"2000\" height=\"2000\" version=\"1.1\" \n xmlns=\"http://www.w3.org/2000/svg\">\n") <0) return;
 }
 
 void libhqr_writecss();
 
-void libhqr_drawTT(int x, int y, int k){
-  FILE *tree = fopen("tree.svg","a+");
-  if(fprintf(tree,"<rect x=\"50\" y=\"50\" width=\"50\" height=\"50\" fill=\"red\" />") < 0 ) return;
+void libhqr_drawTT(int x, int y, int k, FILE *tree){
+  if(fprintf(tree,"<rect x=\"%d\" y=\"%d\" width=\"50\" height=\"50\" fill=\"red\" /> \n", x, y) < 0 ) return;
 }
 
-void libhqr_drawTS(int x, int y){
-  FILE *tree = fopen("tree.svg","a+");
-  if(fprintf(tree,"<rect x=\"40\" y=\"40\" width=\"50\" height=\"50\" />") < 0 ) return;
+void libhqr_drawTS(int x, int y, FILE *tree){
+  if(fprintf(tree,"<rect x=\"%d\" y=\"%d\" width=\"50\" height=\"50\" /> \n", x, y) < 0 ) return;
 }
 
-void libhqr_drawline(int x1, int y1, int x2, int y2){
-  FILE *tree = fopen("tree.svg","a+");
-  if(fprintf(tree,"<line x1=\"20\" y1=\"80\" x2=\"130\" y2=\"200\" />") < 0 ) return;
+void libhqr_drawline(int x1, int y1, int x2, int y2, FILE *tree){
+  if(fprintf(tree,"<line x1=\"%d\" y1=\"%d\" x2=\"%d\" y2=\"%d\" /> \n", x1, y1, x2, y2) < 0 ) return;
 }
 
-void libhqr_writeend(){
-  FILE *tree = fopen("tree.svg", "a+");
-  if(fprintf(tree, "<\\svg>") < 0) return;
+void libhqr_writeend(FILE *tree){
+  if(fprintf(tree, "</svg>") < 0) return;
 }
diff --git a/testings/testing_treedraw.c b/testings/testing_treedraw.c
index eaa4dab875ba7cabaf594d1785d07477f595e34a..6b0b67fa4fe128acf0dd6fd5debe83ef505996e0 100644
--- a/testings/testing_treedraw.c
+++ b/testings/testing_treedraw.c
@@ -1,6 +1,6 @@
 /**
   *
-  * @file testting_treedraw.c
+  * @file testting_treedraw.c - Testing file for drawing functions and drawing tree
   *
   * PaStiX symbol structure routines
   *
@@ -9,25 +9,24 @@
   *
   * @version 1.0.0
   * @author Raphael Boucherie
-  * @author Matthieu Faverge
+  * @author Mathieu Faverge
   * @date 2017-04-04
   *
   **/
 
 
-#include "libhqr.h"
-#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <math.h>
+#include "libdraw.h"
 
 
 
 int main(int argc, char ** argv)
 {
-  libhqr_writeheader();
-  libhqr_drawTT(50,50,1);
-  libhqr_drawTS(40,40);
-  libhqr_drawline(50,50,40,40);
-  libhqr_writeend();
+  FILE *tree = fopen("tree.svg","w+");
+  libhqr_writeheader(tree);
+  libhqr_drawTT(50,50,1,tree);
+  libhqr_drawTS(40,40,tree);
+  libhqr_drawline(50,50,40,40,tree);
+  libhqr_writeend(tree);
 }