Added more trace_file logic