rename startIndex to offset for clarity