simplify offsetRow calculation, cleanup unused code