refine tracking logic