modifications
diff --git a/rearrange-idsDoc.awk b/rearrange-idsDoc.awk
index e267553..fad3db2 100644
--- a/rearrange-idsDoc.awk
+++ b/rearrange-idsDoc.awk
@@ -2,7 +2,7 @@
 BEGIN                                                           {DOCCOUNT = 0;}
 
 $0 ~  "</idsDoc>"                                               {}
-$0 ~  "<idsDoc>"                                                {
+$0 ~  "<idsDoc"                                                 {
                                                                   if(DOCCOUNT++ > 0){
 								      print "  </idsDoc>";
 								    };
@@ -10,5 +10,5 @@
                                                                 }
 $0 ~  "</idsCorpus>"                                            {print "  </idsDoc>\n</idsCorpus>"}
 
-$0 !~ "</idsDoc>" && $0 !~ "</idsCorpus>" && $0 !~ "<idsDoc>"   {print}
+$0 !~ "</idsDoc>" && $0 !~ "</idsCorpus>" && $0 !~ "<idsDoc"    {print}