diff --git a/LICENSE.md b/LICENSE.md
new file mode 100644
index 0000000000000000000000000000000000000000..aa87cac9c6d0bd3c993035d2ce143187ee04db80
--- /dev/null
+++ b/LICENSE.md
@@ -0,0 +1,8 @@
+Copyright (c) 2016, Saulo Alves Aflitos, Wageningen University
+
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/genGff.sh b/genGff.sh
index 2bfa0148268b5a9f8ec9f0ff66e8e579fd73371a..7f08425bffcfcdb772a8972a890d2e2334365f49 100644
--- a/genGff.sh
+++ b/genGff.sh
@@ -1,2 +1,2 @@
-pypy targets/matcher.py S_lycopersicum_scaffolds.2.50.fa S_lycopersicum_scaffolds.2.50.fa.gz_kmasked_RT03_3kb_N2X.fa.gff3 S_lycopersicum_scaffolds.2.50.fa.gz_kmasked_RT03_3kb_N2X.fa
-pypy targets/matcher.py S_lycopersicum_chromosomes.2.50.fa S_lycopersicum_chromosomes.2.50.fa.gz_kmasked_RT03_3kb_N2X.fa.gff3 S_lycopersicum_chromosomes.2.50.fa.gz_kmasked_RT03_3kb_N2X.fa
+pypy matcher.py --ref S_lycopersicum_scaffolds.2.50.fa   --out S_lycopersicum_scaffolds.2.50.fa.gz_kmasked_RT03_3kb_N2X.fa.gff3 S_lycopersicum_scaffolds.2.50.fa.gz_kmasked_RT03_3kb_N2X.fa
+pypy matcher.py --ref S_lycopersicum_chromosomes.2.50.fa --out S_lycopersicum_chromosomes.2.50.fa.gz_kmasked_RT03_3kb_N2X.fa.gff3 S_lycopersicum_chromosomes.2.50.fa.gz_kmasked_RT03_3kb_N2X.fa
diff --git a/matcher.py b/matcher.py
index 36172299db1ecf8c2ef0762ca40bf5d257edd794..3e4313fa1965e24573c8c7ca37aadba8cde51c09 100755
--- a/matcher.py
+++ b/matcher.py
@@ -2,6 +2,8 @@
 
 import os
 import sys
+import argparse
+
 from collections import OrderedDict
 
 def readFasta(inRef):
@@ -35,24 +37,43 @@ def readFasta(inRef):
 
     return refs
 
+parser = argparse.ArgumentParser(description='Read fasta reference, read sequences extracted by kmasker and export GFF with the coordinates.')
+parser.add_argument('--ref'  , metavar='REF'    , dest='ref'    , required=True, nargs=1                 , type=str, help='Reference file')
+parser.add_argument('--out'  , metavar='OUT'    , dest='out'    , required=True, nargs=1                 , type=str, help='Output GFF file')
+parser.add_argument('INFILES', metavar='INFILES',                                nargs=argparse.REMAINDER,           help='Input Files (kmasker output)')
+
 def main():
-    inRef = sys.argv[1]
-    outFile = sys.argv[2]
-    inFiles = sys.argv[3:]
+    args = parser.parse_args()
+
+    inRef = args.ref[0]
+    outFile = args.out[0]
+    inFiles = args.INFILES
 
     print "ref", inRef
     print "out", outFile
-    print "files", len(inFiles), inFiles
+    print "files", len(inFiles), ", ".join(inFiles)
 
     if os.path.exists(outFile):
         print "output file {} exists. quitting".format(outFile)
         sys.exit(1)
 
+    if not os.path.exists(inRef):
+        print "input file {} does not exists".format(inRef)
+        sys.exit(1)
+
+    if len(files) == 0:
+        print "no input file given"
+        sys.exit(1)
+
+    if any([x == inRef for x in inFiles]):
+        print "reference {} in list of files: {}".format(inRef, ", ".join(inFiles))
+        sys.exit(1)
+
+
     print "reading reference"
     refs = readFasta(inRef)
 
     print "reading sequences"
-    #seqs = OrderedDict()
 
     with open(outFile, 'w') as fhdo:
         fhdo.write("##gff-version 3\n")
@@ -60,7 +81,6 @@ def main():
         for inFile in inFiles:
             print "  reading", inFile
             fileSeqs = readFasta(inFile)
-            #seqs[inFile] = seq
 
             for seqName, seq in fileSeqs.iteritems():
                 seqNameId, seqNameLen = seqName.split(" ")