diff --git a/deconvolution/d2_graph.py b/deconvolution/d2_graph.py
index f7964e214ecad0c3e5178f659fdcacbbf7be98a6..80961f4e58cd3ba097b808c8d3a597f7b1a9b0f3 100644
--- a/deconvolution/d2_graph.py
+++ b/deconvolution/d2_graph.py
@@ -59,7 +59,7 @@ class D2Graph(nx.Graph):
         import debug_disct as dd
         # Compute all the d-graphs
         if verbose:
-            print("Compute the unit d-graphs")
+            print("Computing the unit d-graphs..")
         self.d_graphs_per_node = compute_all_max_d_graphs(self.barcode_graph, debug=debug)
         if verbose:
             counts = sum(len(x) for x in self.d_graphs_per_node.values())
diff --git a/deconvolution/d_graph.py b/deconvolution/d_graph.py
index fc51a2450d57ab3e83c4e169de26df9612265a1d..640e1d95a4edc7082691b72159da9f01c7269481 100644
--- a/deconvolution/d_graph.py
+++ b/deconvolution/d_graph.py
@@ -242,6 +242,8 @@ def compute_all_max_d_graphs(graph, debug=False):
         # Find all the cliques (equivalent to compute all the candidate half d-graph)
         cliques = list(nx.find_cliques(neighbors_graph))
 
+        if debug: print("node",node,"has",len(cliques),"cliques")
+
         # Pair halves to create d-graphes
         for idx, clq1 in enumerate(cliques):
             for clq2_idx in range(idx+1, len(cliques)):
diff --git a/deconvolution/to_d2_graph.py b/deconvolution/to_d2_graph.py
index bece31f0f8ce6be440379bccd5273c4f47c23cc6..40d8834e98b15efbe3901e0e6d03a41cb8922ec1 100755
--- a/deconvolution/to_d2_graph.py
+++ b/deconvolution/to_d2_graph.py
@@ -10,25 +10,41 @@ import d2_graph as d2
 def parse_arguments():
     parser = argparse.ArgumentParser(description='Transform a 10X barcode graph into a d2 graph. The program dig for the d-graphs and then merge them into a d2-graph.')
     parser.add_argument('barcode_graph', help='The barcode graph file. Must be a gefx formated file.')
-    parser.add_argument('--output_prefix', '-o', default="d2_graph", help="Output file prefix.")
+    parser.add_argument('--output_prefix', '-o', default="d2_graph",  help="Output file prefix.")
+    parser.add_argument('--debug',         '-d', action='store_true', help="Debug")
 
     args = parser.parse_args()
     return args
 
-
 def main():
     # Parsing the input file
     args = parse_arguments()
-
+    
+    debug = args.debug
     filename = args.barcode_graph
-    if not filename.endswith('.gexf'):
-        print("Input file must be gexf formatted", file=sys.stderr)
+   
+    def dprint(s):
+        from datetime import datetime
+        t = datetime.now().strftime('%Y-%m-%d %H:%M:%S')
+        if debug: print(t,"[debug]",s)
+
+    dprint("loading barcode graph")
+    if filename.endswith('.gexf'):
+        G = nx.read_gexf(filename)
+    elif filename.endswith('.graphml'):
+        G = nx.read_graphml(filename)
+    else:
+        print("Input file must be gexf or graphml formatted", file=sys.stderr)
         exit(1)
+    dprint("barcode graph loaded")
 
-    G = nx.read_gexf(filename)
     # Index size must be changed for general purpose. 8 is good for d=5
+    dprint("creating D2graph object")
     d2g = d2.D2Graph(G)
-    d2g.construct_from_barcodes(index_size=8)
+    dprint("D2 graph object created")
+    dprint("constructing d2 graph from barcode graph")
+    d2g.construct_from_barcodes(index_size=8, debug=debug)
+    dprint("[debug] d2 graph constructed")
     
     d2g.save(f"{args.output_prefix}.tsv")
     nx.write_gexf(d2g, f"{args.output_prefix}.gexf")