Added support for specifying an output directory not just an output file
Cleaned up the boolean logic for when out and dir args are added to command line