try declaring writeFile, readFile, etc. with var