Added offset calculations