optional set output directory and better handling of cli arguments