Added checks to make sure input files exist.