now writing to file