modified code to output an empty results file if the input reads or reference file is empty