refactored validation of input files