Using writeFile rather than write