clean up tracking code
simplify offset code