renamed file writeToFile