added commented code to compute byte offsets