added maximum file size for robustness