refactored file validator.