Added better handling of large files