writetofile added