Arg parsing done
Wrote a perl version too.