added check to make sure input files are actually files and not folders