wrote saveDataToFile, updated main