refactored writeFile and readFile