Added write to file logic