+# get filename from last argument
+if [[ $# == 3 && -f $DIR/$3 ]] ; then
+ FILE=$3
+elif [[ $# == 2 && -f $DIR/$2 ]] ; then
+ FILE=$2
+fi
+
+#Debug needs to be output on stderr ( calling script redirects stdout to file )
+#echo "Dir: $DIR File: $FILE" >& 2