freq_tracer: rearrange code