Added output directory option on command line
Added more parsing to output file