Refactor worker loop to use offsets directly