Moved around offset computation