Added file isValid method.