Added checking / creation of output directory if required