Edited error checking to allow some of the input files to be empty.