Minor refactoring.
Removing unnecessary code.
Fixed issue with changing the output directory