Added option for specifying output directory