Updated some file writing