File handling and gzip support