Added checking for input files.