Better file handling