Rewritten file handling