Automated file writing added