More memory-efficient large file handling