Wrote a quick writefile function