Added a line for output file and re-arranged the arg check as per
comment