timing
updated writing to file logic