Added support for custom output directory