Cleaned up arg checking and output file name creation.