Modified file writing