Added support for custom output directory
Code Formatting
Simplified code for directory output argument.