program now saves data to file