refactoring of the tstat trace analysis lab